X Window System Interaction

X Window System Interaction — X backend-specific functions

Functions

#define GDK_SURFACE_XID()
#define GDK_DISPLAY_XDISPLAY()
#define GDK_POINTER_TO_XID()
#define GDK_XID_TO_POINTER()
GdkDisplay * gdk_x11_lookup_xdisplay ()
guint32 gdk_x11_get_server_time ()
gint gdk_x11_device_get_id ()
GdkDevice * gdk_x11_device_manager_lookup ()
void gdk_disable_multidevice ()
GdkDisplay * gdk_x11_display_open ()
void gdk_x11_display_set_program_class ()
guint32 gdk_x11_display_get_user_time ()
void gdk_x11_display_broadcast_startup_message ()
const gchar * gdk_x11_display_get_startup_notification_id ()
void gdk_x11_display_set_startup_notification_id ()
Display * gdk_x11_display_get_xdisplay ()
Screen * gdk_x11_display_get_xscreen ()
Window gdk_x11_display_get_xrootwindow ()
Cursor gdk_x11_display_get_xcursor ()
void gdk_x11_display_grab ()
void gdk_x11_display_ungrab ()
void gdk_x11_display_error_trap_push ()
gint gdk_x11_display_error_trap_pop ()
void gdk_x11_display_error_trap_pop_ignored ()
void gdk_x11_display_set_cursor_theme ()
void gdk_x11_display_set_surface_scale ()
gboolean gdk_x11_display_get_glx_version ()
void gdk_x11_register_standard_event_type ()
int gdk_x11_screen_get_screen_number ()
Screen * gdk_x11_screen_get_xscreen ()
const char * gdk_x11_screen_get_window_manager_name ()
XID gdk_x11_screen_get_monitor_output ()
GdkX11Visual * gdk_x11_screen_lookup_visual ()
gboolean gdk_x11_screen_supports_net_wm_hint ()
guint32 gdk_x11_screen_get_number_of_desktops ()
guint32 gdk_x11_screen_get_current_desktop ()
GdkSurface * gdk_x11_surface_lookup_for_display ()
Window gdk_x11_surface_get_xid ()
void gdk_x11_surface_set_theme_variant ()
void gdk_x11_surface_set_user_time ()
void gdk_x11_surface_move_to_current_desktop ()
void gdk_x11_surface_move_to_desktop ()
guint32 gdk_x11_surface_get_desktop ()
void gdk_x11_surface_set_utf8_property ()
void gdk_x11_surface_set_frame_sync_enabled ()
gint gdk_x11_keymap_get_group_for_state ()
gboolean gdk_x11_keymap_key_is_modifier ()
Visual * gdk_x11_visual_get_xvisual ()
Atom gdk_x11_atom_to_xatom_for_display ()
GdkAtom gdk_x11_xatom_to_atom_for_display ()
Atom gdk_x11_get_xatom_by_name_for_display ()
const gchar * gdk_x11_get_xatom_name_for_display ()
void gdk_x11_set_sm_client_id ()
gint gdk_x11_display_text_property_to_text_list ()
void gdk_x11_free_text_list ()
gint gdk_x11_display_string_to_compound_text ()
gboolean gdk_x11_display_utf8_to_compound_text ()
void gdk_x11_free_compound_text ()

Includes

#include <gdk/gdkx.h>

Description

The functions in this section are specific to the GDK X11 backend. To use them, you need to include the &lt;gdk/gdkx.h> header and use the X11-specific pkg-config files to build your application (either gdk-x11-3.0 or gtk+-x11-3.0).

To make your code compile with other GDK backends, guard backend-specific calls by an ifdef as follows. Since GDK may be built with multiple backends, you should also check for the backend that is in use (e.g. by using the GDK_IS_X11_DISPLAY() macro).

#ifdef GDK_WINDOWING_X11
  if (GDK_IS_X11_DISPLAY (display))
    {
      // make X11-specific calls here
    }
  else
#endif
#ifdef GDK_WINDOWING_QUARTZ
  if (GDK_IS_QUARTZ_DISPLAY (display))
    {
      // make Quartz-specific calls here
    }
  else
#endif
  g_error ("Unsupported GDK backend");

Functions

GDK_SURFACE_XID()

#define GDK_SURFACE_XID(win)           (gdk_x11_surface_get_xid (win))

Returns the X window belonging to a GdkSurface.

Parameters

win

a GdkSurface.

 

Returns

the Xlib Window of win .


GDK_DISPLAY_XDISPLAY()

#define GDK_DISPLAY_XDISPLAY(display) (gdk_x11_display_get_xdisplay (display))

Returns the display of a GdkDisplay.

Parameters

display

a GdkDisplay

 

Returns

an Xlib Display*


GDK_POINTER_TO_XID()

#define GDK_POINTER_TO_XID(pointer) GPOINTER_TO_UINT(pointer)

Converts a gpointer back to an XID that was previously converted using GDK_XID_TO_POINTER().

Parameters

pointer

pointer to extract an XID from

 

GDK_XID_TO_POINTER()

#define GDK_XID_TO_POINTER(xid) GUINT_TO_POINTER(xid)

Converts an XID into a gpointer . This is useful with data structures that use pointer arguments such as GHashTable. Use GDK_POINTER_TO_XID() to convert the argument back to an XID.

Parameters

xid

XID to stuff into the pointer

 

gdk_x11_lookup_xdisplay ()

GdkDisplay *
gdk_x11_lookup_xdisplay (Display *xdisplay);

Find the GdkDisplay corresponding to xdisplay , if any exists.

Parameters

xdisplay

a pointer to an X Display

 

Returns

the GdkDisplay, if found, otherwise NULL.

[transfer none][type GdkX11Display]


gdk_x11_get_server_time ()

guint32
gdk_x11_get_server_time (GdkSurface *surface);

Routine to get the current X server time stamp.

Parameters

surface

a GdkSurface, used for communication with the server. The surface must have GDK_PROPERTY_CHANGE_MASK in its events mask or a hang will result.

[type GdkX11Surface]

Returns

the time stamp.


gdk_x11_device_get_id ()

gint
gdk_x11_device_get_id (GdkDevice *device);

Returns the device ID as seen by XInput2.

If gdk_disable_multidevice() has been called, this function will respectively return 2/3 for the core pointer and keyboard, (matching the IDs for the Virtual Core Pointer and Keyboard in XInput 2), but calling this function on any slave devices (i.e. those managed via XInput 1.x), will return 0.

Parameters

device

a GdkDevice.

[type GdkX11DeviceCore]

Returns

the XInput2 device ID.


gdk_x11_device_manager_lookup ()

GdkDevice *
gdk_x11_device_manager_lookup (GdkX11DeviceManagerCore *device_manager,
                               gint device_id);

Returns the GdkDevice that wraps the given device ID.

Parameters

device_manager

a GdkDeviceManager.

[type GdkX11DeviceManagerCore]

device_id

a device ID, as understood by the XInput2 protocol

 

Returns

The GdkDevice wrapping the device ID, or NULL if the given ID doesn’t currently represent a device.

[transfer none][allow-none][type GdkX11DeviceCore]


gdk_disable_multidevice ()

void
gdk_disable_multidevice (void);

Disables multidevice support in GDKs X11 backend. This call must happen prior to gdk_display_open(), gtk_init() or gtk_init_check() in order to take effect.

Most common GTK+ applications won’t ever need to call this. Only applications that do mixed GDK/Xlib calls could want to disable multidevice support if such Xlib code deals with input devices in any way and doesn’t observe the presence of XInput 2.


gdk_x11_display_open ()

GdkDisplay *
gdk_x11_display_open (const char *display_name);

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

Parameters

display_name

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

[allow-none]

Returns

The new display or NULL on error.

[nullable][transfer full]


gdk_x11_display_set_program_class ()

void
gdk_x11_display_set_program_class (GdkDisplay *display,
                                   const char *program_class);

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

a GdkDisplay

 

program_class

a string

 

gdk_x11_display_get_user_time ()

guint32
gdk_x11_display_get_user_time (GdkDisplay *display);

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

Parameters

display

a GdkDisplay.

[type GdkX11Display]

Returns

the timestamp of the last user interaction


gdk_x11_display_broadcast_startup_message ()

void
gdk_x11_display_broadcast_startup_message
                               (GdkDisplay *display,
                                const char *message_type,
                                ...);

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.

Parameters

display

a GdkDisplay.

[type GdkX11Display]

message_type

startup notification message type ("new", "change", or "remove")

 

...

a list of key/value pairs (as strings), terminated by a NULL key. (A NULL value for a key will cause that key to be skipped in the output.)

 

gdk_x11_display_get_startup_notification_id ()

const gchar *
gdk_x11_display_get_startup_notification_id
                               (GdkDisplay *display);

Gets the startup notification ID for a display.

Parameters

display

a GdkDisplay.

[type GdkX11Display]

Returns

the startup notification ID for display


gdk_x11_display_set_startup_notification_id ()

void
gdk_x11_display_set_startup_notification_id
                               (GdkDisplay *display,
                                const gchar *startup_id);

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

Parameters

display

a GdkDisplay.

[type GdkX11Display]

startup_id

the startup notification ID (must be valid utf8)

 

gdk_x11_display_get_xdisplay ()

Display *
gdk_x11_display_get_xdisplay (GdkDisplay *display);

Returns the X display of a GdkDisplay.

Parameters

display

a GdkDisplay.

[type GdkX11Display]

Returns

an X display.

[transfer none]


gdk_x11_display_get_xscreen ()

Screen *
gdk_x11_display_get_xscreen (GdkDisplay *display);

Returns the X Screen used by GdkDisplay.

Parameters

display

a GdkDisplay.

[type GdkX11Display]

Returns

an X Screen.

[transfer none]


gdk_x11_display_get_xrootwindow ()

Window
gdk_x11_display_get_xrootwindow (GdkDisplay *display);

Returns the root X window used by GdkDisplay.

Parameters

display

a GdkDisplay.

[type GdkX11Display]

Returns

an X Window


gdk_x11_display_get_xcursor ()

Cursor
gdk_x11_display_get_xcursor (GdkDisplay *display,
                             GdkCursor *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

display

a GdkDisplay.

[type GdkX11Display]

cursor

a GdkCursor.

 

Returns

an Xlib Cursor.


gdk_x11_display_grab ()

void
gdk_x11_display_grab (GdkDisplay *display);

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.

Parameters

display

a GdkDisplay.

[type GdkX11Display]

gdk_x11_display_ungrab ()

void
gdk_x11_display_ungrab (GdkDisplay *display);

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

Parameters

display

a GdkDisplay.

[type GdkX11Display]

gdk_x11_display_error_trap_push ()

void
gdk_x11_display_error_trap_push (GdkDisplay *display);

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.

See also gdk_error_trap_push() to push a trap on all displays.

Parameters

display

a GdkDisplay.

[type GdkX11Display]

gdk_x11_display_error_trap_pop ()

gint
gdk_x11_display_error_trap_pop (GdkDisplay *display);

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.

See gdk_error_trap_pop() for the all-displays-at-once equivalent.

Parameters

display

the display.

[type GdkX11Display]

Returns

X error code or 0 on success


gdk_x11_display_error_trap_pop_ignored ()

void
gdk_x11_display_error_trap_pop_ignored
                               (GdkDisplay *display);

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.

See gdk_error_trap_pop_ignored() for the all-displays-at-once equivalent.

Parameters

display

the display.

[type GdkX11Display]

gdk_x11_display_set_cursor_theme ()

void
gdk_x11_display_set_cursor_theme (GdkDisplay *display,
                                  const gchar *theme,
                                  const gint size);

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

If the windowing system supports it, existing cursors created with gdk_cursor_new(), gdk_cursor_new_for_display() and gdk_cursor_new_from_name() are updated to reflect the theme change. Custom cursors constructed with 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).

Parameters

display

a GdkDisplay.

[type GdkX11Display]

theme

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

 

size

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

 

gdk_x11_display_set_surface_scale ()

void
gdk_x11_display_set_surface_scale (GdkDisplay *display,
                                   gint scale);

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

display

the display.

[type GdkX11Display]

scale

The new scale value

 

gdk_x11_display_get_glx_version ()

gboolean
gdk_x11_display_get_glx_version (GdkDisplay *display,
                                 gint *major,
                                 gint *minor);

Retrieves the version of the GLX implementation.

Parameters

display

a GdkDisplay

 

major

return location for the GLX major version.

[out]

minor

return location for the GLX minor version.

[out]

Returns

TRUE if GLX is available


gdk_x11_register_standard_event_type ()

void
gdk_x11_register_standard_event_type (GdkDisplay *display,
                                      gint event_base,
                                      gint n_events);

Registers interest in receiving extension events with type codes between event_base and event_base + n_events - 1. The registered events must have the window field in the same place as core X events (this is not the case for e.g. XKB extension events).

GDK may register the events of some X extensions on its own.

This function should only be needed in unusual circumstances, e.g. when filtering XInput extension events on the root window.

Parameters

display

a GdkDisplay.

[type GdkX11Display]

event_base

first event type code to register

 

n_events

number of event type codes to register

 

gdk_x11_screen_get_screen_number ()

int
gdk_x11_screen_get_screen_number (GdkX11Screen *screen);

Returns the index of a GdkX11Screen.

Parameters

screen

a GdkX11Screen

 

Returns

the position of screen among the screens of its display


gdk_x11_screen_get_xscreen ()

Screen *
gdk_x11_screen_get_xscreen (GdkX11Screen *screen);

Returns the screen of a GdkX11Screen.

Parameters

screen

a GdkX11Screen

 

Returns

an Xlib Screen*.

[transfer none]


gdk_x11_screen_get_window_manager_name ()

const char *
gdk_x11_screen_get_window_manager_name
                               (GdkX11Screen *screen);

Returns the name of the window manager for screen .

Parameters

screen

a GdkX11Screen

 

Returns

the name of the window manager screen screen , or "unknown" if the window manager is unknown. The string is owned by GDK and should not be freed.


gdk_x11_screen_get_monitor_output ()

XID
gdk_x11_screen_get_monitor_output (GdkX11Screen *screen,
                                   gint monitor_num);

Gets the XID of the specified output/monitor. If the X server does not support version 1.2 of the RANDR extension, 0 is returned.

Parameters

screen

a GdkX11Screen

 

monitor_num

number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)

 

Returns

the XID of the monitor


gdk_x11_screen_lookup_visual ()

GdkX11Visual *
gdk_x11_screen_lookup_visual (GdkX11Screen *screen,
                              VisualID xvisualid);

Looks up the GdkVisual for a particular screen and X Visual ID.

Parameters

screen

a GdkX11Screen.

 

xvisualid

an X Visual ID.

 

Returns

the GdkVisual (owned by the screen object), or NULL if the visual ID wasn’t found.

[transfer none][type GdkX11Visual]


gdk_x11_screen_supports_net_wm_hint ()

gboolean
gdk_x11_screen_supports_net_wm_hint (GdkX11Screen *screen,
                                     GdkAtom property);

This function is specific to the X11 backend of GDK, and indicates whether the window manager supports a certain hint from the Extended Window Manager Hints specification.

When using this function, keep in mind that the window manager can change over time; so you shouldn’t use this function in a way that impacts persistent application state. A common bug is that your application can start up before the window manager does when the user logs in, and before the window manager starts gdk_x11_screen_supports_net_wm_hint() will return FALSE for every property. You can monitor the window_manager_changed signal on GdkX11Screen to detect a window manager change.

Parameters

screen

the relevant GdkX11Screen.

 

property

a property atom.

 

Returns

TRUE if the window manager supports property


gdk_x11_screen_get_number_of_desktops ()

guint32
gdk_x11_screen_get_number_of_desktops (GdkX11Screen *screen);

Returns the number of workspaces for screen when running under a window manager that supports multiple workspaces, as described in the Extended Window Manager Hints specification.

Parameters

screen

a GdkX11Screen

 

Returns

the number of workspaces, or 0 if workspaces are not supported


gdk_x11_screen_get_current_desktop ()

guint32
gdk_x11_screen_get_current_desktop (GdkX11Screen *screen);

Returns the current workspace for screen when running under a window manager that supports multiple workspaces, as described in the Extended Window Manager Hints specification.

Parameters

screen

a GdkX11Screen

 

Returns

the current workspace, or 0 if workspaces are not supported


gdk_x11_surface_lookup_for_display ()

GdkSurface *
gdk_x11_surface_lookup_for_display (GdkDisplay *display,
                                    Window window);

Looks up the GdkSurface that wraps the given native window handle.

Parameters

display

the GdkDisplay corresponding to the window handle.

[type GdkX11Display]

window

an Xlib Window

 

Returns

the GdkSurface wrapper for the native window, or NULL if there is none.

[transfer none][type GdkX11Surface]


gdk_x11_surface_get_xid ()

Window
gdk_x11_surface_get_xid (GdkSurface *surface);

Returns the X resource (surface) belonging to a GdkSurface.

Parameters

surface

a native GdkSurface.

[type GdkX11Surface]

Returns

the ID of drawable ’s X resource.


gdk_x11_surface_set_theme_variant ()

void
gdk_x11_surface_set_theme_variant (GdkSurface *surface,
                                   const char *variant);

GTK+ applications can request a dark theme variant. In order to make other applications - namely window managers using GTK+ for themeing - aware of this choice, GTK+ uses this function to export the requested theme variant as _GTK_THEME_VARIANT property on toplevel surfaces.

Note that this property is automatically updated by GTK+, so this function should only be used by applications which do not use GTK+ to create toplevel surfaces.

Parameters

surface

a GdkSurface.

[type GdkX11Surface]

variant

the theme variant to export

 

gdk_x11_surface_set_user_time ()

void
gdk_x11_surface_set_user_time (GdkSurface *surface,
                               guint32 timestamp);

The application can use this call to update the _NET_WM_USER_TIME property on a toplevel surface. This property stores an Xserver time which represents the time of the last user input event received for this surface. This property may be used by the window manager to alter the focus, stacking, and/or placement behavior of surfaces when they are mapped depending on whether the new surface was created by a user action or is a "pop-up" surface activated by a timer or some other event.

Note that this property is automatically updated by GDK, so this function should only be used by applications which handle input events bypassing GDK.

Parameters

surface

A toplevel GdkSurface.

[type GdkX11Surface]

timestamp

An XServer timestamp to which the property should be set

 

gdk_x11_surface_move_to_current_desktop ()

void
gdk_x11_surface_move_to_current_desktop
                               (GdkSurface *surface);

Moves the surface to the correct workspace when running under a window manager that supports multiple workspaces, as described in the Extended Window Manager Hints specification. Will not do anything if the surface is already on all workspaces.

Parameters

surface

a GdkSurface.

[type GdkX11Surface]

gdk_x11_surface_move_to_desktop ()

void
gdk_x11_surface_move_to_desktop (GdkSurface *surface,
                                 guint32 desktop);

Moves the surface to the given workspace when running unde a window manager that supports multiple workspaces, as described in the Extended Window Manager Hints specification.

Parameters

surface

a GdkSurface.

[type GdkX11Surface]

desktop

the number of the workspace to move the surface to

 

gdk_x11_surface_get_desktop ()

guint32
gdk_x11_surface_get_desktop (GdkSurface *surface);

Gets the number of the workspace surface is on.

Parameters

surface

a GdkSurface.

[type GdkX11Surface]

Returns

the current workspace of surface


gdk_x11_surface_set_utf8_property ()

void
gdk_x11_surface_set_utf8_property (GdkSurface *surface,
                                   const gchar *name,
                                   const gchar *value);

This function modifies or removes an arbitrary X11 window property of type UTF8_STRING. If the given surface is not a toplevel surface, it is ignored.

Parameters

surface

a GdkSurface.

[type GdkX11Surface]

name

Property name, will be interned as an X atom

 

value

Property value, or NULL to delete.

[allow-none]

gdk_x11_surface_set_frame_sync_enabled ()

void
gdk_x11_surface_set_frame_sync_enabled
                               (GdkSurface *surface,
                                gboolean frame_sync_enabled);

This function can be used to disable frame synchronization for a surface. Normally frame synchronziation will be enabled or disabled based on whether the system has a compositor that supports frame synchronization, but if the surface is not directly managed by the window manager, then frame synchronziation may need to be disabled. This is the case for a surface embedded via the XEMBED protocol.

Parameters

surface

a native GdkSurface.

[type GdkX11Surface]

frame_sync_enabled

whether frame-synchronization should be enabled

 

gdk_x11_keymap_get_group_for_state ()

gint
gdk_x11_keymap_get_group_for_state (GdkKeymap *keymap,
                                    guint state);

Extracts the group from the state field sent in an X Key event. This is only needed for code processing raw X events, since GdkEventKey directly includes an is_modifier field.

Parameters

keymap

a GdkX11Keymap.

[type GdkX11Keymap]

state

raw state returned from X

 

Returns

the index of the active keyboard group for the event


gdk_x11_keymap_key_is_modifier ()

gboolean
gdk_x11_keymap_key_is_modifier (GdkKeymap *keymap,
                                guint keycode);

Determines whether a particular key code represents a key that is a modifier. That is, it’s a key that normally just affects the keyboard state and the behavior of other keys rather than producing a direct effect itself. This is only needed for code processing raw X events, since GdkEventKey directly includes an is_modifier field.

Parameters

keymap

a GdkX11Keymap.

[type GdkX11Keymap]

keycode

the hardware keycode from a key event

 

Returns

TRUE if the hardware keycode is a modifier key


gdk_x11_visual_get_xvisual ()

Visual *
gdk_x11_visual_get_xvisual (GdkX11Visual *visual);

Returns the X visual belonging to a GdkVisual.

Parameters

visual

a GdkVisual.

[type GdkX11Visual]

Returns

an Xlib Visual*.

[transfer none]


gdk_x11_atom_to_xatom_for_display ()

Atom
gdk_x11_atom_to_xatom_for_display (GdkDisplay *display,
                                   GdkAtom atom);

Converts from a GdkAtom to the X atom for a GdkDisplay with the same string value. The special value NULL is converted to None.

Parameters

display

A GdkDisplay.

[type GdkX11Display]

atom

A GdkAtom, or NULL

 

Returns

the X atom corresponding to atom , or None


gdk_x11_xatom_to_atom_for_display ()

GdkAtom
gdk_x11_xatom_to_atom_for_display (GdkDisplay *display,
                                   Atom xatom);

Convert from an X atom for a GdkDisplay to the corresponding GdkAtom.

Parameters

display

A GdkDisplay.

[type GdkX11Display]

xatom

an X atom

 

Returns

the corresponding GdkAtom.

[transfer none]


gdk_x11_get_xatom_by_name_for_display ()

Atom
gdk_x11_get_xatom_by_name_for_display (GdkDisplay *display,
                                       const gchar *atom_name);

Returns the X atom for a GdkDisplay corresponding to atom_name . This function caches the result, so if called repeatedly it is much faster than XInternAtom(), which is a round trip to the server each time.

Parameters

display

a GdkDisplay.

[type GdkX11Display]

atom_name

a string

 

Returns

a X atom for a GdkDisplay


gdk_x11_get_xatom_name_for_display ()

const gchar *
gdk_x11_get_xatom_name_for_display (GdkDisplay *display,
                                    Atom xatom);

Returns the name of an X atom for its display. This function is meant mainly for debugging, so for convenience, unlike XAtomName() and the result doesn’t need to be freed.

Parameters

display

the GdkDisplay where xatom is defined.

[type GdkX11Display]

xatom

an X atom

 

Returns

name of the X atom; this string is owned by GDK, so it shouldn’t be modifed or freed.


gdk_x11_set_sm_client_id ()

void
gdk_x11_set_sm_client_id (const gchar *sm_client_id);

Sets the SM_CLIENT_ID property on the application’s leader window so that the window manager can save the application’s state using the X11R6 ICCCM session management protocol.

See the X Session Management Library documentation for more information on session management and the Inter-Client Communication Conventions Manual

Parameters

sm_client_id

the client id assigned by the session manager when the connection was opened, or NULL to remove the property.

 

gdk_x11_display_text_property_to_text_list ()

gint
gdk_x11_display_text_property_to_text_list
                               (GdkDisplay *display,
                                GdkAtom encoding,
                                gint format,
                                const guchar *text,
                                gint length,
                                gchar ***list);

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

display

The GdkDisplay where the encoding is defined.

[type GdkX11Display]

encoding

an atom 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 gdk_free_text_list().

 

Returns

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


gdk_x11_free_text_list ()

void
gdk_x11_free_text_list (gchar **list);

Frees the array of strings created by gdk_x11_display_text_property_to_text_list().

Parameters

list

the value stored in the list parameter by a call to gdk_x11_display_text_property_to_text_list().

 

gdk_x11_display_string_to_compound_text ()

gint
gdk_x11_display_string_to_compound_text
                               (GdkDisplay *display,
                                const gchar *str,
                                GdkAtom *encoding,
                                gint *format,
                                guchar **ctext,
                                gint *length);

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

Parameters

display

the GdkDisplay where the encoding is defined.

[type GdkX11Display]

str

a nul-terminated string

 

encoding

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

[out][transfer none]

format

location to store the format of the property.

[out]

ctext

location to store newly allocated data for the property.

[out][array length=length]

length

the length of ctext , in bytes

 

Returns

0 upon success, non-zero upon failure


gdk_x11_display_utf8_to_compound_text ()

gboolean
gdk_x11_display_utf8_to_compound_text (GdkDisplay *display,
                                       const gchar *str,
                                       GdkAtom *encoding,
                                       gint *format,
                                       guchar **ctext,
                                       gint *length);

Converts from UTF-8 to compound text.

Parameters

display

a GdkDisplay.

[type GdkX11Display]

str

a UTF-8 string

 

encoding

location to store resulting encoding.

[out]

format

location to store format of the result.

[out]

ctext

location to store the data of the result.

[out][array length=length]

length

location to store the length of the data stored in ctext

 

Returns

TRUE if the conversion succeeded, otherwise FALSE


gdk_x11_free_compound_text ()

void
gdk_x11_free_compound_text (guchar *ctext);

Frees the data returned from gdk_x11_display_string_to_compound_text().

Parameters

ctext

The pointer stored in ctext from a call to gdk_x11_display_string_to_compound_text().

 

Types and Values