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

In 2.0.4 Fullscreen/ShowWindow started causing repeat SDL_KEYDOWN on X11 #2125

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments


Copy link

@SDLBugzilla SDLBugzilla commented Feb 11, 2021

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

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

Comments on the original bug report:

On 2016-03-10 21:35:05 +0000, Kevin Locke wrote:

Created attachment 2391
Example program which causes the issue by pressing f

Starting in the 2.0.4 release, toggling fullscreen in response to an SDL_KEYDOWN event can cause a repeat SDL_KEYDOWN event to be fired immediately on X11 when the mouse cursor is not inside the (non-fullscreen) window.

I bisected the issue down to changeset 1021c9bd0f64 which introduced handling of the X11 KeymapNotify event. I presume a KeymapNotify is sent as part of the fullscreen+enter events which causes keydown to be emitted again immediately, but I am not familiar enough with the details to know for sure.

The attachment sdl-repeat-keydown-fullscreen.c demonstrates the issue on my system. On 2.0.4, when the window has focus and the user presses 'f' to toggle fullscreen, the window becomes fullscreen then a repeat SDL_KEYDOWN event is emitted, then the window becomes non-fullscreen again. On 2.0.3 and earlier pressing 'f' toggles fullscreen and no repeat SDL_KEYDOWN event is emitted leaving the window in fullscreen.

The attachment output-1021c9bd0f64.txt has the event output produced for changeset 1021c9bd0f64 and output-6ab4d6f34afb.txt for 6ab4d6f34afb (its parent).

An obvious workaround is to prevent repeat keypresses from toggling fullscreen, and I am making that change to my affected programs, but I assumed the behavior was unintentional and may be worth fixing to save other SDL developers the effort of tracking down this issue.


On 2016-03-10 21:35:46 +0000, Kevin Locke wrote:

Created attachment 2392
Example program output for changeset 6ab4d6f34afb

On 2016-03-10 21:36:06 +0000, Kevin Locke wrote:

Created attachment 2393
Example program output for changeset 1021c9bd0f64

On 2016-05-06 15:18:21 +0000, Cole Robinson wrote:

qemu is suffering from the same problem, and I can confirm that changeset 1021c9bd0f64 is the culprit for SDL_SetWindowFullscreen

qemu has another similar issue with repeat KEYDOWN events on ShowWindow. I bisected to just a few commits earlier:
Author: Sam Lantinga
Date: Thu May 28 09:52:48 2015 -0700

  Fixed X11 build, added code to print initial modifiers to checkkeys
Author: Sam Lantinga
Date: Thu May 28 09:33:47 2015 -0700

  Fixed bug 2736 - X11 doesn't set KMOD_NUM and KMOD_CAPS to system state

Since the commits overlap I assume it's the same root issue.

CCing Ryan C. Gordon who was commenting in the referenced bug # 2736

On 2016-09-21 10:57:24 +0000, Alex Smith wrote:

Also seeing this bug here on 2.0.4 and latest HG. Worked around by ignoring repeat keypresses for fullscreen toggling.

On 2016-10-01 19:50:39 +0000, Sam Lantinga wrote:

Hey Ryan, can you fix this for 2.0.5? This is a pretty critical regression.

On 2017-10-20 12:48:50 +0000, Cole Robinson wrote:

The fullscreen issue seems fixed with 2.0.6, at least the SDL2-2.0.6-2 version in Fedora 27. The similar ShowWindow issues I mentioned in Comment # 3 are still present though and are the more crippling problem for qemu's SDL usage...

On 2017-11-11 18:20:24 +0000, Andrey Alexeyev wrote:

This is still not fixed as of SDL 2.0.7 / 2.0.8dev.

On 2017-11-11 18:40:15 +0000, Andrey Alexeyev wrote:

Seems like user events, at least those generated when handling a legit SDL_KEYDOWN, are affected by this as well. I'll see if I can construct a test case later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant