[clutter/clutter-1.10] x11/xi2: Do not generate scroll events on ButtonRelease



commit 60330a80b9563ee32f514b9bf60bcdeff36e0658
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Jul 17 10:13:12 2012 -0400

    x11/xi2: Do not generate scroll events on ButtonRelease
    
    Scroll events are generated on ButtonPress only in the core event
    handling, so it should happen the same if we use XInput.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=680088
    (cherry picked from commit 2a31a93c5e63f3a6e3e4a82622e5fbab0e25e5f1)
    
    Signed-off-by: Emmanuele Bassi <ebassi gnome org>

 clutter/x11/clutter-device-manager-xi2.c |   44 +++++++++++++++++++++--------
 1 files changed, 32 insertions(+), 12 deletions(-)
---
diff --git a/clutter/x11/clutter-device-manager-xi2.c b/clutter/x11/clutter-device-manager-xi2.c
index 3356bd1..7dd3021 100644
--- a/clutter/x11/clutter-device-manager-xi2.c
+++ b/clutter/x11/clutter-device-manager-xi2.c
@@ -834,6 +834,10 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
           case 5:
           case 6:
           case 7:
+            /* we only generate Scroll events on ButtonPress */
+            if (xi_event->evtype == XI_ButtonRelease)
+              return CLUTTER_TRANSLATE_REMOVE;
+
             event->scroll.type = event->type = CLUTTER_SCROLL;
 
             if (xev->detail == 4)
@@ -872,6 +876,21 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
             if (xev->flags & XIPointerEmulated)
               _clutter_event_set_pointer_emulated (event, TRUE);
 #endif /* HAVE_XINPUT_2_2 */
+
+            CLUTTER_NOTE (EVENT,
+                          "scroll: win:0x%x, device:%s, time:%d "
+                          "(direction:%s, "
+                          "x:%.2f, y:%.2f)",
+                          (unsigned int) stage_x11->xwin,
+                          device->device_name,
+                          event->any.time,
+                          event->scroll.direction == CLUTTER_SCROLL_UP ? "up" :
+                          event->scroll.direction == CLUTTER_SCROLL_DOWN ? "down" :
+                          event->scroll.direction == CLUTTER_SCROLL_LEFT ? "left" :
+                          event->scroll.direction == CLUTTER_SCROLL_RIGHT ? "right" :
+                          "invalid",
+                          event->scroll.x,
+                          event->scroll.y);
             break;
 
           default:
@@ -902,24 +921,25 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
                                                  event->button.y,
                                                  stage_x11,
                                                  &xev->valuators);
+
+            CLUTTER_NOTE (EVENT,
+                          "%s: win:0x%x, device:%s, time:%d (button:%d, x:%.2f, y:%.2f, axes:%s)",
+                          event->any.type == CLUTTER_BUTTON_PRESS
+                            ? "button press  "
+                            : "button release",
+                          (unsigned int) stage_x11->xwin,
+                          device->device_name,
+                          event->any.time,
+                          event->button.button,
+                          event->button.x,
+                          event->button.y,
+                          event->button.axes != NULL ? "yes" : "no");
             break;
           }
 
         if (source_device != NULL && device->stage != NULL)
           _clutter_input_device_set_stage (source_device, device->stage);
 
-        CLUTTER_NOTE (EVENT,
-                      "%s: win:0x%x, device:%s (button:%d, x:%.2f, y:%.2f, axes:%s)",
-                      event->any.type == CLUTTER_BUTTON_PRESS
-                        ? "button press  "
-                        : "button release",
-                      (unsigned int) stage_x11->xwin,
-                      event->button.device->device_name,
-                      event->button.button,
-                      event->button.x,
-                      event->button.y,
-                      event->button.axes != NULL ? "yes" : "no");
-
 #ifdef HAVE_XINPUT_2_2
         if (xev->flags & XIPointerEmulated)
           _clutter_event_set_pointer_emulated (event, TRUE);



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