Class: GdkX11::X11Display

Inherits:
Gdk::Display show all
Defined in:
(unknown)

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Gdk::Display

#app_launch_context, #beep, #clipboard, #close, #composited=, #composited?, #create_gl_context, default, #default_seat, #device_is_grabbed, #dmabuf_formats, #dmabuf_formats=, #flush, #get_monitor_at_surface, #get_setting, #input_shapes=, #input_shapes?, #is_closed, #is_composited, #is_rgba, #list_seats, #map_keycode, #map_keyval, #monitors, #name, #notify_startup_complete, #prepare_gl, #primary_clipboard, #put_event, #rgba=, #rgba?, #shadow_width=, #shadow_width?, #supports_input_shapes, #supports_shadow_width, #sync, #translate_key

Class Method Details

.open(display_name) ⇒ Gdk::Display

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

Parameters:

  • display_name (String)

    name of the X display. See the XOpenDisplay() for details.

Returns:

.set_program_class(display, program_class) ⇒ nil

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:

  • display (Gdk::Display)

    a GdkDisplay

  • program_class (String)

    a string

Returns:

  • (nil)

Instance Method Details

#broadcast_startup_message(message_type, array) ⇒ nil

Sends a startup notification message of type message_type to display.

This is a convenience function for use by code that implements the freedesktop startup notification specification. Applications should not normally need to call it directly. See the Startup Notification Protocol specification for definitions of the message types and keys that can be used. or "remove") nil key. (A nil value for a key will cause that key to be skipped in the output.)

Parameters:

  • message_type (String)

    startup notification message type ("new", "change",

  • array (Array)

    a list of key/value pairs (as strings), terminated by a

Returns:

  • (nil)

#default_groupGdk::Surface

Returns the default group leader surface for all toplevel surfaces on display. This surface is implicitly created by GDK. See gdk_x11_surface_set_group(). for display

Returns:

#egl_displayGObject

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

This function returns NULL if GDK is using GLX.

Returns:

  • (GObject)

    the EGL display object

#error_trap_popInteger

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

Returns:

  • (Integer)

    X error code or 0 on success

#error_trap_pop_ignorednil

Pops the error trap pushed by gdk_x11_display_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.

Returns:

  • (nil)

#error_trap_pushnil

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. Use gdk_x11_display_error_trap_pop() or gdk_x11_display_error_trap_pop_ignored()to lift a trap pushed with this function.

Returns:

  • (nil)

#get_egl_version(major, minor) ⇒ Boolean

Retrieves the version of the EGL implementation.

Parameters:

  • major (Integer)

    return location for the EGL major version

  • minor (Integer)

    return location for the EGL minor version

Returns:

  • (Boolean)

    true if EGL is available

#get_glx_version(major, minor) ⇒ Boolean

Retrieves the version of the GLX implementation.

Parameters:

  • major (Integer)

    return location for the GLX major version

  • minor (Integer)

    return location for the GLX minor version

Returns:

  • (Boolean)

    true if GLX is available

#get_xcursor(cursor) ⇒ xlib::Cursor

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:

Returns:

  • (xlib::Cursor)

    an Xlib Cursor.

#grabnil

Call XGrabServer() on display. To ungrab the display again, use gdk_x11_display_ungrab().

gdk_x11_display_grab()/gdk_x11_display_ungrab() calls can be nested.

Returns:

  • (nil)

#primary_monitorGdk::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.

Returns:

  • (Gdk::Monitor)

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

#screenGdkX11::X11Screen

Retrieves the GdkX11Screen of the display.

Returns:

#set_cursor_theme(theme, size) ⇒ nil

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

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

Parameters:

  • theme (String)

    the name of the cursor theme to use, or nil to unset a previously set value

  • size (Integer)

    the cursor size to use, or 0 to keep the previous size

Returns:

  • (nil)

#startup_notification_idString

Gets the startup notification ID for a display.

Returns:

  • (String)

    the startup notification ID for display

#startup_notification_id=(startup_id) ⇒ nil

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

Parameters:

  • startup_id (String)

    the startup notification ID (must be valid utf8)

Returns:

  • (nil)

#string_to_compound_text(str, encoding, format, ctext, length) ⇒ Integer

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

Parameters:

  • str (String)

    a nul-terminated string

  • encoding (String)

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

  • format (Integer)

    location to store the format of the property

  • ctext (Array<Integer>)

    location to store newly allocated data for the property

  • length (Integer)

    the length of ctext, in bytes

Returns:

  • (Integer)

    0 upon success, non-zero upon failure

#surface_scale=(scale) ⇒ nil

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 (Integer)

    The new scale value

Returns:

  • (nil)

#text_property_to_text_list(encoding, format, text, length, list) ⇒ Integer

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 (String)

    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 (Integer)

    the format of the property

  • text (Integer)

    The text data

  • length (Integer)

    The number of items to transform

  • list (String)

    location to store an array of strings in the encoding of the current locale. This array should be freed using gdk_x11_free_text_list().

Returns:

  • (Integer)

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

#ungrabnil

Ungrab display after it has been grabbed with gdk_x11_display_grab().

Returns:

  • (nil)

#user_timeInteger

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. See gdk_x11_surface_set_user_time().

Returns:

  • (Integer)

    the timestamp of the last user interaction

#utf8_to_compound_text(str, encoding, format, ctext, length) ⇒ Boolean

Converts from UTF-8 to compound text.

Parameters:

  • str (String)

    a UTF-8 string

  • encoding (String)

    location to store resulting encoding

  • format (Integer)

    location to store format of the result

  • ctext (Array<Integer>)

    location to store the data of the result

  • length (Integer)

    location to store the length of the data stored in ctext

Returns:

  • (Boolean)

    true if the conversion succeeded, otherwise false

#xdisplayxlib::Display

Returns the X display of a GdkDisplay.

Returns:

  • (xlib::Display)

    an X display

#xrootwindowxlib::Window

Returns the root X window used by GdkDisplay.

Returns:

  • (xlib::Window)

    an X Window

#xscreenxlib::Screen

Returns the X Screen used by GdkDisplay.

Returns:

  • (xlib::Screen)

    an X Screen