Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH] Duplicate SDL_KEYDOWN when the window state changes #2443

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

[PATCH] Duplicate SDL_KEYDOWN when the window state changes #2443

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.1
Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2017-04-22 17:58:49 +0000, wrote:

Created attachment 2725
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.

On 2017-05-29 21:13:00 +0000, Ryan C. Gordon wrote:

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.

On 2017-05-29 22:29:37 +0000, Ryan C. Gordon wrote:

(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.

On 2017-05-29 22:32:16 +0000, Ryan C. Gordon wrote:

This patch is now https://hg.libsdl.org/SDL/rev/1f2cb42aa5d3, thanks!

--ryan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant