Class DisplayManager
- All Implemented Interfaces:
Proxy
You can use get()
to obtain the GdkDisplayManager
singleton, but that should be rarely necessary. Typically, initializing
GTK opens a display that you can work with without ever accessing the
GdkDisplayManager
.
The GDK library can be built with support for multiple backends.
The GdkDisplayManager
object determines which backend is used
at runtime.
In the rare case that you need to influence which of the backends
is being used, you can use Gdk.setAllowedBackends(java.lang.String)
. Note
that you need to call this function before initializing GTK.
Backend-specific code
When writing backend-specific code that is supposed to work with
multiple GDK backends, you have to consider both compile time and
runtime. At compile time, use the GDK_WINDOWING_X11
, GDK_WINDOWING_WIN32
macros, etc. to find out which backends are present in the GDK library
you are building your application against. At runtime, use type-check
macros like GDK_IS_X11_DISPLAY() to find out which backend is in use:
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (display))
{
// make X11-specific calls here
}
else
#endif
#ifdef GDK_WINDOWING_MACOS
if (GDK_IS_MACOS_DISPLAY (display))
{
// make Quartz-specific calls here
}
else
#endif
g_error ("Unsupported GDK backend");
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
DisplayManager.Builder<B extends DisplayManager.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theDisplayOpenedCallback
callback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionDisplayManager
(MemorySegment address) Create a DisplayManager proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected DisplayManager
asParent()
Returns this instance as if it were its parent type.static DisplayManager.Builder
<? extends DisplayManager.Builder> builder()
ADisplayManager.Builder
object constructs aDisplayManager
with the specified properties.void
emitDisplayOpened
(Display display) Emits the "display-opened" signal.static DisplayManager
get()
Gets the singletonGdkDisplayManager
object.Gets the defaultGdkDisplay
.static Type
getType()
Get the GType of the DisplayManager classList all currently open displays.Emitted when a display is opened.openDisplay
(@Nullable String name) Opens a display.void
setDefaultDisplay
(Display display) Setsdisplay
as the default display.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
DisplayManager
Create a DisplayManager proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
get
Gets the singletonGdkDisplayManager
object.When called for the first time, this function consults the
GDK_BACKEND
environment variable to find out which of the supported GDK backends to use (in case GDK has been compiled with multiple backends).Applications can use
Gdk.setAllowedBackends(java.lang.String)
to limit what backends will be used.- Returns:
- The global
GdkDisplayManager
singleton
-
getDefaultDisplay
-
listDisplays
-
openDisplay
-
setDefaultDisplay
Setsdisplay
as the default display.- Parameters:
display
- aGdkDisplay
-
onDisplayOpened
public SignalConnection<DisplayManager.DisplayOpenedCallback> onDisplayOpened(DisplayManager.DisplayOpenedCallback handler) Emitted when a display is opened.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitDisplayOpened
Emits the "display-opened" signal. SeeonDisplayOpened(org.gnome.gdk.DisplayManager.DisplayOpenedCallback)
. -
builder
ADisplayManager.Builder
object constructs aDisplayManager
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withDisplayManager.Builder.build()
.
-