diff options
-rw-r--r-- | src/x11_window.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/x11_window.c b/src/x11_window.c index 79046ff..36b9155 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -1,10 +1,11 @@ #include "window.h" +#include <GL/gl.h> +#include <GL/glx.h> +#include <X11/Xlib.h> #include <assert.h> +#include <poll.h> #include <stdlib.h> -#include <X11/Xlib.h> -#include<GL/gl.h> -#include<GL/glx.h> struct imv_window { Display *x_display; @@ -119,14 +120,20 @@ void imv_window_present(struct imv_window *window) void imv_window_wait_for_event(struct imv_window *window, double timeout) { - (void)window; - (void)timeout; + struct pollfd fds[] = { + {.fd = ConnectionNumber(window->x_display), .events = POLLIN}, + }; + nfds_t nfds = sizeof fds / sizeof *fds; + + poll(fds, nfds, timeout * 1000); } void imv_window_push_event(struct imv_window *window, struct imv_event *e) { (void)window; (void)e; + // XSendEvent + // XClientMessageEvent } void imv_window_pump_events(struct imv_window *window, imv_event_handler handler, void *data) |