]> git.sur5r.net Git - i3/i3/commitdiff
i3bar: handle clicks with negative coordinates (Thanks Julian)
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 10 Jun 2012 19:04:51 +0000 (21:04 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 10 Jun 2012 19:04:51 +0000 (21:04 +0200)
This can happen if you move your mouse pointer to the very left of the
screen and then click. For better usability, we handle this edge case
like a click on pixel 0.

i3bar/src/xcb.c

index 205c08cca342691de8fdaea0280166d4f382d57c..b9304798410522e169f86cd7e671c528a716f3d2 100644 (file)
@@ -281,7 +281,7 @@ void handle_button(xcb_button_press_event_t *event) {
         return;
     }
 
-    int32_t x = event->event_x;
+    int32_t x = event->event_x >= 0 ? event->event_x : 0;
 
     DLOG("Got Button %d\n", event->detail);