From 2635c87d160aa5f6f9e91e290678e99111788d57 Mon Sep 17 00:00:00 2001 From: Alex Goins Date: Thu, 18 Feb 2021 21:25:22 -0600 Subject: [PATCH] Fix collision between iterator and throw-away argument to XQueryPointer() Without this, Openbox is unstable on any setup with more than 2 X screens, as the collision can make the loop infinitely call XQueryPointer() on X screen 1. --- openbox/screen.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openbox/screen.c b/openbox/screen.c index e758ada1c..9bab3b209 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -1904,16 +1904,16 @@ guint screen_monitor_pointer() gboolean screen_pointer_pos(gint *x, gint *y) { Window w; - gint i; + gint i, scrnindex; guint u; gboolean ret; ret = !!XQueryPointer(obt_display, obt_root(ob_screen), &w, &w, x, y, &i, &i, &u); if (!ret) { - for (i = 0; i < ScreenCount(obt_display); ++i) - if (i != ob_screen) - if (XQueryPointer(obt_display, obt_root(i), + for (scrnindex = 0; scrnindex < ScreenCount(obt_display); ++scrnindex) + if (scrnindex != ob_screen) + if (XQueryPointer(obt_display, obt_root(scrnindex), &w, &w, x, y, &i, &i, &u)) break; }