summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dosbox/build/patches/dosbox_events.patch24
1 files changed, 24 insertions, 0 deletions
diff --git a/dosbox/build/patches/dosbox_events.patch b/dosbox/build/patches/dosbox_events.patch
new file mode 100644
index 00000000..499c435a
--- /dev/null
+++ b/dosbox/build/patches/dosbox_events.patch
@@ -0,0 +1,24 @@
+Index: src/gui/sdlmain.cpp
+===================================================================
+--- src/gui/sdlmain.cpp (revision 4299)
++++ src/gui/sdlmain.cpp (working copy)
+@@ -1465,11 +1465,19 @@
+ #if SDL_XORG_FIX
+ // Special code for broken SDL with Xorg 1.20.1, where pairs of inputfocus gain and loss events are generated
+ // when locking the mouse in windowed mode.
++ // This also seems to give wrong key up events in fullscreen mode.
++ // sdl-1.2 has a fix in hg, but this shouldn't interfere with that fix.
+ if (event.type == SDL_ACTIVEEVENT && event.active.state == SDL_APPINPUTFOCUS && event.active.gain == 0) {
+ SDL_Event test; //Check if the next event would undo this one.
+ if (SDL_PeepEvents(&test,1,SDL_PEEKEVENT,SDL_ACTIVEEVENTMASK) == 1 && test.active.state == SDL_APPINPUTFOCUS && test.active.gain == 1) {
+ // Skip both events.
+ SDL_PeepEvents(&test,1,SDL_GETEVENT,SDL_ACTIVEEVENTMASK);
++ // Look for KEY UP events and check their validity.
++ while(SDL_PeepEvents(&test,1,SDL_PEEKEVENT,SDL_KEYUPMASK) == 1) {
++ const Uint8* kstate = SDL_GetKeyState(NULL);
++ if ( kstate[test.key.keysym.sym] != SDL_PRESSED) break;
++ SDL_PeepEvents(&test,1,SDL_GETEVENT,SDL_KEYUPMASK);
++ }
+ continue;
+ }
+ }