TextInput
Clay backend implementation for system text input handling.
This class manages the platform-specific text input mechanisms, including:
- IME (Input Method Editor) support for complex scripts
- Virtual keyboard positioning on mobile platforms
- Hardware keyboard input processing
- Modifier key state tracking (Shift, Ctrl, Meta)
The implementation uses SDL's text input API on native platforms, which provides proper IME support and handles international text input correctly.
Instance Members
Starts text input mode.
This activates the system's text input mechanisms including:
- Virtual keyboard on mobile devices
- IME composition window positioning
- Text input event processing
The rectangle parameters help position IME windows and virtual keyboards near the text being edited.
Name | Type | Description |
---|---|---|
initialText |
String | Initial text content (currently unused) |
x |
Float | X position of the text input area |
y |
Float | Y position of the text input area |
w |
Float | Width of the text input area (minimum 1 pixel) |
h |
Float | Height of the text input area (minimum 1 pixel) |
Stops text input mode.
This deactivates text input, hiding virtual keyboards and closing any IME composition windows. The input area is reset to prevent any lingering visual artifacts.
Private Members
Whether text input mode is currently active
X position of the text input area (for IME positioning)
Y position of the text input area (for IME positioning)
Width of the text input area
Height of the text input area
Handles text input events from the system.
Processes Unicode text input, including composed characters from IME systems. Filters out spaces (handled separately) and forwards the text to the high-level text input system.
Name | Type | Description |
---|---|---|
text |
String | The input text (may be multiple characters for IME) |
Handles key press events for text editing.
Processes special keys like:
- Navigation (arrows, home, end)
- Editing (backspace, delete, enter)
- Modifiers (shift, ctrl, meta/cmd)
Regular character input is handled by handleTextInput instead.
Name | Type | Description |
---|---|---|
keyCode |
Int | Virtual key code |
scanCode |
Int | Physical key scan code |
Handles key release events.
Only tracks modifier key releases (Shift, Ctrl, Meta) as these affect text input behavior and selection. Regular keys are processed on key down only.
Name | Type | Description |
---|---|---|
keyCode |
Int | Virtual key code |
scanCode |
Int | Physical key scan code |