[gtk+] xi2: Ignore button release events of button 4-7



commit 7aeb3c725b7638a92ef0e7aa5c06f8cdee1bbb39
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Sat Mar 5 12:13:19 2011 +0100

    xi2: Ignore button release events of button 4-7
    
    We treat button presses of button 4-7 as scroll wheel events, so release
    events should be ignored.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=643925

 gdk/x11/gdkdevicemanager-xi2.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index 7c93bbb..e84c1e3 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -1104,6 +1104,12 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
                 event->scroll.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
                 break;
               }
+            /* Button presses of button 4-7 are scroll events, so ignore the release */
+            else if (ev->evtype == XI_ButtonRelease)
+              {
+                return_val = FALSE;
+                break;
+              }
             /* else (XI_ButtonRelease) fall thru */
           default:
             event->button.type = (ev->evtype == XI_ButtonPress) ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE;
@@ -1141,6 +1147,9 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
             event->button.button = xev->detail;
           }
 
+        if (return_val == FALSE)
+          break;
+
         if (!set_screen_from_root (display, event, xev->root))
           {
             return_val = FALSE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]