Skip to content

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

Description

@SDLBugzilla

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 http://hg.libsdl.org/SDL/rev/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.

Thanks,
Kevin

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:

https://hg.libsdl.org/SDL/rev/e55dad50b3ae
Author: Sam Lantinga slouken@libsdl.org
Date: Thu May 28 09:52:48 2015 -0700

  Fixed X11 build, added code to print initial modifiers to checkkeys

https://hg.libsdl.org/SDL/rev/7099e2df7b29
Author: Sam Lantinga slouken@libsdl.org
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    abandonedBug has been abandoned for various reasons

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions