src/video/x11/SDL_x11events.c
changeset 7749 6073ad385c9b
parent 7679 b1fe132bc6a4
child 7827 a03ec8de0426
--- a/src/video/x11/SDL_x11events.c	Fri Sep 27 23:29:05 2013 -0700
+++ b/src/video/x11/SDL_x11events.c	Fri Sep 27 23:35:17 2013 -0700
@@ -135,7 +135,9 @@
     XPointer arg)
 {
     XEvent *event = (XEvent *) arg;
+    /* we only handle buttons 4 and 5 - false positive avoidance */
     if (chkev->type == ButtonRelease &&
+        (event->xbutton.button == Button4 || event->xbutton.button == Button5) &&
         chkev->xbutton.button == event->xbutton.button &&
         chkev->xbutton.time == event->xbutton.time)
         return True;
@@ -150,7 +152,12 @@
            however, mouse wheel events trigger a button press and a button release
            immediately. thus, checking if the same button was released at the same
            time as it was pressed, should be an adequate hack to derive a mouse
-           wheel event. */
+           wheel event.
+           However, there is broken and unusual hardware out there...
+           - False positive: a button for which a release event is
+             generated (or synthesised) immediately.
+           - False negative: a wheel which, when rolled, doesn't have
+             a release event generated immediately. */
         if (XCheckIfEvent(display, &relevent, X11_IsWheelCheckIfEvent,
             (XPointer) event)) {