]> Pileus Git - ~andy/gtk/blob - gdk/x11/gdkx.h
Make GdkDevice parallel-implementable
[~andy/gtk] / gdk / x11 / gdkx.h
1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 /*
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/. 
25  */
26
27 #ifndef __GDK_X_H__
28 #define __GDK_X_H__
29
30 #include <gdk/gdk.h>
31
32 #include <X11/Xlib.h>
33 #include <X11/Xutil.h>
34
35 G_BEGIN_DECLS
36
37
38 /**
39  * SECTION:x_interaction
40  * @Short_description: X backend-specific functions
41  * @Title: X Window System Interaction
42  *
43  * The functions in this section are specific to the GDK X11 backend.
44  * To use them, you need to include the <literal>&lt;gdk/gdkx.h&gt;</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>).
48  *
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... *<!---->/
54  * #endif
55  * </programlisting></informalexample>
56  */
57
58
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,
67                                            guint32      timestamp);
68 void     gdk_x11_window_move_to_current_desktop (GdkWindow   *window);
69
70 const char* gdk_x11_screen_get_window_manager_name (GdkScreen *screen);
71
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);
76 #endif
77
78 /**
79  * GDK_CURSOR_XDISPLAY:
80  * @cursor: a #GdkCursor.
81  *
82  * Returns the display of a #GdkCursor.
83  *
84  * Returns: an Xlib <type>Display*</type>.
85  */
86 #define GDK_CURSOR_XDISPLAY(cursor)   (gdk_x11_cursor_get_xdisplay (cursor))
87
88 /**
89  * GDK_CURSOR_XCURSOR:
90  * @cursor: a #GdkCursor.
91  *
92  * Returns the X cursor belonging to a #GdkCursor.
93  *
94  * Returns: an Xlib <type>Cursor</type>.
95  */
96 #define GDK_CURSOR_XCURSOR(cursor)    (gdk_x11_cursor_get_xcursor (cursor))
97
98
99 #ifdef GDK_COMPILATION
100
101 #include "gdkprivate-x11.h"
102 #include "gdkscreen-x11.h"
103
104 /**
105  * GDK_DISPLAY_XDISPLAY:
106  * @display: a #GdkDisplay.
107  *
108  * Returns the display of a #GdkDisplay.
109  *
110  * Returns: an Xlib <type>Display*</type>
111  */
112 #define GDK_DISPLAY_XDISPLAY(display) (GDK_DISPLAY_X11(display)->xdisplay)
113
114 /**
115  * GDK_WINDOW_XDISPLAY:
116  * @win: a #GdkWindow.
117  *
118  * Returns the display of a #GdkWindow.
119  *
120  * Returns: an Xlib <type>Display*</type>.
121  */
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)
124
125 #define GDK_SCREEN_XDISPLAY(screen)   (GDK_SCREEN_X11 (screen)->xdisplay)
126
127 /**
128  * GDK_SCREEN_XSCREEN:
129  * @screen: a #GdkScreen
130  *
131  * Returns the screen of a #GdkScreen.
132  *
133  * Returns: an Xlib <type>Screen*</type>.
134  */
135 #define GDK_SCREEN_XSCREEN(screen)    (GDK_SCREEN_X11 (screen)->xscreen)
136 #define GDK_SCREEN_XNUMBER(screen)    (GDK_SCREEN_X11 (screen)->screen_num) 
137
138 #else /* GDK_COMPILATION */
139
140 #ifndef GDK_MULTIHEAD_SAFE
141 /**
142  * GDK_ROOT_WINDOW:
143  *
144  * Obtains the Xlib window id of the root window of the current screen.
145  */
146 #define GDK_ROOT_WINDOW()             (gdk_x11_get_default_root_xwindow ())
147 #endif
148
149 #define GDK_DISPLAY_XDISPLAY(display) (gdk_x11_display_get_xdisplay (display))
150
151 #define GDK_WINDOW_XDISPLAY(win)      (GDK_DISPLAY_XDISPLAY (gdk_window_get_display (win)))
152
153 /**
154  * GDK_WINDOW_XID:
155  * @win: a #GdkWindow.
156  *
157  * Returns the X window belonging to a #GdkWindow.
158  *
159  * Returns: the Xlib <type>Window</type> of @win.
160  */
161 #define GDK_WINDOW_XID(win)           (gdk_x11_window_get_xid (win))
162
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))
165
166 /**
167  * GDK_SCREEN_XNUMBER:
168  * @screen: a #GdkScreen
169  *
170  * Returns the index of a #GdkScreen.
171  *
172  * Returns: the position of @screen among the screens of
173  *  its display.
174  */
175 #define GDK_SCREEN_XNUMBER(screen)    (gdk_x11_screen_get_screen_number (screen))
176
177 #endif /* GDK_COMPILATION */
178
179 #define GDK_VISUAL_XVISUAL(visual)    (gdk_x11_visual_get_xvisual (visual))
180
181 GdkVisual* gdk_x11_screen_lookup_visual (GdkScreen *screen,
182                                          VisualID   xvisualid);
183 #ifndef GDK_MULTIHEAD_SAFE
184 GdkVisual* gdkx_visual_get            (VisualID   xvisualid);
185 #endif
186
187      /* Return the Gdk* for a particular XID */
188 gpointer      gdk_xid_table_lookup_for_display (GdkDisplay *display,
189                                                 XID         xid);
190 guint32       gdk_x11_get_server_time  (GdkWindow       *window);
191 guint32       gdk_x11_display_get_user_time (GdkDisplay *display);
192
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);
196
197 void          gdk_x11_display_set_cursor_theme (GdkDisplay  *display,
198                                                 const gchar *theme,
199                                                 const gint   size);
200
201 void gdk_x11_display_broadcast_startup_message (GdkDisplay *display,
202                                                 const char *message_type,
203                                                 ...) G_GNUC_NULL_TERMINATED;
204
205 /* returns TRUE if we support the given WM spec feature */
206 gboolean gdk_x11_screen_supports_net_wm_hint (GdkScreen *screen,
207                                               GdkAtom    property);
208
209 XID      gdk_x11_screen_get_monitor_output   (GdkScreen *screen,
210                                               gint       monitor_num);
211
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);
217 #endif
218
219 GdkDisplay   *gdk_x11_lookup_xdisplay (Display *xdisplay);
220
221
222 /* Functions to get the X Atom equivalent to the GdkAtom */
223 Atom                  gdk_x11_atom_to_xatom_for_display (GdkDisplay  *display,
224                                                          GdkAtom      atom);
225 GdkAtom               gdk_x11_xatom_to_atom_for_display (GdkDisplay  *display,
226                                                          Atom         xatom);
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,
230                                                           Atom         xatom);
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);
236 #endif
237
238 void        gdk_x11_display_grab              (GdkDisplay *display);
239 void        gdk_x11_display_ungrab            (GdkDisplay *display);
240
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);
245
246 void        gdk_x11_register_standard_event_type (GdkDisplay *display,
247                                                   gint        event_base,
248                                                   gint        n_events);
249
250
251 G_END_DECLS
252
253 #endif /* __GDK_X_H__ */