1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
33 #include <X11/Xutil.h>
36 * SECTION:x_interaction
37 * @Short_description: X backend-specific functions
38 * @Title: X Window System Interaction
40 * The functions in this section are specific to the GDK X11 backend.
41 * To use them, you need to include the <literal><gdk/gdkx.h></literal>
42 * header and use the X11-specific pkg-config files to build your
43 * application (either <literal>gdk-x11-3.0</literal> or
44 * <literal>gtk+-x11-3.0</literal>).
46 * To make your code compile with other GDK backends, guard backend-specific
47 * calls by an ifdef as follows:
48 * <informalexample><programlisting>
49 * #ifdef GDK_WINDOWING_X11
50 * /<!---->* X11-specific calls here... *<!---->/
52 * </programlisting></informalexample>
56 #define __GDKX_H_INSIDE__
58 #include <gdk/x11/gdkx11window.h>
60 #undef __GDKX_H_INSIDE__
64 Display *gdk_x11_cursor_get_xdisplay (GdkCursor *cursor);
65 Cursor gdk_x11_cursor_get_xcursor (GdkCursor *cursor);
66 Display *gdk_x11_display_get_xdisplay (GdkDisplay *display);
67 Visual * gdk_x11_visual_get_xvisual (GdkVisual *visual);
68 Screen * gdk_x11_screen_get_xscreen (GdkScreen *screen);
69 int gdk_x11_screen_get_screen_number (GdkScreen *screen);
71 const char* gdk_x11_screen_get_window_manager_name (GdkScreen *screen);
73 #ifndef GDK_MULTIHEAD_SAFE
74 Window gdk_x11_get_default_root_xwindow (void);
75 Display *gdk_x11_get_default_xdisplay (void);
76 gint gdk_x11_get_default_screen (void);
80 * GDK_CURSOR_XDISPLAY:
81 * @cursor: a #GdkCursor.
83 * Returns the display of a #GdkCursor.
85 * Returns: an Xlib <type>Display*</type>.
87 #define GDK_CURSOR_XDISPLAY(cursor) (gdk_x11_cursor_get_xdisplay (cursor))
91 * @cursor: a #GdkCursor.
93 * Returns the X cursor belonging to a #GdkCursor.
95 * Returns: an Xlib <type>Cursor</type>.
97 #define GDK_CURSOR_XCURSOR(cursor) (gdk_x11_cursor_get_xcursor (cursor))
99 #define GDK_IS_DISPLAY_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), g_type_from_name ("GdkDisplayX11")))
101 #ifndef GDK_MULTIHEAD_SAFE
105 * Obtains the Xlib window id of the root window of the current screen.
107 #define GDK_ROOT_WINDOW() (gdk_x11_get_default_root_xwindow ())
110 #define GDK_DISPLAY_XDISPLAY(display) (gdk_x11_display_get_xdisplay (display))
113 * GDK_DISPLAY_XDISPLAY:
114 * @display: a #GdkDisplay.
116 * Returns the display of a #GdkDisplay.
118 * Returns: an Xlib <type>Display*</type>
120 #define GDK_SCREEN_XDISPLAY(screen) (gdk_x11_display_get_xdisplay (gdk_screen_get_display (screen)))
123 * GDK_SCREEN_XSCREEN:
124 * @screen: a #GdkScreen
126 * Returns the screen of a #GdkScreen.
128 * Returns: an Xlib <type>Screen*</type>.
130 #define GDK_SCREEN_XSCREEN(screen) (gdk_x11_screen_get_xscreen (screen))
133 * GDK_SCREEN_XNUMBER:
134 * @screen: a #GdkScreen
136 * Returns the index of a #GdkScreen.
138 * Returns: the position of @screen among the screens of
141 #define GDK_SCREEN_XNUMBER(screen) (gdk_x11_screen_get_screen_number (screen))
143 #define GDK_VISUAL_XVISUAL(visual) (gdk_x11_visual_get_xvisual (visual))
145 GdkVisual* gdk_x11_screen_lookup_visual (GdkScreen *screen,
148 guint32 gdk_x11_display_get_user_time (GdkDisplay *display);
150 G_CONST_RETURN gchar *gdk_x11_display_get_startup_notification_id (GdkDisplay *display);
151 void gdk_x11_display_set_startup_notification_id (GdkDisplay *display,
152 const gchar *startup_id);
154 void gdk_x11_display_set_cursor_theme (GdkDisplay *display,
158 void gdk_x11_display_broadcast_startup_message (GdkDisplay *display,
159 const char *message_type,
160 ...) G_GNUC_NULL_TERMINATED;
162 /* returns TRUE if we support the given WM spec feature */
163 gboolean gdk_x11_screen_supports_net_wm_hint (GdkScreen *screen,
166 XID gdk_x11_screen_get_monitor_output (GdkScreen *screen,
169 #ifndef GDK_MULTIHEAD_SAFE
170 void gdk_x11_grab_server (void);
171 void gdk_x11_ungrab_server (void);
174 GdkDisplay *gdk_x11_lookup_xdisplay (Display *xdisplay);
177 /* Functions to get the X Atom equivalent to the GdkAtom */
178 Atom gdk_x11_atom_to_xatom_for_display (GdkDisplay *display,
180 GdkAtom gdk_x11_xatom_to_atom_for_display (GdkDisplay *display,
182 Atom gdk_x11_get_xatom_by_name_for_display (GdkDisplay *display,
183 const gchar *atom_name);
184 G_CONST_RETURN gchar *gdk_x11_get_xatom_name_for_display (GdkDisplay *display,
186 #ifndef GDK_MULTIHEAD_SAFE
187 Atom gdk_x11_atom_to_xatom (GdkAtom atom);
188 GdkAtom gdk_x11_xatom_to_atom (Atom xatom);
189 Atom gdk_x11_get_xatom_by_name (const gchar *atom_name);
190 G_CONST_RETURN gchar *gdk_x11_get_xatom_name (Atom xatom);
193 void gdk_x11_display_grab (GdkDisplay *display);
194 void gdk_x11_display_ungrab (GdkDisplay *display);
196 void gdk_x11_display_error_trap_push (GdkDisplay *display);
197 /* warn unused because you could use pop_ignored otherwise */
198 G_GNUC_WARN_UNUSED_RESULT gint gdk_x11_display_error_trap_pop (GdkDisplay *display);
199 void gdk_x11_display_error_trap_pop_ignored (GdkDisplay *display);
201 void gdk_x11_register_standard_event_type (GdkDisplay *display,
206 void gdk_x11_set_sm_client_id (const gchar *sm_client_id);
208 gint gdk_x11_display_text_property_to_text_list (GdkDisplay *display,
214 void gdk_x11_free_text_list (gchar **list);
215 gint gdk_x11_display_string_to_compound_text (GdkDisplay *display,
221 gboolean gdk_x11_display_utf8_to_compound_text (GdkDisplay *display,
227 void gdk_x11_free_compound_text (guchar *ctext);
234 #endif /* __GDK_X_H__ */