phosh-arch/gtk3-mobile/events-Compress-touch-update-events.patch
2024-08-13 08:17:11 -07:00

67 lines
2.3 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
---
gdk/gdkevents.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 087178e..40ef45d 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -268,30 +268,36 @@ _gdk_event_queue_handle_motion_compression (GdkDisplay *display)
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;