X Tutup
Skip to content

[Fix] [SDL] Reset keyboard state on focus loss to avoid stuck keys#2900

Draft
RDeckard wants to merge 1 commit intonesbox:mainfrom
RDeckard:fix/2614-sdl-focus-loss-key-reset
Draft

[Fix] [SDL] Reset keyboard state on focus loss to avoid stuck keys#2900
RDeckard wants to merge 1 commit intonesbox:mainfrom
RDeckard:fix/2614-sdl-focus-loss-key-reset

Conversation

@RDeckard
Copy link

@RDeckard RDeckard commented Mar 3, 2026

Why

Original issue: #2614

Keys can remain logically pressed if SDL_KEYUP is missed during window focus/grab transitions.

What

  • Add resetKeyboardStateOnFocusLoss() in src/system/sdl/main.c.
  • Clear keyboard and SDL modifier state on SDL_WINDOWEVENT_FOCUS_LOST.
  • Keep existing Linux focus-gain input lock behavior unchanged.

Impact

  • Prevents stuck keys after losing window focus.
  • No change to normal in-focus input handling.

Reviewer question: should the reset stay limited to FOCUS_LOST, or also trigger on other window events (e.g. move/resize)?

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

X Tutup