aboutsummaryrefslogtreecommitdiffstats
path: root/xevents.c
diff options
context:
space:
mode:
authorokan2017-12-27 17:04:35 +0000
committerokan2017-12-27 17:04:35 +0000
commit73cf1b91165b5fcb06a93997af95f6f0cabddc2f (patch)
treee20d9e8e14f5bee9c05119c0649dbd44ff634e0d /xevents.c
parent0b735864a54eb32d38a6e68dd818c9db4d91fdf9 (diff)
downloadcwm-73cf1b91165b5fcb06a93997af95f6f0cabddc2f.tar.gz
Use poll and XNextEvent to replace XNextEvent blocking inside the x11 event
handler.
Diffstat (limited to 'xevents.c')
-rw-r--r--xevents.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/xevents.c b/xevents.c
index f2430aa..71411f8 100644
--- a/xevents.c
+++ b/xevents.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: xevents.c,v 1.128 2017/05/09 18:43:40 okan Exp $
+ * $OpenBSD: xevents.c,v 1.129 2017/12/27 17:04:35 okan Exp $
*/
/*
@@ -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);
+ }
}