aports/main/gtk+3.0/events-Compress-touch-update-events.patch
Pablo Correa Gómez 78fd84c0b5 main/gtk+3.0: add patch to fix touch on slow devices
We've run this on laptops in postmarketOS for a very long while,
without remarkable issues. This greatly helps in performance with slow
devices (e.g: SoCs and phones), and wont get accepted upstream due to
it being in feature freeze, and requiring more extensive changes to
input to not be "just a hack". This seems, however, a sensible patch
downstream for an old version of the project
2024-10-02 18:57:34 +00:00

79 lines
2.7 KiB
Diff

From: Alexander Mikhaylenko <alexm@gnome.org>
Date: Thu, 3 Dec 2020 14:42:23 +0500
Subject: events: Compress touch update events
GTK3 often moves child windows around in response to touch gestures, such
as scrolling or swipes. This leads to a problem when a frame has multiple
events whose coordinates are relative to the window: the first event moves
the window, then the second event has wrong coordinates. This leads to a
severe jumping when scrolling or swiping when the system slows down.
GTK4 fixes this by getting rid of child windows completely, but for GTK3
we have to work around this by compressing touch update events. This isn't
really suitable for upstream, but wouldn't be the worst patch we have
downstream.
See https://source.puri.sm/Librem5/debs/gtk/-/issues/8
---
Pablo Correa Gomez comment: we've run this on laptops in postmarketOS for
a very long while, without remarkable issues. This greatly helps in performance
with slow devices (e.g: SoCs and phones), and wont get accepted upstream
due to it being in feature freeze, and requiring more extensive changes to
input to not be "just a hack". This seems, however, a sensible patch downstream
for an old version of the project
gdk/gdkevents.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -268,30 +268,36 @@
while (tmp_list)
{
GdkEventPrivate *event = tmp_list->data;
+ GdkWindow *window;
+ GdkDevice *device;
if (event->flags & GDK_EVENT_PENDING)
break;
- if (event->event.type != GDK_MOTION_NOTIFY)
+ if (event->event.type != GDK_MOTION_NOTIFY &&
+ event->event.type != GDK_TOUCH_UPDATE)
break;
+ window = gdk_event_get_window (&event->event);
+ device = gdk_event_get_device (&event->event);
+
if (pending_motion_window != NULL &&
- pending_motion_window != event->event.motion.window)
+ pending_motion_window != window)
break;
if (pending_motion_device != NULL &&
- pending_motion_device != event->event.motion.device)
+ pending_motion_device != device)
break;
- pending_motion_window = event->event.motion.window;
+ pending_motion_window = window;
- if (!event->event.motion.window->event_compression)
+ if (!window->event_compression)
{
uncompressed_motion = TRUE;
break;
}
- pending_motion_device = event->event.motion.device;
+ pending_motion_device = device;
pending_motions = tmp_list;
tmp_list = tmp_list->prev;
@@ -2578,4 +2584,4 @@
private = (GdkEventPrivate *) event;
return private->key_scancode;
-}
\ No newline at end of file
+}