Package ch.bailu.gtk.gdk
Class Display
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gdk.Display
- All Implemented Interfaces:
PointerInterface
`GdkDisplay` objects are the GDK representation of a workstation.
Their purpose are two-fold:
- To manage and provide information about input devices (pointers, keyboards, etc)
- To manage and provide information about output devices (monitors, projectors, etc)
Most of the input device handling has been factored out into separate
[class@Gdk.Seat] objects. Every display has a one or more seats, which
can be accessed with [method@Gdk.Display.get_default_seat] and
[method@Gdk.Display.list_seats].
Output devices are represented by [class@Gdk.Monitor] objects, which can
be accessed with [method@Gdk.Display.get_monitor_at_surface] and similar APIs.
Their purpose are two-fold:
- To manage and provide information about input devices (pointers, keyboards, etc)
- To manage and provide information about output devices (monitors, projectors, etc)
Most of the input device handling has been factored out into separate
[class@Gdk.Seat] objects. Every display has a one or more seats, which
can be accessed with [method@Gdk.Display.get_default_seat] and
[method@Gdk.Display.list_seats].
Output devices are represented by [class@Gdk.Monitor] objects, which can
be accessed with [method@Gdk.Display.get_monitor_at_surface] and similar APIs.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
static interface
static interface
static interface
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
beep()
Emits a short beep on @displayvoid
close()
Closes the connection to the windowing system for the given display.Creates a new `GdkGLContext` for the `GdkDisplay`.boolean
deviceIsGrabbed
(Device device) Returns %TRUE if there is an ongoing grab on @device for @display.void
flush()
Flushes any requests queued for the windowing system.Returns a `GdkAppLaunchContext` suitable for launching
applications on the given display.static ClassHandler
Gets the clipboard used for copy/paste operations.static Display
Gets the default `GdkDisplay`.Returns the default `GdkSeat` for this display.static int
getMonitorAtSurface
(Surface surface) Gets the monitor in which the largest area of @surface
resides.Gets the list of monitors associated with this display.getName()
Gets the name of the display.static long
static TypeSystem.TypeSize
Gets the clipboard used for the primary selection.boolean
getSetting
(Str name, Value value) Retrieves a desktop-wide setting such as double-click time
for the @display.boolean
getSetting
(String name, Value value) Retrieves a desktop-wide setting such as double-click time
for the @display.Gets the startup notification ID for a Wayland display, or %NULL
if no ID has been defined.static long
static TypeSystem.TypeSize
boolean
isClosed()
Finds out if the display has been closed.boolean
Returns whether surfaces can reasonably be expected to have
their alpha channel drawn correctly on the screen.boolean
isRgba()
Returns whether surfaces on this @display are created with an
alpha channel.Returns the list of seats known to @display.void
notifyStartupComplete
(Str startup_id) Indicates to the GUI environment that the application has
finished loading, using a given identifier.void
notifyStartupComplete
(String startup_id) Indicates to the GUI environment that the application has
finished loading, using a given identifier.onClosed
(Display.OnClosed signal) Connect to signal "closed".onOpened
(Display.OnOpened signal) Connect to signal "opened".onSeatAdded
(Display.OnSeatAdded signal) Connect to signal "seat-added".onSeatRemoved
(Display.OnSeatRemoved signal) Connect to signal "seat-removed".Connect to signal "setting-changed".static Display
Opens a display.boolean
Checks that OpenGL is available for @self and ensures that it is
properly initialized.void
Appends the given event onto the front of the event
queue for @display.boolean
Returns %TRUE if the display supports input shapes.void
sync()
Flushes any requests queued for the windowing system and waits until all
requests have been handled.Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
SIGNAL_ON_CLOSED
- See Also:
-
SIGNAL_ON_OPENED
- See Also:
-
SIGNAL_ON_SEAT_ADDED
- See Also:
-
SIGNAL_ON_SEAT_REMOVED
- See Also:
-
SIGNAL_ON_SETTING_CHANGED
- See Also:
-
-
Constructor Details
-
Display
-
-
Method Details
-
getClassHandler
-
beep
public void beep()Emits a short beep on @display -
close
public void close()Closes the connection to the windowing system for the given display.
This cleans up associated resources. -
createGlContext
Creates a new `GdkGLContext` for the `GdkDisplay`.
The context is disconnected from any particular surface or surface
and cannot be used to draw to any surface. It can only be used to
draw to non-surface framebuffers like textures.
If the creation of the `GdkGLContext` failed, @error will be set.
Before using the returned `GdkGLContext`, you will need to
call [method@Gdk.GLContext.make_current] or [method@Gdk.GLContext.realize].- Returns:
- the newly created `GdkGLContext`
- Throws:
AllocationError
-
deviceIsGrabbed
Returns %TRUE if there is an ongoing grab on @device for @display.- Parameters:
device
- a `GdkDevice`- Returns:
- %TRUE if there is a grab in effect for @device.
-
flush
public void flush()Flushes any requests queued for the windowing system.
This happens automatically when the main loop blocks waiting for new events,
but if your application is drawing without returning control to the main loop,
you may need to call this function explicitly. A common case where this function
needs to be called is when an application is executing drawing commands
from a thread other than the thread where the main loop is running.
This is most useful for X11. On windowing systems where requests are
handled synchronously, this function will do nothing. -
getAppLaunchContext
Returns a `GdkAppLaunchContext` suitable for launching
applications on the given display.- Returns:
- a new `GdkAppLaunchContext` for @display
-
getClipboard
Gets the clipboard used for copy/paste operations.- Returns:
- the display's clipboard
-
getDefaultSeat
Returns the default `GdkSeat` for this display.
Note that a display may not have a seat. In this case,
this function will return %NULL.- Returns:
- the default seat.
-
getMonitorAtSurface
Gets the monitor in which the largest area of @surface
resides.
Returns a monitor close to @surface if it is outside
of all monitors.- Parameters:
surface
- a `GdkSurface`- Returns:
- the monitor with the largest overlap with @surface
-
getMonitors
Gets the list of monitors associated with this display.
Subsequent calls to this function will always return the
same list for the same display.
You can listen to the GListModel::items-changed signal on
this list to monitor changes to the monitor of this display.- Returns:
- a `GListModel` of `GdkMonitor`
-
getName
Gets the name of the display.- Returns:
- a string representing the display name. This string is owned by GDK and should not be modified or freed.
-
getPrimaryClipboard
Gets the clipboard used for the primary selection.
On backends where the primary clipboard is not supported natively,
GDK emulates this clipboard locally.- Returns:
- the primary clipboard
-
getSetting
Retrieves a desktop-wide setting such as double-click time
for the @display.- Parameters:
name
- the name of the settingvalue
- location to store the value of the setting- Returns:
- %TRUE if the setting existed and a value was stored in @value, %FALSE otherwise
-
getSetting
Retrieves a desktop-wide setting such as double-click time
for the @display.- Parameters:
name
- the name of the settingvalue
- location to store the value of the setting- Returns:
- %TRUE if the setting existed and a value was stored in @value, %FALSE otherwise
-
getStartupNotificationId
Gets the startup notification ID for a Wayland display, or %NULL
if no ID has been defined.- Returns:
- the startup notification ID for @display
-
isClosed
public boolean isClosed()Finds out if the display has been closed.- Returns:
- %TRUE if the display is closed.
-
isComposited
public boolean isComposited()Returns whether surfaces can reasonably be expected to have
their alpha channel drawn correctly on the screen.
Check [method@Gdk.Display.is_rgba] for whether the display
supports an alpha channel.
On X11 this function returns whether a compositing manager is
compositing on @display.
On modern displays, this value is always %TRUE.- Returns:
- Whether surfaces with RGBA visuals can reasonably be expected to have their alpha channels drawn correctly on the screen.
-
isRgba
public boolean isRgba()Returns whether surfaces on this @display are created with an
alpha channel.
Even if a %TRUE is returned, it is possible that the
surface’s alpha channel won’t be honored when displaying the
surface on the screen: in particular, for X an appropriate
windowing manager and compositing manager must be running to
provide appropriate display. Use [method@Gdk.Display.is_composited]
to check if that is the case.
On modern displays, this value is always %TRUE.- Returns:
- %TRUE if surfaces are created with an alpha channel or %FALSE if the display does not support this functionality.
-
listSeats
Returns the list of seats known to @display.- Returns:
- the list of seats known to the `GdkDisplay`
-
notifyStartupComplete
Indicates to the GUI environment that the application has
finished loading, using a given identifier.
GTK will call this function automatically for [class@Gtk.Window]
with custom startup-notification identifier unless
[method@Gtk.Window.set_auto_startup_notification]
is called to disable that feature.- Parameters:
startup_id
- a startup-notification identifier, for which notification process should be completed
-
notifyStartupComplete
Indicates to the GUI environment that the application has
finished loading, using a given identifier.
GTK will call this function automatically for [class@Gtk.Window]
with custom startup-notification identifier unless
[method@Gtk.Window.set_auto_startup_notification]
is called to disable that feature.- Parameters:
startup_id
- a startup-notification identifier, for which notification process should be completed
-
prepareGl
Checks that OpenGL is available for @self and ensures that it is
properly initialized.
When this fails, an @error will be set describing the error and this
function returns %FALSE.
Note that even if this function succeeds, creating a `GdkGLContext`
may still fail.
This function is idempotent. Calling it multiple times will just
return the same value or error.
You never need to call this function, GDK will call it automatically
as needed. But you can use it as a check when setting up code that
might make use of OpenGL.- Returns:
- %TRUE if the display supports OpenGL
- Throws:
AllocationError
-
putEvent
Appends the given event onto the front of the event
queue for @display.
This function is only useful in very special situations
and should not be used by applications.- Parameters:
event
- a `GdkEvent`
-
supportsInputShapes
public boolean supportsInputShapes()Returns %TRUE if the display supports input shapes.
This means that [method@Gdk.Surface.set_input_region] can
be used to modify the input shape of surfaces on @display.
On modern displays, this value is always %TRUE.- Returns:
- %TRUE if surfaces with modified input shape are supported
-
sync
public void sync()Flushes any requests queued for the windowing system and waits until all
requests have been handled.
This is often used for making sure that the display is synchronized
with the current state of the program. Calling [method@Gdk.Display.sync]
before [method@GdkX11.Display.error_trap_pop] makes sure that any errors
generated from earlier requests are handled before the error trap is removed.
This is most useful for X11. On windowing systems where requests are
handled synchronously, this function will do nothing. -
onClosed
Connect to signal "closed".
SeeDisplay.OnClosed.onClosed(boolean)
for signal description.
FieldSIGNAL_ON_CLOSED
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
onOpened
Connect to signal "opened".
SeeDisplay.OnOpened.onOpened()
for signal description.
FieldSIGNAL_ON_OPENED
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
onSeatAdded
Connect to signal "seat-added".
SeeDisplay.OnSeatAdded.onSeatAdded(ch.bailu.gtk.gdk.Seat)
for signal description.
FieldSIGNAL_ON_SEAT_ADDED
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
onSeatRemoved
Connect to signal "seat-removed".
SeeDisplay.OnSeatRemoved.onSeatRemoved(ch.bailu.gtk.gdk.Seat)
for signal description.
FieldSIGNAL_ON_SEAT_REMOVED
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
onSettingChanged
Connect to signal "setting-changed".
SeeDisplay.OnSettingChanged.onSettingChanged(ch.bailu.gtk.type.Str)
for signal description.
FieldSIGNAL_ON_SETTING_CHANGED
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
getDefault
Gets the default `GdkDisplay`.
This is a convenience function for:
gdk_display_manager_get_default_display (gdk_display_manager_get ())- Returns:
- a `GdkDisplay`, or %NULL if there is no default display
-
open
Opens a display.
If opening the display fails, `NULL` is returned.- Parameters:
display_name
- the name of the display to open- Returns:
- a `GdkDisplay`
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-