diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2019-07-13 13:27:49 +0100 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2019-07-13 13:27:49 +0100 |
commit | 33e283e42345e41fb09acdccb3a20e92cfea5a34 (patch) | |
tree | 9aa507821f72202c98d8cd34910c0a7551701e17 /src | |
parent | 0687370b2e0d8caab3cc4f6ad18fda068bed5518 (diff) | |
download | imv-33e283e42345e41fb09acdccb3a20e92cfea5a34.tar.gz |
x11_window: Implement wait_for_event
Diffstat (limited to 'src')
-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) |