X11Display#
- Constructors:
X11Display(**properties)
Methods#
- class X11Display
- error_trap_pop() int #
Pops the error trap pushed by
error_trap_push()
. Will XSync() if necessary and will always block until the error is known to have occurred or not occurred, so the error code can be returned.If you don’t need to use the return value,
error_trap_pop_ignored()
would be more efficient.
- error_trap_pop_ignored() None #
Pops the error trap pushed by
error_trap_push()
. Does not block to see if an error occurred; merely records the range of requests to ignore errors for, and ignores those errors if they arrive asynchronously.
- error_trap_push() None #
Begins a range of X requests on
display
for which X error events will be ignored. Unignored errors (when no trap is pushed) will abort the application. Useerror_trap_pop()
or :func:`~gi.repository.GdkX11.X11Display.error_trap_pop_ignored`to lift a trap pushed with this function.
- get_default_group() Surface #
Returns the default group leader surface for all toplevel surfaces on
display
. This surface is implicitly created by GDK. Seeset_group()
.
- get_egl_display() Any | None #
Retrieves the EGL display connection object for the given GDK display.
This function returns
NULL
if GDK is using GLX.Added in version 4.4.
- get_egl_version() Tuple[bool, int, int] #
Retrieves the version of the EGL implementation.
Added in version 4.4.
- get_primary_monitor() Monitor #
Gets the primary monitor for the display.
The primary monitor is considered the monitor where the “main desktop” lives. While normal application surfaces typically allow the window manager to place the surfaces, specialized desktop applications such as panels should place themselves on the primary monitor.
If no monitor is the designated primary monitor, any monitor (usually the first) may be returned.
- get_startup_notification_id() str #
Gets the startup notification ID for a display.
Deprecated since version 4.10: Please do not use it in newly written code
- get_user_time() int #
Returns the timestamp of the last user interaction on
display
. The timestamp is taken from events caused by user interaction such as key presses or pointer movements. Seeset_user_time()
.
- get_xcursor(cursor: Cursor) int #
Returns the X cursor belonging to a
GdkCursor
, potentially creating the cursor.Be aware that the returned cursor may not be unique to
cursor
. It may for example be shared with its fallback cursor. On old X servers that don’t support the XCursor extension, all cursors may even fall back to a few default cursors.- Parameters:
cursor – a
GdkCursor
- get_xdisplay() Display #
Returns the X display of a
GdkDisplay
.
- get_xscreen() Screen #
Returns the X Screen used by
GdkDisplay
.
- classmethod open() Display | None #
Tries to open a new display to the X server given by
display_name
. If opening the display fails,None
is returned.
- set_cursor_theme(theme: str | None, size: int) None #
Sets the cursor theme from which the images for cursor should be taken.
If the windowing system supports it, existing cursors created with
new_from_name
are updated to reflect the theme change. Custom cursors constructed withnew_from_texture
will have to be handled by the application (GTK applications can learn about cursor theme changes by listening for change notification for the correspondingGtkSetting
).Deprecated since version 4.16:
- Use the cursor-related properties of
GtkSettings to set the cursor theme
- Parameters:
theme – the name of the cursor theme to use, or
None
to unset a previously set valuesize – the cursor size to use, or 0 to keep the previous size
- classmethod set_program_class(program_class: str) None #
Sets the program class.
The X11 backend uses the program class to set the class name part of the
WM_CLASS
property on toplevel windows; see the ICCCM.- Parameters:
program_class – a string
- set_startup_notification_id(startup_id: str) None #
Sets the startup notification ID for a display.
This is usually taken from the value of the DESKTOP_STARTUP_ID environment variable, but in some cases (such as the application not being launched using exec()) it can come from other sources.
If the ID contains the string “_TIME” then the portion following that string is taken to be the X11 timestamp of the event that triggered the application to be launched and the GDK current event time is set accordingly.
The startup ID is also what is used to signal that the startup is complete (for example, when opening a window or when calling
notify_startup_complete()
).Deprecated since version 4.10: Using
set_startup_id
is sufficient- Parameters:
startup_id – the startup notification ID (must be valid utf8)
- set_surface_scale(scale: int) None #
Forces a specific window scale for all windows on this display, instead of using the default or user configured scale. This is can be used to disable scaling support by setting
scale
to 1, or to programmatically set the window scale.Once the scale is set by this call it will not change in response to later user configuration changes.
- Parameters:
scale – The new scale value
- string_to_compound_text(str: str) Tuple[int, str, int, list[int]] #
Convert a string from the encoding of the current locale into a form suitable for storing in a window property.
- Parameters:
str – a nul-terminated string
- text_property_to_text_list(encoding: str, format: int, text: int, length: int, list: str) int #
Convert a text string from the encoding as it is stored in a property into an array of strings in the encoding of the current locale. (The elements of the array represent the nul-separated elements of the original text string.)
- Parameters:
encoding – a string representing the encoding. The most common values for this are “STRING”, or “COMPOUND_TEXT”. This is value used as the type for the property
format – the format of the property
text – The text data
length – The number of items to transform
list – location to store an array of strings in the encoding of the current locale. This array should be freed using
x11_free_text_list()
.