libsdl-org / libsdl-org/SDL

When SDL_HINT_FORCE_RAISEWINDOW is set to "1", SDL does not generate any SDL_EVENT_WINDOW_FOCUS_GAINED events.

Open
#13,232 4 comments 1 reaction 1 assignee View on GitHub

@Kontrabant is already working on this.

Since Aug 27, 2025.

Dominant language
C
Stars
16.6k
Forks
3k
Avg merge
12h 38m
Merged PRs (30d)
64

Description

Description:
When SDL_HINT_FORCE_RAISEWINDOW is set to "1" before initializing SDL’s video subsystem and a window is created in a hidden state, calling the standard Show → Restore → Raise sequence does not trigger a focus-gained event. As a result, text input is never started: only SDL_KEYDOWN/SDL_KEYUP events arrive, but no SDL_EVENT_TEXT_INPUT, which makes any text field unusable.

Steps to Reproduce:
1. Set SDL_HINT_FORCE_RAISEWINDOW = "1" before calling SDL_InitSubSystem.
2. Create a window with the hidden flag.
3. Show, restore, and raise the window.
4. Attach an input widget that listens for SDL_EVENT_WINDOW_FOCUS_GAINED and SDL_EVENT_TEXT_INPUT.

Actual Behavior:
• No SDL_EVENT_WINDOW_FOCUS_GAINED is emitted.
• Only key-down and key-up events are delivered.
• SDL_EVENT_TEXT_INPUT never fires, so text cannot be entered.

Expected Behavior:
• Raising the window should generate a SDL_EVENT_WINDOW_FOCUS_GAINED.
• SDL should begin text input, emitting SDL_EVENT_TEXT_INPUT for character input.

Impact:
Without the focus-gained event, text fields never receive character data, blocking all keyboard text entry in applications that rely on SDL’s text-input events.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.