From a7e3aa354e3c36af11d5288147468584801b7339 Mon Sep 17 00:00:00 2001 From: Iwan Timmer Date: Sun, 28 May 2017 12:51:12 +0200 Subject: [PATCH] Don't block on X11 if there are no events --- src/input/x11.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/input/x11.c b/src/input/x11.c index e661efe..b9a2c57 100644 --- a/src/input/x11.c +++ b/src/input/x11.c @@ -19,7 +19,6 @@ #include "x11.h" #include "keyboard.h" -#include "../global.h" #include "../loop.h" #include @@ -46,6 +45,9 @@ static Cursor cursor; static bool grabbed = True; static int x11_handler(int fd) { + if (!XPending(display)) + return LOOP_OK; + XEvent event; int button = 0; int motion_x, motion_y; @@ -120,7 +122,7 @@ static int x11_handler(int fd) { break; case ClientMessage: if (event.xclient.data.l[0] == wm_deletemessage) - quit(); + return LOOP_RETURN; break; }