| Summary: | [PATCH] Duplicate SDL_KEYDOWN when the window state changes | ||
|---|---|---|---|
| Product: | SDL | Reporter: | bastien.bouclet |
| Component: | events | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | drmccoy, icculus, ori |
| Version: | HG 2.1 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: | Possible fix | ||
This patch looks reasonable to me; I wonder if we refactored this to make the higher level keypress handler deal with repeat keys at some point, and ReconcileKeyboardState was still assuming the higher level would throw the existing presses away. --ryan. (In reply to Ryan C. Gordon from comment #1) > This patch looks reasonable to me; I wonder if we refactored this to make > the higher level keypress handler deal with repeat keys at some point, and > ReconcileKeyboardState was still assuming the higher level would throw the > existing presses away. If this was the culprit, this has been broken since SDL 1.3. :( https://hg.libsdl.org/SDL/rev/e2d46c5c7483 --ryan. This patch is now https://hg.libsdl.org/SDL/rev/1f2cb42aa5d3, thanks! --ryan. |
Created attachment 2725 [details] Possible fix SDL sends duplicate SDL_KEYDOWN events with 'repeat = true' when the window gets focus. This is caused by X11_ReconcileKeyboardState calling SDL_SendKeyboardKey even for keys which are already known to be pressed by SDL, and for which the application has already been notified. In the case of our application toggling fullscreen is triggered by the 'alt+return' shortcut. SDL sends two SDL_KEYDOWN events causing the application to go fullscreen and immediatly back to windowed mode. The attached patch contains a possible fix.