gdk/x11: Reset all scroll valuators on enter
authorCarlos Garnacho <carlosg@gnome.org>
Sat, 4 Feb 2023 12:10:42 +0000 (13:10 +0100)
committerSimon McVittie <smcv@debian.org>
Sat, 9 Sep 2023 19:32:02 +0000 (20:32 +0100)
We no longer need to make much distinction between multiple logical
devices, plus it breaks esp. with the Xwayland input device distribution.
Just iterate across all devices and reset their scroll valuators.

(cherry picked from commit 824e983372d939693f7eba5c394e647a9035a0f8)

Origin: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5479
Bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/4160
Bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/5202
Bug-Debian: https://bugs.debian.org/1029972
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gtk4/+bug/1993594
Applied-upstream: 4.9.3, commit:824e983372d939693f7eba5c394e647a9035a0f8
Applied-upstream: 4.8.4, commit:37843ec941f611a6c9e05732442c86e99016d5f0

Gbp-Pq: Name gdk-x11-Reset-all-scroll-valuators-on-enter.patch

gdk/x11/gdkdevicemanager-xi2.c

index 02ceb2f110a5824b285f8492bf38c5a42d8b3cdf..dd3f86c03eea169074e009c577f2a76663a08fce 100644 (file)
@@ -2064,19 +2064,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
             xev->detail != XINotifyInferior && xev->mode != XINotifyPassiveUngrab &&
             GDK_IS_TOPLEVEL (surface))
           {
-            if (gdk_x11_device_xi2_get_device_type ((GdkX11DeviceXI2 *) device) != GDK_X11_DEVICE_TYPE_LOGICAL)
-              _gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (source_device));
-            else
-              {
-                GList *physical_devices, *l;
-
-                physical_devices = gdk_device_list_physical_devices (source_device);
+            GList *l;
 
-                for (l = physical_devices; l; l = l->next)
-                  _gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (l->data));
-
-                g_list_free (physical_devices);
-              }
+            for (l = device_manager->devices; l; l = l->next)
+              _gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (l->data));
           }
 
         event = gdk_crossing_event_new (ev->evtype == XI_Enter