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
This commit is contained in:
Pablo Correa Gómez 2024-10-02 12:52:33 +02:00 committed by omni
parent 2442a08780
commit 78fd84c0b5
2 changed files with 82 additions and 1 deletions

View file

@ -3,7 +3,7 @@
# Maintainer: team/gnome <newbyte@postmarketos.org>
pkgname=gtk+3.0
pkgver=3.24.43
pkgrel=0
pkgrel=1
pkgdesc="The GTK+ Toolkit (v3)"
url="https://www.gtk.org/"
install="$pkgname.post-deinstall"
@ -64,6 +64,7 @@ checkdepends="
"
source="https://download.gnome.org/sources/gtk+/${pkgver%.*}/gtk+-$pkgver.tar.xz
5628.patch
events-Compress-touch-update-events.patch
"
builddir="$srcdir/gtk+-$pkgver"
@ -134,4 +135,5 @@ icon_cache() {
sha512sums="
2f208a353d94fa504088ab080006cb097de721ec934b69b5719af0f4c8c72d2aa9a68b47239feca1622ec67c7389be87023729ee6ad3580a87777f2bf9ed5375 gtk+-3.24.43.tar.xz
b592559177c60e627940b8894aace41b058fe738d47ebb8bccdb4c9c35dd1750e1db7e153a6e5db61d2d4e95ddefd712fd734a1bbc4230a79c889f8adac96e1f 5628.patch
74e38bbdf8d8f84bd07c10b1d879d2ef5cc80ffcfc6bcbc3d916c4c4e9a10686e20c77bed4abb56d1eed463c644873ddd2500ef3028beb7db3b10cba3a658909 events-Compress-touch-update-events.patch
"

View file

@ -0,0 +1,79 @@
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
+}