Top |
Functions
Signals
void | closed | Run Last |
void | opened | Run Last |
void | seat-added | Run Last |
void | seat-removed | Run Last |
void | setting-changed | Run Last |
Description
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 GdkSeat
objects. Every display has a one or more seats, which can be accessed with
gdk_display_get_default_seat()
and gdk_display_list_seats()
.
Output devices are represented by GdkMonitor objects, which can be accessed
with gdk_display_get_monitor_at_surface()
and similar APIs.
Functions
gdk_display_get_default ()
GdkDisplay *
gdk_display_get_default (void
);
Gets the default GdkDisplay. This is a convenience
function for:
gdk_display_manager_get_default_display (
.gdk_display_manager_get()
)
gdk_display_get_name ()
const char *
gdk_display_get_name (GdkDisplay *display
);
Gets the name of the display.
gdk_display_device_is_grabbed ()
gboolean gdk_display_device_is_grabbed (GdkDisplay *display
,GdkDevice *device
);
Returns TRUE
if there is an ongoing grab on device
for display
.
gdk_display_sync ()
void
gdk_display_sync (GdkDisplay *display
);
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
gdk_display_sync()
before gdk_x11_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.
gdk_display_flush ()
void
gdk_display_flush (GdkDisplay *display
);
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.
gdk_display_close ()
void
gdk_display_close (GdkDisplay *display
);
Closes the connection to the windowing system for the given display, and cleans up associated resources.
gdk_display_is_closed ()
gboolean
gdk_display_is_closed (GdkDisplay *display
);
Finds out if the display has been closed.
gdk_display_is_rgba ()
gboolean
gdk_display_is_rgba (GdkDisplay *display
);
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 gdk_display_is_composited()
to check if that is the case.
On modern displays, this value is always TRUE
.
gdk_display_is_composited ()
gboolean
gdk_display_is_composited (GdkDisplay *display
);
Returns whether surfaces can reasonably be expected to have
their alpha channel drawn correctly on the screen. Check
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
.
gdk_display_supports_input_shapes ()
gboolean
gdk_display_supports_input_shapes (GdkDisplay *display
);
Returns TRUE
if 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
.
gdk_display_get_app_launch_context ()
GdkAppLaunchContext *
gdk_display_get_app_launch_context (GdkDisplay *display
);
Returns a GdkAppLaunchContext suitable for launching applications on the given display.
Returns
a new GdkAppLaunchContext for display
.
Free with g_object_unref()
when done.
[transfer full]
gdk_display_notify_startup_complete ()
void gdk_display_notify_startup_complete (GdkDisplay *display
,const char *startup_id
);
Indicates to the GUI environment that the application has finished loading, using a given identifier.
GTK will call this function automatically for GtkWindow
with custom startup-notification identifier unless
gtk_window_set_auto_startup_notification()
is called to
disable that feature.
gdk_display_get_default_seat ()
GdkSeat *
gdk_display_get_default_seat (GdkDisplay *display
);
Returns the default GdkSeat for this display.
Note that a display may not have a seat. In this case,
this function will return NULL
.
gdk_display_list_seats ()
GList *
gdk_display_list_seats (GdkDisplay *display
);
Returns the list of seats known to display
.
gdk_display_get_monitors ()
GListModel *
gdk_display_get_monitors (GdkDisplay *self
);
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.
gdk_display_get_monitor_at_surface ()
GdkMonitor * gdk_display_get_monitor_at_surface (GdkDisplay *display
,GdkSurface *surface
);
Gets the monitor in which the largest area of surface
resides, or a monitor close to surface
if it is outside
of all monitors.
gdk_display_get_clipboard ()
GdkClipboard *
gdk_display_get_clipboard (GdkDisplay *display
);
Gets the clipboard used for copy/paste operations.
gdk_display_get_primary_clipboard ()
GdkClipboard *
gdk_display_get_primary_clipboard (GdkDisplay *display
);
Gets the clipboard used for the primary selection. On backends where the primary clipboard is not supported natively, GDK emulates this clipboard locally.
gdk_display_get_setting ()
gboolean gdk_display_get_setting (GdkDisplay *display
,const char *name
,GValue *value
);
Retrieves a desktop-wide setting such as double-click time
for the display
.
gdk_display_get_startup_notification_id ()
const char *
gdk_display_get_startup_notification_id
(GdkDisplay *display
);
Gets the startup notification ID for a Wayland display, or NULL
if no ID has been defined.
gdk_display_put_event ()
void gdk_display_put_event (GdkDisplay *display
,GdkEvent *event
);
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.
gdk_display_map_keyval ()
gboolean gdk_display_map_keyval (GdkDisplay *display
,guint keyval
,GdkKeymapKey **keys
,int *n_keys
);
Obtains a list of keycode/group/level combinations that will
generate keyval
. Groups and levels are two kinds of keyboard mode;
in general, the level determines whether the top or bottom symbol
on a key is used, and the group determines whether the left or
right symbol is used.
On US keyboards, the shift key changes the keyboard level, and there are no groups. A group switch key might convert a keyboard between Hebrew to English modes, for example.
GdkEventKey contains a group
field that indicates the active
keyboard group. The level is computed from the modifier mask.
The returned array should be freed with g_free()
.
Parameters
display |
||
keyval |
a keyval, such as |
|
keys |
return location for an array of GdkKeymapKey. |
[out][array length=n_keys][transfer full] |
n_keys |
return location for number of elements in returned array |
gdk_display_map_keycode ()
gboolean gdk_display_map_keycode (GdkDisplay *display
,guint keycode
,GdkKeymapKey **keys
,guint **keyvals
,int *n_entries
);
Returns the keyvals bound to keycode
. The Nth GdkKeymapKey
in keys
is bound to the Nth keyval in keyvals
.
When a keycode is pressed by the user, the keyval from this list of entries is selected by considering the effective keyboard group and level.
Free the returned arrays with g_free()
.
Parameters
display |
||
keycode |
a keycode |
|
keys |
return
location for array of GdkKeymapKey, or |
[out][array length=n_entries][transfer full][optional] |
keyvals |
return
location for array of keyvals, or |
[out][array length=n_entries][transfer full][optional] |
n_entries |
length of |
gdk_display_translate_key ()
gboolean gdk_display_translate_key (GdkDisplay *display
,guint keycode
,GdkModifierType state
,int group
,guint *keyval
,int *effective_group
,int *level
,GdkModifierType *consumed
);
Translates the contents of a GdkEventKey (ie keycode
, state
, and group
)
into a keyval, effective group, and level. Modifiers that affected the
translation and are thus unavailable for application use are returned in
consumed_modifiers
.
The effective_group
is the group that was actually used for the translation;
some keys such as Enter are not affected by the active keyboard group.
The level
is derived from state
.
consumed_modifiers
gives modifiers that should be masked outfrom state
when comparing this key press to a keyboard shortcut. For instance, on a US
keyboard, the plus
symbol is shifted, so when comparing a key press to a
<Control>plus
accelerator <Shift>
should be masked out.
This function should rarely be needed, since GdkEventKey already contains the translated keyval. It is exported for the benefit of virtualized test environments.
Parameters
display |
||
keycode |
a keycode |
|
state |
a modifier state |
|
group |
active keyboard group |
|
keyval |
return location for keyval, or |
[out][optional] |
effective_group |
return location for effective
group, or |
[out][optional] |
level |
return location for level, or |
[out][optional] |
consumed |
return location for modifiers
that were used to determine the group or level, or |
[out][optional] |
Property Details
The “composited”
property
“composited” gboolean
TRUE
if the display properly composites the alpha channel.
See gdk_display_is_composited()
for details.
Owner: GdkDisplay
Flags: Read
Default value: TRUE
The “input-shapes”
property
“input-shapes” gboolean
TRUE
if the display supports input shapes. See
gdk_display_supports_input_shapes()
for details.
Owner: GdkDisplay
Flags: Read
Default value: TRUE
The “rgba”
property
“rgba” gboolean
TRUE
if the display supports an alpha channel. See gdk_display_is_rgba()
for details.
Owner: GdkDisplay
Flags: Read
Default value: TRUE
Signal Details
The “closed”
signal
void user_function (GdkDisplay *display, gboolean is_error, gpointer user_data)
The ::closed signal is emitted when the connection to the windowing
system for display
is closed.
Parameters
display |
the object on which the signal is emitted |
|
is_error |
|
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
The “opened”
signal
void user_function (GdkDisplay *display, gpointer user_data)
The ::opened signal is emitted when the connection to the windowing
system for display
is opened.
Parameters
display |
the object on which the signal is emitted |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
The “seat-added”
signal
void user_function (GdkDisplay *display, GdkSeat *seat, gpointer user_data)
The ::seat-added signal is emitted whenever a new seat is made known to the windowing system.
Parameters
display |
the object on which the signal is emitted |
|
seat |
the seat that was just added |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
The “seat-removed”
signal
void user_function (GdkDisplay *display, GdkSeat *seat, gpointer user_data)
The ::seat-removed signal is emitted whenever a seat is removed by the windowing system.
Parameters
display |
the object on which the signal is emitted |
|
seat |
the seat that was just removed |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
The “setting-changed”
signal
void user_function (GdkDisplay *display, char *setting, gpointer user_data)
The ::setting-changed signal is emitted whenever a setting changes its value.
Parameters
display |
the object on which the signal is emitted |
|
setting |
the name of the setting that changed |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last