GdkX11.X11Display

g GObject.Object GObject.Object Gdk.Display Gdk.Display GObject.Object->Gdk.Display GdkX11.X11Display GdkX11.X11Display Gdk.Display->GdkX11.X11Display

Subclasses:

None

Methods

Inherited:

Gdk.Display (28), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

open (display_name)

class

set_program_class (display, program_class)

error_trap_pop ()

error_trap_pop_ignored ()

error_trap_push ()

get_default_group ()

get_egl_display ()

get_egl_version ()

get_glx_version ()

get_primary_monitor ()

get_screen ()

get_startup_notification_id ()

get_user_time ()

get_xcursor (cursor)

get_xdisplay ()

get_xrootwindow ()

get_xscreen ()

grab ()

set_cursor_theme (theme, size)

set_startup_notification_id (startup_id)

set_surface_scale (scale)

string_to_compound_text (str)

text_property_to_text_list (encoding, format, text, length, list)

ungrab ()

utf8_to_compound_text (str)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Inherited:

Gdk.Display (3)

Signals

Inherited:

Gdk.Display (5), GObject.Object (1)

Name

Short Description

xevent

The ::xevent signal is a low level signal that is emitted whenever an xlib.XEvent has been received.

Fields

Inherited:

Gdk.Display (5), GObject.Object (1)

Class Details

class GdkX11.X11Display(**kwargs)
Bases:

Gdk.Display

Abstract:

No

Structure:

GdkX11.X11DisplayClass

classmethod open(display_name)[source]
Parameters:

display_name (str or None) – name of the X display. See the xlib.open_display() for details.

Returns:

The new display

Return type:

Gdk.Display or None

Tries to open a new display to the X server given by display_name. If opening the display fails, None is returned.

classmethod set_program_class(display, program_class)[source]
Parameters:
  • display (Gdk.Display) – a GdkDisplay

  • program_class (str) – a string

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.

error_trap_pop()[source]
Returns:

X error code or 0 on success

Return type:

int

Pops the error trap pushed by GdkX11.X11Display.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, GdkX11.X11Display.error_trap_pop_ignored() would be more efficient.

error_trap_pop_ignored()[source]

Pops the error trap pushed by GdkX11.X11Display.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()[source]

Begins a range of X requests on self for which X error events will be ignored. Unignored errors (when no trap is pushed) will abort the application. Use GdkX11.X11Display.error_trap_pop() or GdkX11.X11Display.error_trap_pop_ignored()to lift a trap pushed with this function.

get_default_group()[source]
Returns:

The default group leader surface for self

Return type:

Gdk.Surface

Returns the default group leader surface for all toplevel surfaces on self. This surface is implicitly created by GDK. See GdkX11.X11Surface.set_group().

get_egl_display()[source]
Returns:

the EGL display object

Return type:

object or None

Retrieves the EGL display connection object for the given GDK display.

This function returns NULL if GDK is using GLX.

New in version 4.4.

get_egl_version()[source]
Returns:

True if EGL is available

major:

return location for the EGL major version

minor:

return location for the EGL minor version

Return type:

(bool, major: int, minor: int)

Retrieves the version of the EGL implementation.

New in version 4.4.

get_glx_version()[source]
Returns:

True if GLX is available

major:

return location for the GLX major version

minor:

return location for the GLX minor version

Return type:

(bool, major: int, minor: int)

Retrieves the version of the GLX implementation.

get_primary_monitor()[source]
Returns:

the primary monitor, or any monitor if no primary monitor is configured by the user

Return type:

Gdk.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_screen()[source]
Returns:

the GdkX11Screen

Return type:

GdkX11.X11Screen

Retrieves the GdkX11Screen of the self.

get_startup_notification_id()[source]
Returns:

the startup notification ID for self

Return type:

str

Gets the startup notification ID for a display.

Deprecated since version 4.10.

get_user_time()[source]
Returns:

the timestamp of the last user interaction

Return type:

int

Returns the timestamp of the last user interaction on self. The timestamp is taken from events caused by user interaction such as key presses or pointer movements. See GdkX11.X11Surface.set_user_time().

get_xcursor(cursor)[source]
Parameters:

cursor (Gdk.Cursor) – a GdkCursor

Returns:

an Xlib Cursor.

Return type:

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.

get_xdisplay()[source]
Returns:

an X display

Return type:

xlib.Display

Returns the X display of a GdkDisplay.

get_xrootwindow()[source]
Returns:

an X Window

Return type:

int

Returns the root X window used by GdkDisplay.

get_xscreen()[source]
Returns:

an X xlib.Screen

Return type:

xlib.Screen

Returns the X xlib.Screen used by GdkDisplay.

grab()[source]

Call XGrabServer() on self. To ungrab the display again, use GdkX11.X11Display.ungrab().

GdkX11.X11Display.grab()/GdkX11.X11Display.ungrab() calls can be nested.

set_cursor_theme(theme, size)[source]
Parameters:
  • theme (str or None) – the name of the cursor theme to use, or None to unset a previously set value

  • size (int) – the cursor size to use, or 0 to keep the previous size

Sets the cursor theme from which the images for cursor should be taken.

If the windowing system supports it, existing cursors created with [ctor`Gdk`.Cursor.new_from_name] are updated to reflect the theme change. Custom cursors constructed with [ctor`Gdk`.Cursor.new_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 corresponding GtkSetting).

set_startup_notification_id(startup_id)[source]
Parameters:

startup_id (str) – the startup notification ID (must be valid utf8)

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 Gdk.Display.notify_startup_complete()).

Deprecated since version 4.10: Using [method`Gdk`.Toplevel.set_startup_id] is sufficient

set_surface_scale(scale)[source]
Parameters:

scale (int) – The new scale value

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.

string_to_compound_text(str)[source]
Parameters:

str (str) – a nul-terminated string

Returns:

0 upon success, non-zero upon failure

encoding:

location to store the encoding (to be used as the type for the property)

format:

location to store the format of the property

ctext:

location to store newly allocated data for the property

Return type:

(int, encoding: str, format: int, ctext: bytes)

Convert a string from the encoding of the current locale into a form suitable for storing in a window property.

text_property_to_text_list(encoding, format, text, length, list)[source]
Parameters:
  • encoding (str) – 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 (int) – the format of the property

  • text (int) – The text data

  • length (int) – The number of items to transform

  • list (str) – location to store an array of strings in the encoding of the current locale. This array should be freed using GdkX11.x11_free_text_list().

Returns:

the number of strings stored in list, or 0, if the conversion failed

Return type:

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.)

ungrab()[source]

Ungrab self after it has been grabbed with GdkX11.X11Display.grab().

utf8_to_compound_text(str)[source]
Parameters:

str (str) – a UTF-8 string

Returns:

True if the conversion succeeded, otherwise False

encoding:

location to store resulting encoding

format:

location to store format of the result

ctext:

location to store the data of the result

Return type:

(bool, encoding: str, format: int, ctext: bytes)

Converts from UTF-8 to compound text.

Signal Details

GdkX11.X11Display.signals.xevent(x11_display, xevent)
Signal Name:

xevent

Flags:

RUN_LAST

Parameters:
Returns:

True to stop other handlers from being invoked for the event. False to propagate the event further.

Return type:

bool

The ::xevent signal is a low level signal that is emitted whenever an xlib.XEvent has been received.

When handlers to this signal return True, no other handlers will be invoked. In particular, the default handler for this function is GDK’s own event handling mechanism, so by returning True for an event that GDK expects to translate, you may break GDK and/or GTK+ in interesting ways. You have been warned.

If you want this signal handler to queue a GdkEvent, you can use Gdk.Display.put_event().

If you are interested in X GenericEvents, bear in mind that XGetEventData() has been already called on the event, and XFreeEventData() will be called afterwards.