Basic, non-working handling. GLHF

This commit is contained in:
buffet 2018-11-06 21:35:01 +01:00
parent 2e10b17c8e
commit 3e6eb120ed
2 changed files with 45 additions and 0 deletions

View file

@ -127,6 +127,8 @@ main(int argc, char *argv[])
continue;
}
handle_xcb_event(event);
free(event);
}
}

View file

@ -15,6 +15,10 @@
#define ROOT_MASK ( XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT )
static void handle_create_notify_event(xcb_create_notify_event_t *event);
static void handle_destroy_notify_event(xcb_destroy_notify_event_t *event);
static void handle_map_request_event(xcb_map_request_event_t *event);
int g_dpy_fd;
xcb_connection_t *g_dpy;
@ -55,3 +59,42 @@ init_xcb(void)
g_dpy_fd = xcb_get_file_descriptor(g_dpy);
}
void
handle_xcb_event(xcb_generic_event_t *event)
{
switch (event->response_type & ~0x80) {
case XCB_CREATE_NOTIFY:
handle_create_notify_event((xcb_create_notify_event_t *)event);
break;
case XCB_DESTROY_NOTIFY:
handle_destroy_notify_event((xcb_destroy_notify_event_t *)event);
break;
case XCB_MAP_REQUEST:
handle_map_request_event((xcb_map_request_event_t *)event);
break;
}
}
static void
handle_create_notify_event(xcb_create_notify_event_t *event)
{
warn("create_nofify\n");
// TODO: handle
}
static void
handle_destroy_notify_event(xcb_destroy_notify_event_t *event)
{
// TODO: handle
}
static void
handle_map_request_event(xcb_map_request_event_t *event)
{
warn("map_request\n");
// TODO: handle properly
xcb_map_window(g_dpy, event->window);
}