Debian Codegraph @

debian/patches/74-3-events.diff

raw
1 --- a/src/gui/sdlmain.cpp
2 +++ b/src/gui/sdlmain.cpp
3 @@ -1465,11 +1465,19 @@
4 #if SDL_XORG_FIX
5 // Special code for broken SDL with Xorg 1.20.1, where pairs of inputfocus gain and loss events are generated
6 // when locking the mouse in windowed mode.
7 + // This also seems to give wrong key up events in fullscreen mode.
8 + // sdl-1.2 has a fix in hg, but this shouldn't interfere with that fix.
9 if (event.type == SDL_ACTIVEEVENT && event.active.state == SDL_APPINPUTFOCUS && event.active.gain == 0) {
10 SDL_Event test; //Check if the next event would undo this one.
11 if (SDL_PeepEvents(&test,1,SDL_PEEKEVENT,SDL_ACTIVEEVENTMASK) == 1 && test.active.state == SDL_APPINPUTFOCUS && test.active.gain == 1) {
12 // Skip both events.
13 SDL_PeepEvents(&test,1,SDL_GETEVENT,SDL_ACTIVEEVENTMASK);
14 + // Look for KEY UP events and check their validity.
15 + while(SDL_PeepEvents(&test,1,SDL_PEEKEVENT,SDL_KEYUPMASK) == 1) {
16 + const Uint8* kstate = SDL_GetKeyState(NULL);
17 + if ( kstate[test.key.keysym.sym] != SDL_PRESSED) break;
18 + SDL_PeepEvents(&test,1,SDL_GETEVENT,SDL_KEYUPMASK);
19 + }
20 continue;
21 }
22 }