Gdk.Display¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
Fields¶
- Inherited:
Class Details¶
- class Gdk.Display(**kwargs)¶
- Bases:
- Abstract:
No
Gdk.Display
objects purpose are two fold:To manage and provide information about input devices (pointers and keyboards)
To manage and provide information about the available
Gdk.Screens
Gdk.Display
objects are the GDK representation of an X Display, which can be described as a workstation consisting of a keyboard, a pointing device (such as a mouse) and one or more screens. It is used to open and keep track of variousGdk.Screen
objects currently instantiated by the application. It is also used to access the keyboard(s) and mouse pointer(s) of the display.Most of the input device handling has been factored out into the separate
Gdk.DeviceManager
object. Every display has a device manager, which you can obtain usingGdk.Display.get_device_manager
().- classmethod get_default()[source]¶
- Returns:
a
Gdk.Display
, orNone
if there is no default display.- Return type:
Gdk.Display
orNone
Gets the default
Gdk.Display
. This is a convenience function for:gdk_display_manager_get_default_display (gdk_display_manager_get ())
.New in version 2.2.
- classmethod open(display_name)[source]¶
- Parameters:
display_name (
str
) – the name of the display to open- Returns:
a
Gdk.Display
, orNone
if the display could not be opened- Return type:
Gdk.Display
orNone
Opens a display.
New in version 2.2.
- classmethod open_default_libgtk_only()[source]¶
- Returns:
the default display, if it could be opened, otherwise
None
.- Return type:
Gdk.Display
orNone
Opens the default display specified by command line arguments or environment variables, sets it as the default display, and returns it.
Gdk.parse_args
() must have been called first. If the default display has previously been set, simply returns that. An internal function that should not be used by applications.Deprecated since version 3.16: This symbol was never meant to be used outside of GTK+
- close()[source]¶
Closes the connection to the windowing system for the given display, and cleans up associated resources.
New in version 2.2.
- device_is_grabbed(device)[source]¶
- Parameters:
device (
Gdk.Device
) – aGdk.Device
- 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.
New in version 2.4.
- get_app_launch_context()[source]¶
- Returns:
a new
Gdk.AppLaunchContext
for self. Free withGObject.Object.unref
() when done- Return type:
Returns a
Gdk.AppLaunchContext
suitable for launching applications on the given display.New in version 3.0.
- get_default_cursor_size()[source]¶
- Returns:
the default cursor size.
- Return type:
Returns the default size to use for cursors on self.
New in version 2.4.
- get_default_group()[source]¶
- Returns:
The default group leader window for self
- Return type:
Returns the default group leader window for all toplevel windows on self. This window is implicitly created by GDK. See
Gdk.Window.set_group
().New in version 2.4.
- get_default_screen()[source]¶
- Returns:
the default
Gdk.Screen
object for self- Return type:
Get the default
Gdk.Screen
for self.New in version 2.2.
- get_default_seat()[source]¶
- Returns:
the default seat.
- Return type:
Returns the default
Gdk.Seat
for this display.New in version 3.20.
- get_device_manager()[source]¶
- Returns:
A
Gdk.DeviceManager
, orNone
. This memory is owned by GDK and must not be freed or unreferenced.- Return type:
Returns the
Gdk.DeviceManager
associated to self.New in version 3.0.
Deprecated since version 3.20.: Use
Gdk.Display.get_default_seat
() andGdk.Seat
operations.
- get_event()[source]¶
- Returns:
the next
Gdk.Event
to be processed, orNone
if no events are pending. The returnedGdk.Event
should be freed withGdk.Event.free
().- Return type:
Gets the next
Gdk.Event
to be processed for self, fetching events from the windowing system if necessary.New in version 2.2.
- get_maximal_cursor_size()[source]¶
- Returns:
- width:
the return location for the maximal cursor width
- height:
the return location for the maximal cursor height
- Return type:
Gets the maximal size to use for cursors on self.
New in version 2.4.
- get_monitor(monitor_num)[source]¶
- Parameters:
monitor_num (
int
) – number of the monitor- Returns:
the
Gdk.Monitor
, orNone
if monitor_num is not a valid monitor number- Return type:
Gdk.Monitor
orNone
Gets a monitor associated with this display.
New in version 3.22.
- get_monitor_at_point(x, y)[source]¶
- Parameters:
- Returns:
the monitor containing the point
- Return type:
Gets the monitor in which the point (x, y) is located, or a nearby monitor if the point is not in any monitor.
New in version 3.22.
- get_monitor_at_window(window)[source]¶
- Parameters:
window (
Gdk.Window
) – aGdk.Window
- Returns:
the monitor with the largest overlap with window
- Return type:
Gets the monitor in which the largest area of window resides, or a monitor close to window if it is outside of all monitors.
New in version 3.22.
- get_n_monitors()[source]¶
- Returns:
the number of monitors
- Return type:
Gets the number of monitors that belong to self.
The returned number is valid until the next emission of the
Gdk.Display
::monitor-added
orGdk.Display
::monitor-removed
signal.New in version 3.22.
- get_n_screens()[source]¶
- Returns:
number of screens.
- Return type:
Gets the number of screen managed by the self.
New in version 2.2.
Deprecated since version 3.10: The number of screens is always 1.
- 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.
New in version 2.2.
- get_pointer()[source]¶
- Returns:
- Return type:
(screen:
Gdk.Screen
, x:int
, y:int
, mask:Gdk.ModifierType
)
Gets the current location of the pointer and the current modifier mask for a given display.
New in version 2.2.
Deprecated since version 3.0: Use
Gdk.Device.get_position
() instead.
- get_primary_monitor()[source]¶
- Returns:
the primary monitor, or
None
if no primary monitor is configured by the user- Return type:
Gdk.Monitor
orNone
Gets the primary monitor for the display.
The primary monitor is considered the monitor where the “main desktop” lives. While normal application windows typically allow the window manager to place the windows, specialized desktop applications such as panels should place themselves on the primary monitor.
New in version 3.22.
- get_screen(screen_num)[source]¶
- Parameters:
screen_num (
int
) – the screen number- Returns:
the
Gdk.Screen
object- Return type:
Returns a screen object for one of the screens of the display.
New in version 2.2.
Deprecated since version 3.20: There is only one screen; use
Gdk.Display.get_default_screen
() to get it.
- get_window_at_pointer()[source]¶
- Returns:
the window under the mouse pointer, or
None
- Return type:
(
Gdk.Window
orNone
, win_x:int
, win_y:int
)
Obtains the window underneath the mouse pointer, returning the location of the pointer in that window in win_x, win_y for screen. Returns
None
if the window under the mouse pointer is not known to GDK (for example, belongs to another application).New in version 2.2.
Deprecated since version 3.0: Use
Gdk.Device.get_window_at_position
() instead.
- has_pending()[source]¶
-
Returns whether the display has events that are waiting to be processed.
New in version 3.0.
- keyboard_ungrab(time_)[source]¶
- Parameters:
time (
int
) – a timestap (e.gGdk.CURRENT_TIME
).
Release any keyboard grab
New in version 2.2.
Deprecated since version 3.0: Use
Gdk.Device.ungrab
(), together withGdk.Device.grab
() instead.
- list_devices()[source]¶
- Returns:
a list of
Gdk.Device
- Return type:
Returns the list of available input devices attached to self. The list is statically allocated and should not be freed.
New in version 2.2.
Deprecated since version 3.0: Use
Gdk.DeviceManager.list_devices
() instead.
- list_seats()[source]¶
- Returns:
the list of seats known to the
Gdk.Display
- Return type:
[
Gdk.Seat
]
Returns the list of seats known to self.
New in version 3.20.
- 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.
New in version 3.0.
- peek_event()[source]¶
- Returns:
a copy of the first
Gdk.Event
on the event queue, orNone
if no events are in the queue. The returnedGdk.Event
should be freed withGdk.Event.free
().- Return type:
Gets a copy of the first
Gdk.Event
in the self’s event queue, without removing the event from the queue. (Note that this function will not get more events from the windowing system. It only checks the events that have already been moved to the GDK event queue.)New in version 2.2.
- pointer_is_grabbed()[source]¶
-
Test if the pointer is grabbed.
New in version 2.2.
Deprecated since version 3.0: Use
Gdk.Display.device_is_grabbed
() instead.
- pointer_ungrab(time_)[source]¶
- Parameters:
time (
int
) – a timestap (e.g.Gdk.CURRENT_TIME
).
Release any pointer grab.
New in version 2.2.
Deprecated since version 3.0: Use
Gdk.Device.ungrab
(), together withGdk.Device.grab
() instead.
- put_event(event)[source]¶
-
Appends a copy of the given event onto the front of the event queue for self.
New in version 2.2.
- request_selection_notification(selection)[source]¶
- Parameters:
selection (
Gdk.Atom
) – theGdk.Atom
naming the selection for which ownership change notification is requested- Returns:
whether
Gdk.EventOwnerChange
events will be sent.- Return type:
Request
Gdk.EventOwnerChange
events for ownership changes of the selection named by the given atom.New in version 2.6.
- set_double_click_distance(distance)[source]¶
- Parameters:
distance (
int
) – distance in pixels
Sets the double click distance (two clicks within this distance count as a double click and result in a
Gdk.EventType._2BUTTON_PRESS
event). See alsoGdk.Display.set_double_click_time
(). Applications should not set this, it is a global user-configured setting.New in version 2.4.
- set_double_click_time(msec)[source]¶
- Parameters:
msec (
int
) – double click time in milliseconds (thousandths of a second)
Sets the double click time (two clicks within this time interval count as a double click and result in a
Gdk.EventType._2BUTTON_PRESS
event). Applications should not set this, it is a global user-configured setting.New in version 2.2.
- store_clipboard(clipboard_window, time_, targets)[source]¶
- Parameters:
clipboard_window (
Gdk.Window
) – aGdk.Window
belonging to the clipboard ownertime (
int
) – a timestamptargets ([
Gdk.Atom
] orNone
) – an array of targets that should be saved, orNone
if all available targets should be saved.
Issues a request to the clipboard manager to store the clipboard data. On X11, this is a special program that works according to the FreeDesktop Clipboard Specification.
New in version 2.6.
- supports_clipboard_persistence()[source]¶
-
Returns whether the speicifed display supports clipboard persistance; i.e. if it’s possible to store the clipboard data after an application has quit. On X11 this checks if a clipboard daemon is running.
New in version 2.6.
- supports_composite()[source]¶
-
Returns
True
ifGdk.Window.set_composited
() can be used to redirect drawing on the window using compositing.Currently this only works on X11 with XComposite and XDamage extensions available.
New in version 2.12.
Deprecated since version 3.16: Compositing is an outdated technology that only ever worked on X11.
- supports_cursor_alpha()[source]¶
- Returns:
whether cursors can have alpha channels.
- Return type:
Returns
True
if cursors can use an 8bit alpha channel on self. Otherwise, cursors are restricted to bilevel alpha (i.e. a mask).New in version 2.4.
- supports_cursor_color()[source]¶
- Returns:
whether cursors can have multiple colors.
- Return type:
Returns
True
if multicolored cursors are supported on self. Otherwise, cursors have only a forground and a background color.New in version 2.4.
- supports_input_shapes()[source]¶
-
Returns
True
if gdk_window_input_shape_combine_mask() can be used to modify the input shape of windows on self.New in version 2.10.
- supports_selection_notification()[source]¶
- Returns:
whether
Gdk.EventOwnerChange
events will be sent.- Return type:
Returns whether
Gdk.EventOwnerChange
events will be sent when the owner of a selection changes.New in version 2.6.
- supports_shapes()[source]¶
-
Returns
True
if gdk_window_shape_combine_mask() can be used to create shaped windows on self.New in version 2.10.
- 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
Gdk.Display.sync
() beforeGdk.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.
New in version 2.2.
- warp_pointer(screen, x, y)[source]¶
- Parameters:
screen (
Gdk.Screen
) – the screen of self to warp the pointer tox (
int
) – the x coordinate of the destinationy (
int
) – the y coordinate of the destination
Warps the pointer of self to the point x,`y` on the screen screen, unless the pointer is confined to a window by a grab, in which case it will be moved as far as allowed by the grab. Warping the pointer creates events as if the user had moved the mouse instantaneously to the destination.
Note that the pointer should normally be under the control of the user. This function was added to cover some rare use cases like keyboard navigation support for the color picker in the #GtkColorSelectionDialog.
New in version 2.8.
Deprecated since version 3.0: Use
Gdk.Device.warp
() instead.
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
The
::closed
signal is emitted when the connection to the windowing system for display is closed.New in version 2.2.
- Gdk.Display.signals.monitor_added(display, monitor)¶
- Signal Name:
monitor-added
- Flags:
- Parameters:
display (
Gdk.Display
) – The object which received the signalmonitor (
Gdk.Monitor
) – the monitor that was just added
The
::monitor-added
signal is emitted whenever a monitor is added.New in version 3.22.
- Gdk.Display.signals.monitor_removed(display, monitor)¶
- Signal Name:
monitor-removed
- Flags:
- Parameters:
display (
Gdk.Display
) – The object which received the signalmonitor (
Gdk.Monitor
) – the monitor that was just removed
The
::monitor-removed
signal is emitted whenever a monitor is removed.New in version 3.22.
- Gdk.Display.signals.opened(display)¶
- Signal Name:
opened
- Flags:
- Parameters:
display (
Gdk.Display
) – The object which received the signal
The
::opened
signal is 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
The
::seat-added
signal is emitted whenever a new seat is made known to the windowing system.New in version 3.20.
- 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
The
::seat-removed
signal is emitted whenever a seat is removed by the windowing system.New in version 3.20.