Skip to content

Text box: keys to the focused gadget, then SDL_TEXTINPUT for every layout #21

Description

@CubeB

UiTextBox turns key presses into characters through a hand-written US layout table, so a player on another keyboard layout gets the wrong characters in a save-game name.

SDL's SDL_EVENT_TEXT_INPUT gives composed text for any layout, but a panel broadcasts key events to every child, so text input would reach every text box at once. Two steps:

  1. Key events go to the panel's focused gadget only. The original keeps a focused-gadget index at panel+0x64 (§99).
  2. The text box takes SDL_EVENT_TEXT_INPUT and the layout table goes.

Where to look: src/rwe/ui/UiPanel.*, src/rwe/ui/UiTextBox.*, the event dispatch in SceneManager::execute, and src/rwe/ui/UiTextBox.test.cpp.

Watch for: the two subscription-lifetime hazards in CLAUDE.md; both have crashed the game before.

Done when: a save name typed on a non-US layout comes out as typed, with tests for the focus routing.


One item, one PR. Opened from the unchecked Phase 1 list in docs/ROADMAP.md; the findings it cites are in docs/TOTALA-EXE.md.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    accessibilityBarrier affecting people with disabilitiesuiIn-game interface

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions