Skip to content
Permalink
Browse files
SDL_x11events.c: properly handle input focus events (fix bug #5426)
From maxi@daemonizer.de:

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
  • Loading branch information
sezero committed Dec 30, 2020
1 parent f3bc60c commit 74c08c5027621ce0322c1e2825211fb787a1fe4d
Showing with 18 additions and 0 deletions.
  1. +1 −0 WhatsNew
  2. +3 −0 docs.html
  3. +14 −0 src/video/x11/SDL_x11events.c
@@ -52,6 +52,7 @@ Changes include:
- X11video: fix SDL_VIDEORESIZE events not received when resizing
window from the corner (inverted logic in X11 ConfigureNotify, i.e.
resize handling - bug 1430.)
- X11video: properly handle input focus events (bug 5426.)
- X11video: unblock SDL_WM_GrabInput() GrabNotViewable case (bug 1155.)
- Mac OS X: fix macOS 10.14 (Mojave) opengl issues (bug 4788.)
- Mac OS X: fix crash on any input in Quartz code (bug 2560.)
@@ -120,6 +120,9 @@ <H2> SDL 1.2.16 Release Notes </H2>
window from the corner (inverted logic in X11 ConfigureNotify, i.e.
resize handling - bug <a href="https://bugzilla.libsdl.org/show_bug.cgi?id=1430">1430</a>.)
</P>
<P>
X11video: properly handle input focus events (bug <a href="https://bugzilla.libsdl.org/show_bug.cgi?id=5426">5426</a>.)
</P>
<P>
X11video: unblock SDL_WM_GrabInput() GrabNotViewable case (bug <a href="https://bugzilla.libsdl.org/show_bug.cgi?id=1155">1155</a>.)
</P>
@@ -485,6 +485,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
@@ -503,6 +510,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

0 comments on commit 74c08c5

Please sign in to comment.