RMGui 0.15.0
C11 retained-mode UI library: layout kernel, style schema, widget painters, fonts, software framebuffer
Loading...
Searching...
No Matches
Input, editing and gestures

Route events

Send keys, committed text and composition to the focused element. Route captured pointer events to the capturing element until capture is cleared.

Event Payload
Pointer Primary button; mods holds SHIFT/CTRL/ALT/META. clicks == 0 means one press.
AUX / TOUCH Non-primary buttons / contacts with stable IDs.
KEY_CHAR Unicode scalar for shortcuts; never inserts text.
TEXT Commit UTF-8.
COMPOSITION Borrow preedit UTF-8 for one call. Cursor and selection are UTF-8 byte boundaries.
Optional rmgui_host_t service Host action
Clipboard Copy UTF-8 byte spans using caller storage.
Text-input rectangle Position IME candidates at the field caret.
Cursor Arbitrate requests: NONE keeps the current cursor, ARROW restores the default, TEXT denotes editable text.

Services are borrowed per field, not global. A missing service refuses the operation, not the event loop. See the input contract and host contract.

Edit a field

Input Effect
CTRL/META + A, C, X, V, Z, Y Select all, copy, cut, paste, undo, redo. SHIFT+Z also redoes. Call rmgui_field_command to invoke commands directly.
CTRL/ALT + arrows or BACKSPACE/DELETE Move or delete by word. SHIFT extends selection.
ALT + HOME/END Move to the newline-delimited paragraph edge. Plain HOME/END goes to the text edge.
Double / triple click Select the word run / newline-delimited paragraph. Shift-click or captured drag extends selection.
Preedit Underlined inline, clipped horizontally without rewrapping. TEXT commits; ESC or focus loss cancels.
Caller storage What happens
History Attach before binding. Adopt/bind clear it. Adjacent typing and same-direction deletions coalesce until another command or navigation; full rings replace the oldest edit. An oversize edit clears history but still applies. Editing after undo discards redo.
Clipboard scratch Invalid UTF-8 or a paste that does not fit is refused in full.
Preedit Persists between calls; separate from committed edits and their LAND/WIPE effects.

Word runs group ASCII letters, digits/underscore, Latin-1 and Latin Extended letters (except multiplication/division), whitespace and punctuation. Other scripts, including CJK, use single-codepoint words, not Unicode word breaks. See the field contract.

Recognize touch gestures

API or field Use
rmgui_gesture_init Provide caller-owned contact storage, pixel slops and millisecond thresholds.
rmgui_gesture_input Send TOUCH events with nondecreasing timestamps; pass NULL for long-press timer ticks.
Result Tap, double-tap, long-press, pan and pinch flags; signed Q16 position, translation, scale and clockwise turns.
Cancel / full storage Cancel drains remaining contacts without synthetic end gestures. Excess contacts refuse without mutation.

The integer recognizer agrees on native and wasm. Try the clipboard, IME and gesture controls on INPUT in the showcase. See the gesture contract.