Skip to content

Release held keys and modifiers when the window loses focus - #143

Open
Reveares wants to merge 2 commits into
Try:masterfrom
Reveares:fix/focus-release
Open

Reveares wants to merge 2 commits into
Try:masterfrom
Reveares:fix/focus-release

Conversation

@Reveares

@Reveares Reveares commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

EventDispatcher::dispatchFocus only moved the widget focus on a focus-out, so a key held across it never got its key-up, its next press arrived as a repeat, and a held modifier stayed set.
In OpenGothic a key held when the window loses focus stays pressed in the background, and goes on after coming back until the key is pressed again.

A focus-out now sends every widget that holds a key its key-up and clears the modifiers, as SDL and GLFW do. The second commit is for Windows, where a minimize was dispatched as a focus-in: WM_ACTIVATE carries the minimized flag in the high word of wParam.

Run on Linux and Windows. macOS and Android are only read. X11's grab focus-outs (NotifyGrab) release too, which SDL and GLFW skip.

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

Successfully merging this pull request may close these issues.

1 participant