diff --git a/src/kiwmi/main.c b/src/kiwmi/main.c index 83ba59d..6c1475c 100644 --- a/src/kiwmi/main.c +++ b/src/kiwmi/main.c @@ -117,7 +117,13 @@ main(int argc, char *argv[]) } if (FD_ISSET(g_dpy_fd, &file_descriptors)) { - // TODO: handle event + xcb_generic_event_t *event = xcb_wait_for_event(g_dpy); + + if (!event) { + die("XCB connection broke\n"); + } + + handle_xcb_event(event); } } } diff --git a/src/kiwmi/xcb.c b/src/kiwmi/xcb.c index e3aeb4e..8bdc768 100644 --- a/src/kiwmi/xcb.c +++ b/src/kiwmi/xcb.c @@ -53,3 +53,14 @@ init_xcb(void) g_dpy_fd = xcb_get_file_descriptor(g_dpy); } + +void +handle_xcb_event(xcb_generic_event_t *event) +{ + // TODO: handle event + + switch (event->response_type) { + } + + free(event); +} diff --git a/src/kiwmi/xcb.h b/src/kiwmi/xcb.h index 823835f..a6b9d1f 100644 --- a/src/kiwmi/xcb.h +++ b/src/kiwmi/xcb.h @@ -11,6 +11,7 @@ #include void init_xcb(void); +void handle_xcb_event(xcb_generic_event_t *event); extern int g_dpy_fd; extern xcb_connection_t *g_dpy;