]> Pileus Git - ~andy/gtk/blob - gdk/x11/gdkx.h
x11: Split out public window API into gdkx11window.h
[~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 /**
36  * SECTION:x_interaction
37  * @Short_description: X backend-specific functions
38  * @Title: X Window System Interaction
39  *
40  * The functions in this section are specific to the GDK X11 backend.
41  * To use them, you need to include the <literal>&lt;gdk/gdkx.h&gt;</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>).
45  *
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... *<!---->/
51  * #endif
52  * </programlisting></informalexample>
53  */
54
55
56 #define __GDKX_H_INSIDE__
57
58 #include <gdk/x11/gdkx11window.h>
59
60 #undef __GDKX_H_INSIDE__
61
62 G_BEGIN_DECLS
63
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);
70
71 const char* gdk_x11_screen_get_window_manager_name (GdkScreen *screen);
72
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);
77 #endif
78
79 /**
80  * GDK_CURSOR_XDISPLAY:
81  * @cursor: a #GdkCursor.
82  *
83  * Returns the display of a #GdkCursor.
84  *
85  * Returns: an Xlib <type>Display*</type>.
86  */
87 #define GDK_CURSOR_XDISPLAY(cursor)   (gdk_x11_cursor_get_xdisplay (cursor))
88
89 /**
90  * GDK_CURSOR_XCURSOR:
91  * @cursor: a #GdkCursor.
92  *
93  * Returns the X cursor belonging to a #GdkCursor.
94  *
95  * Returns: an Xlib <type>Cursor</type>.
96  */
97 #define GDK_CURSOR_XCURSOR(cursor)    (gdk_x11_cursor_get_xcursor (cursor))
98
99 #define GDK_IS_DISPLAY_X11(object)   (G_TYPE_CHECK_INSTANCE_TYPE ((object), g_type_from_name ("GdkDisplayX11")))
100
101 #ifndef GDK_MULTIHEAD_SAFE
102 /**
103  * GDK_ROOT_WINDOW:
104  *
105  * Obtains the Xlib window id of the root window of the current screen.
106  */
107 #define GDK_ROOT_WINDOW()             (gdk_x11_get_default_root_xwindow ())
108 #endif
109
110 #define GDK_DISPLAY_XDISPLAY(display) (gdk_x11_display_get_xdisplay (display))
111
112 /**
113  * GDK_DISPLAY_XDISPLAY:
114  * @display: a #GdkDisplay.
115  *
116  * Returns the display of a #GdkDisplay.
117  *
118  * Returns: an Xlib <type>Display*</type>
119  */
120 #define GDK_SCREEN_XDISPLAY(screen)   (gdk_x11_display_get_xdisplay (gdk_screen_get_display (screen)))
121
122 /**
123  * GDK_SCREEN_XSCREEN:
124  * @screen: a #GdkScreen
125  *
126  * Returns the screen of a #GdkScreen.
127  *
128  * Returns: an Xlib <type>Screen*</type>.
129  */
130 #define GDK_SCREEN_XSCREEN(screen)    (gdk_x11_screen_get_xscreen (screen))
131
132 /**
133  * GDK_SCREEN_XNUMBER:
134  * @screen: a #GdkScreen
135  *
136  * Returns the index of a #GdkScreen.
137  *
138  * Returns: the position of @screen among the screens of
139  *  its display.
140  */
141 #define GDK_SCREEN_XNUMBER(screen)    (gdk_x11_screen_get_screen_number (screen))
142
143 #define GDK_VISUAL_XVISUAL(visual)    (gdk_x11_visual_get_xvisual (visual))
144
145 GdkVisual* gdk_x11_screen_lookup_visual (GdkScreen *screen,
146                                          VisualID   xvisualid);
147
148 guint32       gdk_x11_display_get_user_time (GdkDisplay *display);
149
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);
153
154 void          gdk_x11_display_set_cursor_theme (GdkDisplay  *display,
155                                                 const gchar *theme,
156                                                 const gint   size);
157
158 void gdk_x11_display_broadcast_startup_message (GdkDisplay *display,
159                                                 const char *message_type,
160                                                 ...) G_GNUC_NULL_TERMINATED;
161
162 /* returns TRUE if we support the given WM spec feature */
163 gboolean gdk_x11_screen_supports_net_wm_hint (GdkScreen *screen,
164                                               GdkAtom    property);
165
166 XID      gdk_x11_screen_get_monitor_output   (GdkScreen *screen,
167                                               gint       monitor_num);
168
169 #ifndef GDK_MULTIHEAD_SAFE
170 void          gdk_x11_grab_server    (void);
171 void          gdk_x11_ungrab_server  (void);
172 #endif
173
174 GdkDisplay   *gdk_x11_lookup_xdisplay (Display *xdisplay);
175
176
177 /* Functions to get the X Atom equivalent to the GdkAtom */
178 Atom                  gdk_x11_atom_to_xatom_for_display (GdkDisplay  *display,
179                                                          GdkAtom      atom);
180 GdkAtom               gdk_x11_xatom_to_atom_for_display (GdkDisplay  *display,
181                                                          Atom         xatom);
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,
185                                                           Atom         xatom);
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);
191 #endif
192
193 void        gdk_x11_display_grab              (GdkDisplay *display);
194 void        gdk_x11_display_ungrab            (GdkDisplay *display);
195
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);
200
201 void        gdk_x11_register_standard_event_type (GdkDisplay *display,
202                                                   gint        event_base,
203                                                   gint        n_events);
204
205
206 void        gdk_x11_set_sm_client_id (const gchar *sm_client_id);
207
208 gint     gdk_x11_display_text_property_to_text_list (GdkDisplay   *display,
209                                                      GdkAtom       encoding,
210                                                      gint          format,
211                                                      const guchar *text,
212                                                      gint          length,
213                                                      gchar      ***list);
214 void     gdk_x11_free_text_list                     (gchar       **list);
215 gint     gdk_x11_display_string_to_compound_text    (GdkDisplay   *display,
216                                                      const gchar  *str,
217                                                      GdkAtom      *encoding,
218                                                      gint         *format,
219                                                      guchar      **ctext,
220                                                      gint         *length);
221 gboolean gdk_x11_display_utf8_to_compound_text      (GdkDisplay   *display,
222                                                      const gchar  *str,
223                                                      GdkAtom      *encoding,
224                                                      gint         *format,
225                                                      guchar      **ctext,
226                                                      gint         *length);
227 void     gdk_x11_free_compound_text                 (guchar       *ctext);
228
229
230
231
232 G_END_DECLS
233
234 #endif /* __GDK_X_H__ */