Package limn.backend
@NullMarked
package limn.backend
The service-provider interface a native platform implements:
Backend
runs the event loop and creates NativeWindows. Beside it sit the
contracts a platform must supply: the GpuRenderer widgets draw
through, WindowInput, Clipboard,
Cursors, FileDialogs and
Crashes reporting. Come here to write a backend, or to see exactly
what one owes the toolkit; an application constructs one at startup and otherwise
programs against the modules above, which never name a windowing library.-
ClassDescriptionWhat a backend gives a window so that a platform's assistive technology can read it.What the scene gives a bridge: the three ways to ask for a tree, and the one way to act.Service-provider interface for a native platform backend (windows, input, GPU rendering, clipboard).The system clipboard: what the user last copied, in this application or another, in every format it was offered in.What a user's close of a window does once it is allowed: set with
NativeWindow.setClosePolicy(limn.backend.ClosePolicy),ClosePolicy.DISPOSEby default.One question to a window'sCloseRequestHandler: may this window close? Answered exactly once, withCloseRequest.allow()orCloseRequest.refuse(), now or later: a handler that shows a dialog keeps the request and answers from the dialog's result.Why the window is asked.Decides whether a window may close, set withNativeWindow.setCloseRequestHandler(limn.backend.CloseRequestHandler).Crash containment registry: one process-wideCrashHandler(default: log and continue) that the toolkit and backend notify whenever application code throws inside the event loop.Unwinds the event loop when aCrashHandlerreturnedfalse; containment sites let it pass through instead of re-dispatching, so the HANDLER.current() sees each crash once.Application hook for crashes the toolkit caught in the event loop.Where application code was executing when a contained crash was caught.A standard mouse-cursor shape a widget can request while hovered: the OS's native pointer, so it looks and feels exactly like every other application.A monitor/screen, normalized so every part of the toolkit reads display information the same way instead of each class poking at the platform: its identity (Display.id()/Display.name()), the mode currently set (Display.currentResolution()), all supported modes (Display.availableResolutions()), the fullDisplay.bounds(), the usableDisplay.workArea()(minus taskbar/dock), and the DPIDisplay.contentScale().The platform's own file and folder choosers, owned by a window:NativeWindow.fileDialogs().A file-name filter: a human-readable description plus glob patterns, e.g.Which graphics context a backend actually obtained, and which of the optional capabilities the toolkit uses are present on it.Hands an address or a file to the system the window is on: a web page to the browser, amailto:to the mail program, a file to the program registered for its type, or a file to the file manager, shown selected in its folder.WhyBackend.runEventLoop()returned.How longBackend.runEventLoop()runs: set withBackend.setLoopLifetime(limn.backend.LoopLifetime),LoopLifetime.UNTIL_LAST_WINDOWby default.A top-level native window.Notified when the window moves to a monitor with a different content scale.The operating system and processor architecture this JVM runs on, answered once and from one place.The operating system families the toolkit tells apart.How the window treats the mouse pointer: visibility and capture.What prints a PDF through the system's own print dialog, owned by a window: reached fromNativeWindow.printer().What became of a print asked of the system throughPrinter.Decides whether the application may end, for what belongs to no window (a download still running): set withBackend.setQuitHandler(limn.backend.QuitHandler).The application-wide questionBackend.requestQuit()asks first, to theQuitHandler, before any window is asked: may the application end? Answered exactly once, now or later.A snapshot of GPU resources the renderer is holding: currently the number of GL textures resident (glyph-atlas pages + cached image textures) and their estimated size in bytes.An immutable screen mode: a size and refresh rate.The bounds a window's size is kept within while the user resizes it, in logical points.Initial configuration for aNativeWindow: start fromWindowConfig.of(java.lang.String, int, int), then change what differs from a plain window with a wither.Where a window is, how large and in which state, as one value: whatNativeWindow.state()answers and whatNativeWindow.observeState(java.util.function.Consumer<limn.backend.WindowState>)hands a listener each time any part of it changes.Visual framing of a window.