qemu-devel
[Top][All Lists]
Advanced

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

[PATCH qemu] ui/gtk: Reuse input event slots for GdkEventTouch


From: ~katharine_chui
Subject: [PATCH qemu] ui/gtk: Reuse input event slots for GdkEventTouch
Date: Sat, 20 Jul 2024 20:14:20 +0200

From: Katharine Chui <kwchuiaa@connect.ust.hk>

There seems to be no guarantee as to how GdkEventTouch.sequence
would progress https://docs.gtk.org/gdk3/struct.EventTouch.html

In the case of steam gamescope session, touch input would
increment the number every touch, resulting in all touch inputs
after the 10th touch to get dropped

...
qemu: warning: Unexpected touch slot number:  10 >= 10
qemu: warning: Unexpected touch slot number:  11 >= 10
qemu: warning: Unexpected touch slot number:  12 >= 10
qemu: warning: Unexpected touch slot number:  13 >= 10
qemu: warning: Unexpected touch slot number:  14 >= 10
...

Reuse the slots on gtk to avoid that

Signed-off-by: Katharine Chui <kwchuiaa@connect.ust.hk>
---
 ui/gtk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index bc29f7a1b4..b123c9616d 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1090,7 +1090,7 @@ static gboolean gd_touch_event(GtkWidget *widget, 
GdkEventTouch *touch,
                                void *opaque)
 {
     VirtualConsole *vc = opaque;
-    uint64_t num_slot = GPOINTER_TO_UINT(touch->sequence);
+    uint64_t num_slot = GPOINTER_TO_UINT(touch->sequence) % 
INPUT_EVENT_SLOTS_MAX;
     int type = -1;
 
     switch (touch->type) {
-- 
2.43.4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]