Skip to content

Add keyChar() event; modifier support for FileDropEvent#2388

Merged
andrewfb merged 5 commits into
cinder:masterfrom
andrewfb:keyChar
Dec 8, 2025
Merged

Add keyChar() event; modifier support for FileDropEvent#2388
andrewfb merged 5 commits into
cinder:masterfrom
andrewfb:keyChar

Conversation

@andrewfb

@andrewfb andrewfb commented Dec 4, 2025

Copy link
Copy Markdown
Collaborator

Summary

  • Add keyChar() App-level virtual method and getSignalKeyChar() for text input handling
    • Properly handles dead keys and composed characters (e.g., ' + e = é)
  • Adds modifier key support to FileDropEvent (Shift, Ctrl, Alt, Meta) on macOS and Windows
    • Platform limitations prevent this on Linux, at least without X11 and Wayland-specific code
  • Update ImGui integration to use keyChar for text input

When to use keyChar() vs keyDown()/keyUp()

Use keyChar() for text entry - when you need the actual character the user intended to type. Handles dead keys, IME, AltGr combinations, and non-English layouts correctly.

Use keyDown()/keyUp() for controls and shortcuts - when you need to detect physical key presses regardless of text output (e.g., WASD movement, hotkeys, game controls).

Related Issues

Introduces a separate keyChar() callback and signal for character input,
distinct from keyDown/keyUp. This properly handles IME, dead keys, and
composed characters (e.g., ' + e = é).

- Add virtual keyChar() to AppBase
- Add getSignalKeyChar() and emitKeyChar() to Window
- Implement GLFW character callback with per-window key data storage
- Implement Windows WM_CHAR handling with WM_DEADCHAR filtering
- Update CinderImGui to use keyChar for text input with UTF-16 surrogate support
Allows detecting Shift, Ctrl, Alt, and Meta keys during file drops.
Backwards-compatible API with default parameter.

- Add modifier accessors to FileDropEvent (isShiftDown, isAltDown, etc.)
- Pass modifiers from GLFW and Windows implementations
- Enable keyChar signal connection and handler
- Display modifier keys on file drop events
@andrewfb andrewfb merged commit 60758b9 into cinder:master Dec 8, 2025
8 checks passed
@totalgee

totalgee commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

This is great -- thank you!

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.

Text input does not support modifier keys other than Alt,Ctrl,Shift,Meta on linux. ImGui does not support non-English keyboard layouts (e.g. Spanish)

2 participants