Private
eventThe list of key down/up events that haven't been dispatched yet.
Private
focusThe currently focused root. New keyboard events will go to this root
Private
keysA set containing the keys currently down.
Private
lastThe last Root that had "activity"; the last Root where any focus was grabbed. Used as a fallback when there is no focus. If this is null, then a root from eventQueues is picked; this fallback of a fallback may result in weird behaviour if there are more than 1 Roots, since eventQueues is a Map, and Map iteration is not guaranteed to be in the same order
Check if the currently focused root needs keyboard input. Virtual keyboard should query this property to know when to show themselves.
Protected
changeChanges the current root focus.
If there was a previous root focus, that root's clearFocus is called with Keyboard.
keysDown is cleared.
Clear the current root focus. Calls changeFocusedRoot with null.
Similar to getFocusedRoot, but can fall back to lastActivity if focus is null, or a Root in eventQueues if lastActivity is also null.
Private
getGet the event queue of a given root. If this driver is not registered to the given root or the given root is disabled, making it not present in eventQueues, then null is returned.
Must follow the KeyboardEvent.key Web API.
Push a new KeyPress event to eventQueues.
Must follow the KeyboardEvent.key Web API.
Is shift being pressed?
Is control being pressed?
Is alt being pressed?
Calls keyDown followed by keyUp. If the key was already down before calling (isKeyDown), keyUp is not called.
Must follow the KeyboardEvent.key Web API.
Is shift being pressed?
Is control being pressed?
Is alt being pressed?
Push a new KeyRelease event to eventQueues.
Must follow the KeyboardEvent.key Web API.
Is shift being pressed?
Is control being pressed?
Is alt being pressed?
Removes disabled root from eventQueues. If the root was the focus, then the focus is cleared.
Adds enabled root to eventQueues.
Does nothing if the new focus type is not a Keyboard. If the focus comes from a root which is not the root focus, then the root focus is changed to the new root. If there is no new focused widget (the root's keyboard focus was cleared), then nothing happens.
This behaviour is confusing, however, it's required so that the keyboard focus "lingers" for future tab key presses; this way, pressing tab can do tab selection even when there is no widget that wants keyboard input. When a focus is lingering, then it means that key events are still being dispatched to the last focused root, but they don't have a target. This way, most events get dropped, but tab key events are used for tab selection.
Dispatches all queued events for the root and clears its event queue
Generated using TypeDoc
A generic keyboard driver.
Does nothing on its own, but provides an API for sending keyboard events to registered roots.