Package limn.backend.spi
Interface WindowInput
- All Known Implementing Classes:
SceneDriver
public interface WindowInput
Receives a window's translated native input on the UI thread, in logical
points. The backend forwards events as they arrive during the native poll;
after each poll (and before draining
Ui.post tasks), it
calls inputBatchEnded(), which is where the scene dispatches its
(coalesced) queue. That yields the deterministic per-frame order: user
input → posted tasks → animation → layout → render.
Key codes and the modifier bitmask follow Keys
(GLFW-compatible values, but defined by the toolkit; no backend types leak).
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleancanEditFocused(EditCommand command) Whether an editing command can be done now by the widget that has the keyboard in this window.voidcharTyped(int codepoint) Committed text input, one code point (IME/layout-aware, after key events).default voiddragLeft()The drag the system drives left the window, or was called off over it.default @Nullable DropActiondragOver(Offer offer, Set<DropAction> allowed, float x, float y) A drag the system drives is over the window, or moved on it: one begun in another program, or one this window handed over withWindowPeer.startDrag(limn.backend.spi.DragRequest).default @Nullable DropActiondropped(Offer offer, Set<DropAction> allowed, float x, float y) What the system's drag carried is dropped on the window.default booleaneditFocused(EditCommand command) Does an editing command in the widget that has the keyboard in this window.default voidfilesDropped(List<Path> paths, float x, float y) Files dragged from the OS and dropped on the window, at a point of its content area in logical points: the widget under that point receives them.default voidEnd of one native poll: dispatch the accumulated batch now.default voidkeyEvent(int key, boolean pressed, boolean repeat, int modifiers) A key on a US layout, where the key printed on a keycap is the physical key's name: what a test drives.voidkeyEvent(int key, int layoutCodePoint, boolean pressed, boolean repeat, int modifiers) A key went down, repeated or came up.default voidmouseButton(int button, boolean pressed, int modifiers, float x, float y) A press or release the backend did not count:clickCount0.voidmouseButton(int button, boolean pressed, int modifiers, float x, float y, int clickCount) Button press/release at the given cursor position, with how many presses in a row this is, counted by the backend with the platform's own double-click interval and distance: 1 for a single press, 2 for the second of a double click.default voidmouseDelta(float dx, float dy) Relative pointer motion while the window is inPointerMode.RELATIVE: unbounded deltas in logical points (raw/unaccelerated where the platform supports it), replacingmouseMoved(float, float)for the duration of the capture.voidmouseMoved(float x, float y) voidpointerEntered(boolean entered) Cursor entered (true) or left the window's content area.default voidpreeditChanged(String text, int caret, int targetStart, int targetLength) In-progress IME composition ("preedit") for the focused text input: the still-composing text, its caret, and the stretch of it the input method is converting now (the target the user is choosing a candidate for), shown inline but not yet committed (the commit arrives later viacharTyped(int)).voidscrolled(float deltaX, float deltaY, float x, float y) Wheel/trackpad scroll; deltas in native notches (positive = up/left).default voidscrolled(float deltaX, float deltaY, float x, float y, boolean gestureBegins) A scroll the platform says begins a new gesture: the fingers came down on a trackpad or on a mouse whose surface scrolls, inertia from the gesture before still running or not.default voidThe bound window was destroyed.default voidwindowFocusChanged(boolean focused) The window gained or lost OS input focus.default voidwindowFullscreenChanged(boolean fullscreen) The window entered (true) or left fullscreen:NativeWindow.isFullscreen()changed its answer.voidwindowResized(float logicalWidth, float logicalHeight) Window content resized (logical points).default voidzoomed(float scale, float x, float y, boolean gestureBegins) A pinch on a trackpad: a request to zoom around the point by a factor.
-
Method Details
-
mouseMoved
void mouseMoved(float x, float y) -
mouseDelta
default void mouseDelta(float dx, float dy) Relative pointer motion while the window is inPointerMode.RELATIVE: unbounded deltas in logical points (raw/unaccelerated where the platform supports it), replacingmouseMoved(float, float)for the duration of the capture. The receiver may coalesce by summing. Default: ignored. -
mouseButton
void mouseButton(int button, boolean pressed, int modifiers, float x, float y, int clickCount) Button press/release at the given cursor position, with how many presses in a row this is, counted by the backend with the platform's own double-click interval and distance: 1 for a single press, 2 for the second of a double click.0means the backend does not count, and the receiver counts with its own clock. -
mouseButton
default void mouseButton(int button, boolean pressed, int modifiers, float x, float y) A press or release the backend did not count:clickCount0. -
scrolled
void scrolled(float deltaX, float deltaY, float x, float y) Wheel/trackpad scroll; deltas in native notches (positive = up/left). -
scrolled
default void scrolled(float deltaX, float deltaY, float x, float y, boolean gestureBegins) A scroll the platform says begins a new gesture: the fingers came down on a trackpad or on a mouse whose surface scrolls, inertia from the gesture before still running or not. A receiver keeps a gesture with the scroller it moved, and only the platform can say where one gesture ends and the next begins while inertia keeps the events coming; a backend that cannot say callsscrolled(float, float, float, float), and the receiver tells gestures apart by the pauses between them.- Parameters:
gestureBegins- whether this event is the first of a new gesture
-
zoomed
default void zoomed(float scale, float x, float y, boolean gestureBegins) A pinch on a trackpad: a request to zoom around the point by a factor. The backend turns its system's measure into the factor since its previous event: a magnification added to 1, or this event's scale since the gesture began over the previous one's. A system that sends the pinch as the wheel with Control held needs nothing here; the receiver offers that wheel as a zoom itself. A receiver that takes no zoom ignores it.- Parameters:
scale- what to multiply the present size by, positive: above 1 zooms ingestureBegins- whether this event is the first of a new pinch
-
keyEvent
void keyEvent(int key, int layoutCodePoint, boolean pressed, boolean repeat, int modifiers) A key went down, repeated or came up.- Parameters:
key- the physical key, aKeysconstantlayoutCodePoint- what the active layout types at that key with no modifier held, as a code point, or0for a key that types nothing; shortcuts are read from itpressed- a press or an auto-repeat rather than a releaserepeat- an auto-repeatmodifiers- theKeys.MOD_*bits held
-
keyEvent
default void keyEvent(int key, boolean pressed, boolean repeat, int modifiers) A key on a US layout, where the key printed on a keycap is the physical key's name: what a test drives. -
charTyped
void charTyped(int codepoint) Committed text input, one code point (IME/layout-aware, after key events). -
preeditChanged
In-progress IME composition ("preedit") for the focused text input: the still-composing text, its caret, and the stretch of it the input method is converting now (the target the user is choosing a candidate for), shown inline but not yet committed (the commit arrives later viacharTyped(int)). An emptytextclears the composition. Every index is in code points. Default: ignored.What it means, rather than one platform's shape of it: GLFW reports styled blocks and the focused one, SDL a string and a selection; a backend turns either into the target's start and length.
- Parameters:
text- the composing text (""clears it)caret- caret position withintexttargetStart- where the stretch being converted starts withintexttargetLength- how long it is;0when nothing is being converted
-
pointerEntered
void pointerEntered(boolean entered) Cursor entered (true) or left the window's content area. -
windowResized
void windowResized(float logicalWidth, float logicalHeight) Window content resized (logical points). May be coalesced by the receiver. -
dragOver
A drag the system drives is over the window, or moved on it: one begun in another program, or one this window handed over withWindowPeer.startDrag(limn.backend.spi.DragRequest). Answered at once, since the system waits for the answer to show whether a drop is possible there.- Parameters:
offer- what is dragged: its formats now, its values at the dropallowed- what the source allows with the modifier keys as they are held, the source's preference firstx- the pointer, in logical pointsy- the pointer, in logical points- Returns:
- the action a widget there would carry out, or null when none takes it
-
dragLeft
default void dragLeft()The drag the system drives left the window, or was called off over it. Default: ignored. -
dropped
What the system's drag carried is dropped on the window. The values ofoffercan be read now and for as long as the offer is kept.- Parameters:
offer- what was draggedallowed- what the source allows, as fordragOver(limn.transfer.Offer, java.util.Set<limn.transfer.DropAction>, float, float)x- the pointer, in logical pointsy- the pointer, in logical points- Returns:
- the action a widget carried out, or null when none took it
-
filesDropped
Files dragged from the OS and dropped on the window, at a point of its content area in logical points: the widget under that point receives them. The point is the platform's where it says one (SDL does), and the pointer's at the drop where it does not (GLFW). Default: ignored.- Parameters:
paths- the files, in the order the platform listed themx- where they were dropped, in logical pointsy- where they were dropped, in logical points
-
windowFocusChanged
default void windowFocusChanged(boolean focused) The window gained or lost OS input focus. On loss the scene cancels any in-flight press/drag/hover; the matching RELEASE will never arrive (it happens in another app), so it is synthesized. Default: ignored. -
windowFullscreenChanged
default void windowFullscreenChanged(boolean fullscreen) The window entered (true) or left fullscreen:NativeWindow.isFullscreen()changed its answer. Every change is told once, whoever made it: the application'senterFullscreenandexitFullscreen, and on macOS the person's green button, Control-Command-F or menu item. It is told when the answer changes, which for macOS native fullscreen is when the animation starts rather than when it ends. On the scene it closes a menu, a drop-down list or a calendar that is open in a window of its own, placed against the geometry the change is taking away, and moves a modal dialog's window into the scene.Told even while a modal blocks the window, as a focus change is: the dialog that blocks it is one of the surfaces that has to hear it. Arrives during the native poll, or from inside the call that changed fullscreen, and like the rest of the batch it is acted on when the batch ends. Default: ignored.
-
inputBatchEnded
default void inputBatchEnded()End of one native poll: dispatch the accumulated batch now. -
windowClosed
default void windowClosed()The bound window was destroyed. Lets the receiver flush any work that was waiting on a future frame which will now never come, chiefly a window-fade arrival callback (e.g. a dialog completing its result after fading out), since a destroyed window never ticks again. UI thread. -
canEditFocused
Whether an editing command can be done now by the widget that has the keyboard in this window. Asked for a row of a menu the system draws that is an editing command. -
editFocused
Does an editing command in the widget that has the keyboard in this window.- Returns:
- whether a widget did it
-