[gtk+/gtk-3-8] gdk: be more selective resetting scroll events



commit 198ad4df90c40996565500cfe55c4955751591fb
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Nov 16 23:32:58 2013 +0100

    gdk: be more selective resetting scroll events
    
    It's been reported in several applications that scrolling feels jerky
    since commit cc7b3985b3e31.
    
    Investigation reported that the combination of passive 4-7 button grabs
    on the toplevel and the presence of native subwindows might trigger
    too often crossing events from the child window to the toplevel and
    back as scroll "buttons" trigger the passive grab. Those crossing events
    would reset the scroll valuators rendering scrolling from jerky on
    touchpads (where there's intermediate smooth events between the emulated
    button ones) to ineffective on regular mouse wheels (where the crossing
    event would reset the valuators right before the single smooth scroll
    event we get is delivered)
    
    So, only reset scroll valuators when the pointer enters the toplevel
    (we only care about this when the pointer is on the window after it's
    been possibly scrolling somewhere else), and it doesn't come from an
    inferior.
    
    The situations where this happened varied though, the native subwindow
    could be one created explicitly by the application, or created indirectly
    through gdk_window_ensure_native(). The latter was mainly the case for
    evolution (through gtk_selection_set_owner()) and any GtkScrolledWindow
    under the oxygen-gtk3 theme (through gdk_window_set_composited())
    
    https://bugzilla.gnome.org/show_bug.cgi?id=699574

 gdk/x11/gdkdevicemanager-xi2.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index 0bbf523..6062f6a 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -1558,18 +1558,22 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
                                              GUINT_TO_POINTER (xev->sourceid));
         gdk_event_set_source_device (event, source_device);
 
-       if (gdk_device_get_device_type (source_device) != GDK_DEVICE_TYPE_MASTER)
-          _gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (source_device));
-        else
+        if (ev->evtype == XI_Enter && xev->detail != XINotifyInferior &&
+           gdk_window_get_window_type (window) == GDK_WINDOW_TOPLEVEL)
           {
-            GList *slaves, *l;
+            if (gdk_device_get_device_type (source_device) != GDK_DEVICE_TYPE_MASTER)
+              _gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (source_device));
+            else
+              {
+                GList *slaves, *l;
 
-            slaves = gdk_device_list_slave_devices (source_device);
+                slaves = gdk_device_list_slave_devices (source_device);
 
-            for (l = slaves; l; l = l->next)
-              _gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (l->data));
+                for (l = slaves; l; l = l->next)
+                  _gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (l->data));
 
-            g_list_free (slaves);
+                g_list_free (slaves);
+              }
           }
 
         event->crossing.mode = translate_crossing_mode (xev->mode);


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