From 33e283e42345e41fb09acdccb3a20e92cfea5a34 Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Sat, 13 Jul 2019 13:27:49 +0100 Subject: x11_window: Implement wait_for_event --- src/x11_window.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src') 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 +#include +#include #include +#include #include -#include -#include -#include 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) -- cgit v1.2.3