Gdk.Display¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
|||
r |
|||
r |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted when the connection to the windowing system for display is closed. |
|
Emitted when the connection to the windowing system for display is opened. |
|
Emitted whenever a new seat is made known to the windowing system. |
|
Emitted whenever a seat is removed by the windowing system. |
|
Emitted whenever a setting changes its value. |
Fields¶
- Inherited:
Class Details¶
- class Gdk.Display(**kwargs)¶
- Bases:
- Abstract:
No
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.
- classmethod get_default()[source]¶
- Returns:
a
GdkDisplay
, orNone
if there is no default display- Return type:
Gdk.Display
orNone
Gets the default
GdkDisplay
.This is a convenience function for:
Gdk.DisplayManager.get_default_display
(Gdk.DisplayManager.get
())
- classmethod open(display_name)[source]¶
- Parameters:
display_name (
str
orNone
) – the name of the display to open- Returns:
a
GdkDisplay
- Return type:
Gdk.Display
orNone
Opens a display.
If opening the display fails,
NULL
is returned.
- close()[source]¶
Closes the connection to the windowing system for the given display.
This cleans up associated resources.
- create_gl_context()[source]¶
- Raises:
- Returns:
the newly created
GdkGLContext
- Return type:
Creates a new
GdkGLContext
for theGdkDisplay
.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 returnedGdkGLContext
, you will need to call [method`Gdk`.GLContext.make_current] or [method`Gdk`.GLContext.realize].New in version 4.6.
- device_is_grabbed(device)[source]¶
- Parameters:
device (
Gdk.Device
) – aGdkDevice
- Returns:
True
if there is a grab in effect for device.- Return type:
Returns
True
if there is an ongoing grab on device for self.
- flush()[source]¶
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.
- get_app_launch_context()[source]¶
- Returns:
a new
GdkAppLaunchContext
for self- Return type:
Returns a
GdkAppLaunchContext
suitable for launching applications on the given display.
- get_clipboard()[source]¶
- Returns:
the display’s clipboard
- Return type:
Gets the clipboard used for copy/paste operations.
- get_default_seat()[source]¶
-
Returns the default
GdkSeat
for this display.Note that a display may not have a seat. In this case, this function will return
None
.
- get_monitor_at_surface(surface)[source]¶
- Parameters:
surface (
Gdk.Surface
) – aGdkSurface
- Returns:
the monitor with the largest overlap with surface
- Return type:
Gdk.Monitor
orNone
Gets the monitor in which the largest area of surface resides.
- get_monitors()[source]¶
- Returns:
a
GListModel
ofGdkMonitor
- Return type:
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
Gio.ListModel
::items-changed
signal on this list to monitor changes to the monitor of this display.
- get_name()[source]¶
- Returns:
a string representing the display name. This string is owned by GDK and should not be modified or freed.
- Return type:
Gets the name of the display.
- get_primary_clipboard()[source]¶
- Returns:
the primary clipboard
- Return type:
Gets the clipboard used for the primary selection.
On backends where the primary clipboard is not supported natively, GDK emulates this clipboard locally.
- get_setting(name, value)[source]¶
- Parameters:
name (
str
) – the name of the settingvalue (
GObject.Value
) – location to store the value of the setting
- Returns:
True
if the setting existed and a value was stored in value,False
otherwise- Return type:
Retrieves a desktop-wide setting such as double-click time for the self.
- get_startup_notification_id()[source]¶
-
Gets the startup notification ID for a Wayland display, or
None
if no ID has been defined.Deprecated since version 4.10.
- is_composited()[source]¶
- Returns:
Whether surfaces with RGBA visuals can reasonably be expected to have their alpha channels drawn correctly on the screen.
- Return type:
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 self.
On modern displays, this value is always
True
.
- is_rgba()[source]¶
- Returns:
True
if surfaces are created with an alpha channel orFalse
if the display does not support this functionality.- Return type:
Returns whether surfaces on this self 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
.
- list_seats()[source]¶
- Returns:
the list of seats known to the
GdkDisplay
- Return type:
[
Gdk.Seat
]
Returns the list of seats known to self.
- map_keycode(keycode)[source]¶
- Parameters:
keycode (
int
) – a keycode- Returns:
True
if there were any entries- keys:
return location for array of
GdkKeymapKey
- keyvals:
return location for array of keyvals
- Return type:
(
bool
, keys: [Gdk.KeymapKey
], keyvals: [int
])
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
GLib.free
().
- map_keyval(keyval)[source]¶
- Parameters:
keyval (
int
) – a keyval, such asGdk.KEY_a
,Gdk.KEY_Up
,Gdk.KEY_Return
, etc.- Returns:
True
if keys were found and returned- keys:
return location for an array of
GdkKeymapKey
- Return type:
(
bool
, keys: [Gdk.KeymapKey
])
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
GLib.free
().
- notify_startup_complete(startup_id)[source]¶
- Parameters:
startup_id (
str
) – a startup-notification identifier, for which notification process should be completed
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.
Deprecated since version 4.10: Using [method`Gdk`.Toplevel.set_startup_id] is sufficient
- prepare_gl()[source]¶
- Raises:
- Returns:
True
if the display supports OpenGL- Return type:
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.
New in version 4.4.
- put_event(event)[source]¶
- Parameters:
event (
Gdk.Event
) – aGdkEvent
Adds the given event to the event queue for self.
Deprecated since version 4.10: This function is only useful in very special situations and should not be used by applications.
- supports_input_shapes()[source]¶
-
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 self.
On modern displays, this value is always
True
.
- sync()[source]¶
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.
- translate_key(keycode, state, group)[source]¶
- Parameters:
keycode (
int
) – a keycodestate (
Gdk.ModifierType
) – a modifier stategroup (
int
) – active keyboard group
- Returns:
True
if there was a keyval bound to keycode/state/group.- keyval:
return location for keyval
- effective_group:
return location for effective group
- level:
return location for level
- consumed:
return location for modifiers that were used to determine the group or level
- Return type:
(
bool
, keyval:int
, effective_group:int
, level:int
, consumed:Gdk.ModifierType
)
Translates the contents of a
GdkEventKey
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 out from 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.
Signal Details¶
- Gdk.Display.signals.closed(display, is_error)¶
- Signal Name:
closed
- Flags:
- Parameters:
display (
Gdk.Display
) – The object which received the signalis_error (
bool
) –True
if the display was closed due to an error
Emitted when the connection to the windowing system for display is closed.
- Gdk.Display.signals.opened(display)¶
- Signal Name:
opened
- Flags:
- Parameters:
display (
Gdk.Display
) – The object which received the signal
Emitted when the connection to the windowing system for display is opened.
- Gdk.Display.signals.seat_added(display, seat)¶
- Signal Name:
seat-added
- Flags:
- Parameters:
display (
Gdk.Display
) – The object which received the signalseat (
Gdk.Seat
) – the seat that was just added
Emitted whenever a new seat is made known to the windowing system.
- Gdk.Display.signals.seat_removed(display, seat)¶
- Signal Name:
seat-removed
- Flags:
- Parameters:
display (
Gdk.Display
) – The object which received the signalseat (
Gdk.Seat
) – the seat that was just removed
Emitted whenever a seat is removed by the windowing system.
- Gdk.Display.signals.setting_changed(display, setting)¶
- Signal Name:
setting-changed
- Flags:
- Parameters:
display (
Gdk.Display
) – The object which received the signalsetting (
str
) – the name of the setting that changed
Emitted whenever a setting changes its value.