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>
39 * SECTION:x_interaction
40 * @Short_description: X backend-specific functions
41 * @Title: X Window System Interaction
43 * The functions in this section are specific to the GDK X11 backend.
44 * To use them, you need to include the <literal><gdk/gdkx.h></literal>
45 * header and use the X11-specific pkg-config files to build your
46 * application (either <literal>gdk-x11-3.0</literal> or
47 * <literal>gtk+-x11-3.0</literal>).
49 * To make your code compile with other GDK backends, guard backend-specific
50 * calls by an ifdef as follows:
51 * <informalexample><programlisting>
52 * #ifdef GDK_WINDOWING_X11
53 * /<!---->* X11-specific calls here... *<!---->/
55 * </programlisting></informalexample>
59 Window gdk_x11_window_get_xid (GdkWindow *window);
60 Display *gdk_x11_cursor_get_xdisplay (GdkCursor *cursor);
61 Cursor gdk_x11_cursor_get_xcursor (GdkCursor *cursor);
62 Display *gdk_x11_display_get_xdisplay (GdkDisplay *display);
63 Visual * gdk_x11_visual_get_xvisual (GdkVisual *visual);
64 Screen * gdk_x11_screen_get_xscreen (GdkScreen *screen);
65 int gdk_x11_screen_get_screen_number (GdkScreen *screen);
66 void gdk_x11_window_set_user_time (GdkWindow *window,
68 void gdk_x11_window_move_to_current_desktop (GdkWindow *window);
70 const char* gdk_x11_screen_get_window_manager_name (GdkScreen *screen);
72 #ifndef GDK_MULTIHEAD_SAFE
73 Window gdk_x11_get_default_root_xwindow (void);
74 Display *gdk_x11_get_default_xdisplay (void);
75 gint gdk_x11_get_default_screen (void);
79 * GDK_CURSOR_XDISPLAY:
80 * @cursor: a #GdkCursor.
82 * Returns the display of a #GdkCursor.
84 * Returns: an Xlib <type>Display*</type>.
86 #define GDK_CURSOR_XDISPLAY(cursor) (gdk_x11_cursor_get_xdisplay (cursor))
90 * @cursor: a #GdkCursor.
92 * Returns the X cursor belonging to a #GdkCursor.
94 * Returns: an Xlib <type>Cursor</type>.
96 #define GDK_CURSOR_XCURSOR(cursor) (gdk_x11_cursor_get_xcursor (cursor))
99 #ifdef GDK_COMPILATION
101 #include "gdkprivate-x11.h"
102 #include "gdkscreen-x11.h"
105 * GDK_DISPLAY_XDISPLAY:
106 * @display: a #GdkDisplay.
108 * Returns the display of a #GdkDisplay.
110 * Returns: an Xlib <type>Display*</type>
112 #define GDK_DISPLAY_XDISPLAY(display) (GDK_DISPLAY_X11(display)->xdisplay)
115 * GDK_WINDOW_XDISPLAY:
116 * @win: a #GdkWindow.
118 * Returns the display of a #GdkWindow.
120 * Returns: an Xlib <type>Display*</type>.
122 #define GDK_WINDOW_XDISPLAY(win) (GDK_SCREEN_X11 (GDK_WINDOW_SCREEN (win))->xdisplay)
123 #define GDK_WINDOW_XID(win) (GDK_WINDOW_IMPL_X11(GDK_WINDOW (win)->impl)->xid)
125 #define GDK_SCREEN_XDISPLAY(screen) (GDK_SCREEN_X11 (screen)->xdisplay)
128 * GDK_SCREEN_XSCREEN:
129 * @screen: a #GdkScreen
131 * Returns the screen of a #GdkScreen.
133 * Returns: an Xlib <type>Screen*</type>.
135 #define GDK_SCREEN_XSCREEN(screen) (GDK_SCREEN_X11 (screen)->xscreen)
136 #define GDK_SCREEN_XNUMBER(screen) (GDK_SCREEN_X11 (screen)->screen_num)
138 #else /* GDK_COMPILATION */
140 #ifndef GDK_MULTIHEAD_SAFE
144 * Obtains the Xlib window id of the root window of the current screen.
146 #define GDK_ROOT_WINDOW() (gdk_x11_get_default_root_xwindow ())
149 #define GDK_DISPLAY_XDISPLAY(display) (gdk_x11_display_get_xdisplay (display))
151 #define GDK_WINDOW_XDISPLAY(win) (GDK_DISPLAY_XDISPLAY (gdk_window_get_display (win)))
155 * @win: a #GdkWindow.
157 * Returns the X window belonging to a #GdkWindow.
159 * Returns: the Xlib <type>Window</type> of @win.
161 #define GDK_WINDOW_XID(win) (gdk_x11_window_get_xid (win))
163 #define GDK_SCREEN_XDISPLAY(screen) (gdk_x11_display_get_xdisplay (gdk_screen_get_display (screen)))
164 #define GDK_SCREEN_XSCREEN(screen) (gdk_x11_screen_get_xscreen (screen))
167 * GDK_SCREEN_XNUMBER:
168 * @screen: a #GdkScreen
170 * Returns the index of a #GdkScreen.
172 * Returns: the position of @screen among the screens of
175 #define GDK_SCREEN_XNUMBER(screen) (gdk_x11_screen_get_screen_number (screen))
177 #endif /* GDK_COMPILATION */
179 #define GDK_VISUAL_XVISUAL(visual) (gdk_x11_visual_get_xvisual (visual))
181 GdkVisual* gdk_x11_screen_lookup_visual (GdkScreen *screen,
183 #ifndef GDK_MULTIHEAD_SAFE
184 GdkVisual* gdkx_visual_get (VisualID xvisualid);
187 /* Return the Gdk* for a particular XID */
188 gpointer gdk_xid_table_lookup_for_display (GdkDisplay *display,
190 guint32 gdk_x11_get_server_time (GdkWindow *window);
191 guint32 gdk_x11_display_get_user_time (GdkDisplay *display);
193 G_CONST_RETURN gchar *gdk_x11_display_get_startup_notification_id (GdkDisplay *display);
194 void gdk_x11_display_set_startup_notification_id (GdkDisplay *display,
195 const gchar *startup_id);
197 void gdk_x11_display_set_cursor_theme (GdkDisplay *display,
201 void gdk_x11_display_broadcast_startup_message (GdkDisplay *display,
202 const char *message_type,
203 ...) G_GNUC_NULL_TERMINATED;
205 /* returns TRUE if we support the given WM spec feature */
206 gboolean gdk_x11_screen_supports_net_wm_hint (GdkScreen *screen,
209 XID gdk_x11_screen_get_monitor_output (GdkScreen *screen,
212 #ifndef GDK_MULTIHEAD_SAFE
213 gpointer gdk_xid_table_lookup (XID xid);
214 gboolean gdk_net_wm_supports (GdkAtom property);
215 void gdk_x11_grab_server (void);
216 void gdk_x11_ungrab_server (void);
219 GdkDisplay *gdk_x11_lookup_xdisplay (Display *xdisplay);
222 /* Functions to get the X Atom equivalent to the GdkAtom */
223 Atom gdk_x11_atom_to_xatom_for_display (GdkDisplay *display,
225 GdkAtom gdk_x11_xatom_to_atom_for_display (GdkDisplay *display,
227 Atom gdk_x11_get_xatom_by_name_for_display (GdkDisplay *display,
228 const gchar *atom_name);
229 G_CONST_RETURN gchar *gdk_x11_get_xatom_name_for_display (GdkDisplay *display,
231 #ifndef GDK_MULTIHEAD_SAFE
232 Atom gdk_x11_atom_to_xatom (GdkAtom atom);
233 GdkAtom gdk_x11_xatom_to_atom (Atom xatom);
234 Atom gdk_x11_get_xatom_by_name (const gchar *atom_name);
235 G_CONST_RETURN gchar *gdk_x11_get_xatom_name (Atom xatom);
238 void gdk_x11_display_grab (GdkDisplay *display);
239 void gdk_x11_display_ungrab (GdkDisplay *display);
241 void gdk_x11_display_error_trap_push (GdkDisplay *display);
242 /* warn unused because you could use pop_ignored otherwise */
243 G_GNUC_WARN_UNUSED_RESULT gint gdk_x11_display_error_trap_pop (GdkDisplay *display);
244 void gdk_x11_display_error_trap_pop_ignored (GdkDisplay *display);
246 void gdk_x11_register_standard_event_type (GdkDisplay *display,
253 #endif /* __GDK_X_H__ */