Package: libsdl1.2 / 1.2.15+dfsg2-8

properly_handle_focus_events.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From: Maximilian Engelhardt <maxi@daemonizer.de>
Date: Wed, 30 Dec 2020 23:00:02 +0300
Subject: SDL_x11events.c: properly handle input focus events (fix bug #5426)

Since some time I stated to observe an annoying bug with the forward
movement suddenly stopping while I was still pressing the corresponding
key for the forward movement. Releasing and pressing the key again
continued the movement. I observed this in the game "Unreal Tournament
2004", but other software is probably also affected. The stop basically
happens after a few minutues of pressing the key, though the time needed
to reproduce the issue is not constant.

While investigating the issue I found it started with a commit [1] in
the Xorg xserver. Digging deeper into the code I found two commits [2]
[3] in libsdl2 which looked like they would also fix the issue in
libsdl1.2. I backported these two commits to the libsdl1.2 in Debian
and can confirm that the bug got fixed by this.

[1] https://cgit.freedesktop.org/xorg/xserver/commit/?id=c67f2eac56518163981af59f5accb7c79bc00f6a
[2] https://hg.libsdl.org/SDL/rev/a1c4c17410e8
[3] https://hg.libsdl.org/SDL/rev/764129077d18

Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=5426
Bug: https://github.com/libsdl-org/SDL-1.2/issues/831
Bug-Debian: https://bugs.debian.org/980253
Applied-upstream: commit:https://hg.libsdl.org/SDL/rev/336bcaa9432c
Applied-upstream: commit:https://github.com/libsdl-org/SDL-1.2/commit/74c08c5027621ce0322c1e2825211fb787a1fe4d
---
 src/video/x11/SDL_x11events.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c
index 607cc07..86f6cee 100644
--- a/src/video/x11/SDL_x11events.c
+++ b/src/video/x11/SDL_x11events.c
@@ -463,6 +463,13 @@ printf("Mode: NotifyUngrab\n");
 
 	    /* Gaining input focus? */
 	    case FocusIn: {
+	    if (xevent.xfocus.mode == NotifyGrab || xevent.xfocus.mode == NotifyUngrab) {
+		/* Someone is handling a global hotkey, ignore it */
+#ifdef DEBUG_XEVENTS
+		printf("FocusIn (NotifyGrab/NotifyUngrab, ignoring)\n");
+#endif
+		break;
+	    }
 #ifdef DEBUG_XEVENTS
 printf("FocusIn!\n");
 #endif
@@ -481,6 +488,13 @@ printf("FocusIn!\n");
 
 	    /* Losing input focus? */
 	    case FocusOut: {
+	    if (xevent.xfocus.mode == NotifyGrab || xevent.xfocus.mode == NotifyUngrab) {
+		/* Someone is handling a global hotkey, ignore it */
+#ifdef DEBUG_XEVENTS
+		printf("FocusOut (NotifyGrab/NotifyUngrab, ignoring)\n");
+#endif
+		break;
+	    }
 #ifdef DEBUG_XEVENTS
 printf("FocusOut!\n");
 #endif