summary refs log tree commit diff
path: root/xevents.c
diff options
context:
space:
mode:
authorokan <okan>2017-12-27 17:04:35 +0000
committerokan <okan>2017-12-27 17:04:35 +0000
commit3d7c82936e6cbc49c92cdd985f8c3a8588028da5 (patch)
treeacfa1f6a5fd8115fb0c833effc922040a9535914 /xevents.c
parent03e5d869522e7fcc9243e6877bdc05cef2856c79 (diff)
downloadcwm-3d7c82936e6cbc49c92cdd985f8c3a8588028da5.tar.gz
cwm-3d7c82936e6cbc49c92cdd985f8c3a8588028da5.tar.xz
cwm-3d7c82936e6cbc49c92cdd985f8c3a8588028da5.zip
Use poll and XNextEvent to replace XNextEvent blocking inside the x11 event
handler.
Diffstat (limited to 'xevents.c')
-rw-r--r--xevents.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/xevents.c b/xevents.c
index 6f38605..19798d3 100644
--- a/xevents.c
+++ b/xevents.c
@@ -436,9 +436,11 @@ xev_process(void)
 {
 	XEvent		 e;
 
-	XNextEvent(X_Dpy, &e);
-	if (e.type - Conf.xrandr_event_base == RRScreenChangeNotify)
-		xev_handle_randr(&e);
-	else if (e.type < LASTEvent && xev_handlers[e.type] != NULL)
-		(*xev_handlers[e.type])(&e);
+	while (XPending(X_Dpy)) {
+		XNextEvent(X_Dpy, &e);
+		if (e.type - Conf.xrandr_event_base == RRScreenChangeNotify)
+			xev_handle_randr(&e);
+		else if (e.type < LASTEvent && xev_handlers[e.type] != NULL)
+			(*xev_handlers[e.type])(&e);
+	}
 }