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
|
Description: SDL_x11events.c: properly handle input focus events
The Xorg xserver changed to send focus events on grab changes in [1]. This
patch backports upstream changes [2] and [3] from libsdl2 to libsdl1.2 to
properly handle (ignore) those events. Without this patch the focus events
will interfere with keyboard handling and cause e.g. sudden stop in games
while the forward key is still being pressed.
.
[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
Author: Maximilian Engelhardt <maxi@daemonizer.de>
Bug: https://bugzilla.libsdl.org/show_bug.cgi?id=5426
Bug-Debian: https://bugs.debian.org/980253
Applied-Upstream: https://hg.libsdl.org/SDL/rev/336bcaa9432c
--- a/src/video/x11/SDL_x11events.c
+++ b/src/video/x11/SDL_x11events.c
@@ -457,6 +457,13 @@
/* 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
@@ -475,6 +482,13 @@
/* 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
|