primaryDisplay
- Specified by:
primaryDisplayin interfaceBackend- Returns:
- the primary
Display, ornullwhen headless. Default: the display that reportsDisplay.isPrimary(), else the first ofBackend.displays(). UI thread only.
AutoCloseable, Backend, BackendPeerBackend.
Must be constructed on the process main thread (on macOS the JVM needs
-XstartOnFirstThread); that thread becomes the Limn UI thread.
The event loop is event-driven: it sleeps in glfwWaitEvents() (or
glfwWaitEventsTimeout() when a delayed task is scheduled) and is
woken by native events or by glfwPostEmptyEvent() whenever another
thread posts through Ui.
Waking is not painting: the loop runs the tasks and then renders only the windows something asked a frame of, so an application whose posted task mutates a widget without invalidating it will not see the change.
On macOS a process runs as an agent, with no icon in the Dock, no menu bar of its own and
no window that comes in front of what the user is doing, when its package says so
(LSUIElement), and also when it is started with -Dlimn.macos.agent=true or
with the environment variable LIMN_MACOS_AGENT set to 1 or true. The
last two are for runs whose windows nobody looks at, such as tests, and the variable is
inherited: an application started by a process that has it set starts as an agent too.
BackendPeer.SceneModalHandlestatic final Stringtrue to make every window report that it cannot be positioned, which
puts menus and dropdowns into the owner scene on a platform that would otherwise place
them in windows.static final StringLwjglBackend(@Nullable String applicationName) LwjglBackend() does, for an application with a name.voidclose()booleancreateTray(String id,
TrayHost host) createWindow(WindowConfig config) displays()voidpopModal(NativeWindow modal) modal from the modal stack, releasing what it locked.@Nullable DisplayvoidpushModal(NativeWindow modal,
@Nullable NativeWindow parent) modal as an active modal window and pushes it on the
modal stack.pushSceneModal(NativeWindow owner,
boolean toolkitScope) owner.voidvoidsetApplicationName(String name) voidsetLoopLifetime(LoopLifetime newLifetime) Backend.runEventLoop() runs: until the last window closes (the default) or
until the application ends it, which lets an application live with no window open.voidsetQuitHandler(@Nullable QuitHandler handler) Backend.requestQuit() asks before any window, for what belongs to no window.voidstatic GraphicsInfostartupFailure(String failure) graphicsInfo() cannot answer because there is no instance to ask it of.voidstop()@Nullable SystemMenuBarValues: x11, wayland, any. Unset means the default below.
true to make every window report that it cannot be positioned, which
puts menus and dropdowns into the owner scene on a platform that would otherwise place
them in windows.
It exists so the fallback can be looked at. Wayland is the only platform that
really needs it, and a presentation that can only be seen on one desktop is one that gets
broken on the other three and noticed a release later. With this the demo renders it
anywhere, including into a --screenshot. It changes no behaviour the application
chooses and none that a user can reach.
-XstartOnFirstThread arranges.IllegalStateException - when the native libraries do not load or GLFW cannot start;
the message says why and what to tryLwjglBackend() does, for an application with a name.
The name is what macOS writes in bold in its menu bar and in the items of the
application's menu there, for an application that is not packaged: a packaged one is named
by its package, and an unpackaged one given no name here is shown under the name of the
program that launched it. It has to be given here because the system reads it once, as
the windowing library starts. -Dlimn.application.name gives it to a launch that
calls the other constructor. On every system it is also what setApplicationName(java.lang.String)
would set.
applicationName - the application's name, or null for noneIllegalStateException - as LwjglBackend()graphicsInfo() cannot answer because there is no instance to ask it of.
It carries the one thing that is knowable before glfwInit: the version string of
the GLFW that is loaded, which lists the platforms that libglfw was BUILT with. On
the failure this exists for that is exactly the useful contrast — a library naming Wayland
and X11 next to a machine running neither is a headless machine, not a broken library. The
platform is reported as none, because failing to select one is what happened.
failure - why the backend could not be constructed; becomes
GraphicsInfo.failure()On Linux, AT-SPI2 shows one application object per process with every window beneath it, and a screen reader says that name when the user moves into the application; left unset, a backend uses the title of the first window it created, which is right for a one-window program and wrong for one whose first window is a splash or a login. Windows names an application from the process itself and reads nothing here. Call it before the first window for the name to be there from the start; a later call renames the application for the next client that asks.
On macOS the name is also what the toolkit writes in the items of the application's menu (About, Hide, Quit). It is not what the system writes in bold at the head of its menu bar: the system reads that once, as the windowing library starts, from the application's package, and for an application that is not packaged from the name the backend was made with. A backend that takes a name at its construction says so there.
Handed to every window's accessibility bridge as it opens, and to the process's AT-SPI application at once when windows already have one.
setApplicationName in interface Backendname - what the desktop should call this application; never nullBackendPeercreateWindow in interface BackendcreateWindow in interface BackendPeercompositorShadowsPopups in interface Backendtrue (the default) where the compositor casts it, and for a backend with
no desktop under it, which then draws nothing extragraphicsInfo in interface BackendBackend.createWindow(limn.backend.WindowConfig) has succeeded at least once; before that,
and on a machine where it never does, the result carries the
windowing platform and a GraphicsInfo.failure() instead.
Default: GraphicsInfo.NONE. UI thread only.BackendLoopLifetime.UNTIL_LAST_WINDOW), when a
Backend.requestQuit() was agreed to and every window has closed, or when
Backend.stop() is invoked.runEventLoop in interface BackendBackendBackend.runEventLoop() runs: until the last window closes (the default) or
until the application ends it, which lets an application live with no window open. UI thread
only.setLoopLifetime in interface BackendnewLifetime - the lifetime; never nullloopLifetime in interface BackendBackend.runEventLoop() runs; LoopLifetime.UNTIL_LAST_WINDOW unless setBackendquit handler is asked first, then
every open top-level window's handler, front to
back (the window used last first), one at a time; a window with no handler agrees. A refusal
anywhere ends the request and every window stays open. When all have agreed, every window
closes, owned ones included, and Backend.runEventLoop() returns LoopEnd.QUIT.
A request made while one is being answered joins it. On macOS the system's Quit command for the application (Cmd-Q, the application menu, the Dock) makes this request. UI thread only.
requestQuit in interface BackendBackendBackend.requestQuit() asks before any window, for what belongs to no window.
null clears. UI thread only.setQuitHandler in interface Backendhandler - the handler, or null for noneBackendPeermodal as an active modal window and pushes it on the
modal stack. Only the topmost modal receives input; every window it
locks ignores input until it closes.
Modality scope: a non-null parent makes it window-modal,
so it locks only parent (and parent's owned popups),
leaving unrelated windows interactive. A null parent makes it
toolkit-modal, so it locks every other window. Modals stack: with
several open, only the top one is usable and the non-modal windows are
released only after the whole modal stack closes. UI thread only.
pushModal in interface BackendPeerBackendPeermodal from the modal stack, releasing what it locked. UI thread only.popModal in interface BackendPeerBackendPeerowner.
Unlike BackendPeer.pushModal(limn.backend.NativeWindow, limn.backend.NativeWindow), there is no separate modal window: the overlay
blocks owner's own content, so owner stays interactive,
while this call blocks the same sibling windows a native modal
would. toolkitScope true locks every other window;
false locks only owner's owned popups. Release the
returned handle when the overlay closes. UI thread only.pushSceneModal in interface BackendPeerBackendPeersignalModalBlocked in interface BackendPeerrenderStats in interface BackendRenderStats.EMPTY.
UI thread only.render3DStats in interface BackendRender3DStats.EMPTY.
UI thread only.primaryDisplay in interface BackendDisplay, or null when headless.
Default: the display that reports Display.isPrimary(), else
the first of Backend.displays(). UI thread only.BackendBackendPeerThe default is the answer of every system but one: null, and a menu bar is
drawn in its window.
systemMenuBar in interface BackendPeerBackendPeerTrayPeer.update(limn.backend.spi.TrayState).
UI thread only.
The default is the answer of a backend with no desktop under it: a peer that shows nothing and is never available.
createTray in interface BackendPeerid - the application's identifier for this icon: ASCII letters, digits, a dot, a
hyphen and an underscore, already checked, and no other tray of this backend has ithost - what the peer asks the menu of and tells of a clickBackendclose in interface AutoCloseableclose in interface Backend