summaryrefslogtreecommitdiff
path: root/app/cwm/xevents.c
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2017-12-27 17:04:36 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2017-12-27 17:04:36 +0000
commit4cbe1cb5b962ca12c572ca6a88efd5215a13e6f5 (patch)
tree982d2d8c13f2455948dce84d2fc638af276228ae /app/cwm/xevents.c
parent883849afd019656f3cd9202554b6af54ea5fecdb (diff)
Use poll and XNextEvent to replace XNextEvent blocking inside the x11 event
handler.
Diffstat (limited to 'app/cwm/xevents.c')
-rw-r--r--app/cwm/xevents.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/app/cwm/xevents.c b/app/cwm/xevents.c
index f2430aafb..71411f883 100644
--- a/app/cwm/xevents.c
+++ b/app/cwm/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);
+ }
}