Interface WindowPeer
- All Superinterfaces:
AutoCloseable,NativeWindow
- All Known Implementing Classes:
HeadlessWindow,StubWindow
NativeWindow is one, so the toolkit reaches this with of(NativeWindow); a
backend implements it.
Incubating, as the rest of this package: it may change in a minor release.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumWhat a registered child window is, which decides whether a modal over the owner leaves it usable.Nested classes/interfaces inherited from interface limn.backend.NativeWindow
NativeWindow.ContentScaleListener -
Method Summary
Modifier and TypeMethodDescriptiondefault voiddragAnswerChanged(@Nullable DropAction action) The answer this window gave the drag the system drives over it changed while the pointer stood still: the content scrolled under the pointer, and another widget, or none, takes the drag there now.booleanisModal()static WindowPeerof(NativeWindow window) default voidSays this window's contents are published in another window's accessible tree: a popup the scene that opened it grafted into its own tree, as a native drop-down list is its field's child.default voidregisterChildPopup(NativeWindow child) Registers a child popup to be closed automatically when this window closes, so a combo/menu popup can never outlive its parent.voidregisterChildPopup(NativeWindow child, WindowPeer.PopupKind kind) Registers a child popup and says what it is; seeWindowPeer.PopupKind, which is the whole reason this overload exists.voidCancels any in-progress IME composition held by the platform for this window.voidsetFrameCallback(FrameCallback callback) Registers the per-frame render callback.voidsetInput(WindowInput input) Registers the input sink (usually the scene).voidsetPreeditCaretRect(float x, float y, float width, float height) Positions the IME candidate/composition window at the caret, so it follows the text being edited.voidsetTextInput(TextInput input) Says what text this window wants from the platform: none, typed characters with the input method off, or characters and the input method's composition.default booleanstartDrag(DragRequest request) Hands a drag to the system, while a mouse button is down in this window.booleanWhetherNativeWindow.screenX(),NativeWindow.screenY()andNativeWindow.setScreenPosition(int, int)actually work on this platform.default booleanvoidunregisterChildPopup(NativeWindow child) Unregisters a child popup that closed on its own.Methods inherited from interface limn.backend.NativeWindow
accessibility, backend, bounds, captureNextFrame, captureNextFrame, clipboard, close, closePolicy, closeRequestHandler, contentScale, cursorX, cursorY, display, enterFullscreen, enterFullscreen, enterFullscreen, exitFullscreen, fileDialogs, focus, framebufferHeight, framebufferWidth, hide, isClosed, isFullscreen, isMaximized, isMinimized, isModalBlocked, isVisible, launcher, logicalHeight, logicalToScreenFactor, logicalWidth, maximize, minimize, nativeHandle, observeState, overrideContentScale, pointerMode, printer, requestClose, requestFrame, restore, screenX, screenY, setAboveSystemChrome, setAccessibility, setClosePolicy, setCloseRequestHandler, setContentScaleListener, setCursor, setCursorPosition, setIcon, setImageCursor, setMousePassthrough, setOpacity, setPointerMode, setScreenPosition, setSize, setSizeLimits, setTitle, show, sizeLimits, state, title, toFront
-
Method Details
-
of
- Parameters:
window- any window- Returns:
- the same window as a peer; every window is one, since
NativeWindowpermits no other implementation
-
setTextInput
Says what text this window wants from the platform: none, typed characters with the input method off, or characters and the input method's composition. The scene asks for composition while a text-editing widget holds focus and for characters otherwise, so composition keys never leak into a control that is not text, and a list's type-ahead still hears letters. UI thread only.No default, nor for the two IME methods below: a backend that ignored them broke Chinese, Japanese and Korean input without a word. A backend with no input method (headless) implements them as no-ops, on purpose and in writing.
- Parameters:
input- what the window wants; nevernull
-
setPreeditCaretRect
void setPreeditCaretRect(float x, float y, float width, float height) Positions the IME candidate/composition window at the caret, so it follows the text being edited.x/y/width/heightare in logical points relative to the window's content area (the scene feeds the focused widget'scaretRect). UI thread only. -
resetPreedit
void resetPreedit()Cancels any in-progress IME composition held by the platform for this window. The scene calls it when focus leaves a text-editing widget, so a composition started there can never commit into whatever is focused next. A no-op when nothing is being composed. UI thread only. -
isModal
boolean isModal()- Returns:
- whether this window is itself an active modal: one the backend registered through
BackendPeer.pushModal(limn.backend.NativeWindow, limn.backend.NativeWindow), blocking the window it was opened over, or every other window when it was opened over none. The other end ofNativeWindow.isModalBlocked(): that is the owner's bit and this is the dialog's, and it is this one an accessible tree publishes on the window's own node, because a client asks a window whether it blocks what it owns and never whether something else blocks it
-
registerChildPopup
Registers a child popup to be closed automatically when this window closes, so a combo/menu popup can never outlive its parent.Registers it as
WindowPeer.PopupKind.TRANSIENT, which is what a dropdown or a menu is. A window of its own has to say so: seeregisterChildPopup(NativeWindow, PopupKind). -
registerChildPopup
Registers a child popup and says what it is; seeWindowPeer.PopupKind, which is the whole reason this overload exists. -
unregisterChildPopup
Unregisters a child popup that closed on its own. -
setFrameCallback
Registers the per-frame render callback. -
setInput
Registers the input sink (usually the scene). SeeWindowInput. -
supportsAbsolutePositioning
boolean supportsAbsolutePositioning()WhetherNativeWindow.screenX(),NativeWindow.screenY()andNativeWindow.setScreenPosition(int, int)actually work on this platform. Whenfalsethe getters report a placeholder and the setter is ignored: a window is placed by the desktop and never learns where it went.Ask this before drawing anything outside a window that has to line up with something inside it: a dropdown's list, a menu cascade, a tooltip. Those are not windows in their own right; they are the owner's content, escaping the frame because most desktops offer no other way to overflow it. Where the answer is
falsethere is no such way, and the content has to be drawn in the scene instead, clipped to the owner.A window that is genuinely a window (a document, a dialog, a palette) needs no such check. It has no position to agree with, so letting the desktop place it is the right outcome rather than a fallback.
No default. It answered
trueuntil 2026-09-22, which is the unsafe answer: a backend that said nothing claimed a power Wayland does not have, and a popup that trusted it opened wherever the compositor put it. Absolute window position is absent from that protocol by design, so a backend has to say. -
publishAccessibilityElsewhere
default void publishAccessibilityElsewhere()Says this window's contents are published in another window's accessible tree: a popup the scene that opened it grafted into its own tree, as a native drop-down list is its field's child. The window then opens no bridge of its own, and where the platform would tell an assistive technology that a window appeared, it is kept out of that too: VoiceOver said "has a new window" a few seconds after every opening of a combo's list. Called before the window is shown.defaultand doing nothing, which is right for a window with no accessibility. -
supportsDrag
default boolean supportsDrag()- Returns:
- whether this window can hand a drag to the system, so that it leaves the window:
startDrag(limn.backend.spi.DragRequest)is worth preparing a picture for
-
startDrag
Hands a drag to the system, while a mouse button is down in this window. From here untilrequest.ended()is told, the pointer is the system's: the window hears no pointer events, and what is under the pointer in this window or another is asked throughWindowInput.dragOver(limn.transfer.Offer, java.util.Set<limn.transfer.DropAction>, float, float).- Parameters:
request- what is dragged and who hears the end- Returns:
- whether the system took it; false leaves the drag to the scene
-
dragAnswerChanged
The answer this window gave the drag the system drives over it changed while the pointer stood still: the content scrolled under the pointer, and another widget, or none, takes the drag there now. Said once per change, for a drag from another program and for one this window handed over; never for a drag the scene drives itself. UI thread.A system that asks
WindowInput.dragOver(limn.transfer.Offer, java.util.Set<limn.transfer.DropAction>, float, float)again only when the pointer moves is to be told now, as the answer to its own ask would have told it, or a drop let go without a move is decided by the answer before the scroll. One that asks again on its own while the pointer rests hears the new answer then, and can leave this as it is:defaultand doing nothing.- Parameters:
action- the action a widget under the pointer would carry out now, or null when none takes the drag there
-