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/gdkprivate.h> |
31 | |
32 | #include <X11/Xlib.h> |
33 | #include <X11/Xutil.h> |
34 | |
35 | G_BEGIN_DECLS |
36 | |
37 | #if (!defined (GDK_DISABLE_DEPRECATED) && !defined (GDK_MULTIHEAD_SAFE)) || defined (GDK_COMPILATION) |
38 | extern Display *gdk_display; |
39 | #endif |
40 | |
41 | Display *gdk_x11_drawable_get_xdisplay (GdkDrawable *drawable); |
42 | XID gdk_x11_drawable_get_xid (GdkDrawable *drawable); |
43 | GdkDrawable *gdk_x11_window_get_drawable_impl (GdkWindow *window); |
44 | GdkDrawable *gdk_x11_pixmap_get_drawable_impl (GdkPixmap *pixmap); |
45 | Display *gdk_x11_image_get_xdisplay (GdkImage *image); |
46 | XImage *gdk_x11_image_get_ximage (GdkImage *image); |
47 | Display *gdk_x11_colormap_get_xdisplay (GdkColormap *colormap); |
48 | Colormap gdk_x11_colormap_get_xcolormap (GdkColormap *colormap); |
49 | Display *gdk_x11_cursor_get_xdisplay (GdkCursor *cursor); |
50 | Cursor gdk_x11_cursor_get_xcursor (GdkCursor *cursor); |
51 | Display *gdk_x11_display_get_xdisplay (GdkDisplay *display); |
52 | Visual * gdk_x11_visual_get_xvisual (GdkVisual *visual); |
53 | #if !defined(GDK_DISABLE_DEPRECATED) || defined(GDK_COMPILATION) |
54 | Display *gdk_x11_gc_get_xdisplay (GdkGC *gc); |
55 | GC gdk_x11_gc_get_xgc (GdkGC *gc); |
56 | #endif |
57 | Screen * gdk_x11_screen_get_xscreen (GdkScreen *screen); |
58 | int gdk_x11_screen_get_screen_number (GdkScreen *screen); |
59 | void gdk_x11_window_set_user_time (GdkWindow *window, |
60 | guint32 timestamp); |
61 | void gdk_x11_window_move_to_current_desktop (GdkWindow *window); |
62 | |
63 | const char* gdk_x11_screen_get_window_manager_name (GdkScreen *screen); |
64 | |
65 | #ifndef GDK_MULTIHEAD_SAFE |
66 | Window gdk_x11_get_default_root_xwindow (void); |
67 | Display *gdk_x11_get_default_xdisplay (void); |
68 | gint gdk_x11_get_default_screen (void); |
69 | #endif |
70 | |
71 | #define GDK_COLORMAP_XDISPLAY(cmap) (gdk_x11_colormap_get_xdisplay (cmap)) |
72 | #define GDK_COLORMAP_XCOLORMAP(cmap) (gdk_x11_colormap_get_xcolormap (cmap)) |
73 | #define GDK_CURSOR_XDISPLAY(cursor) (gdk_x11_cursor_get_xdisplay (cursor)) |
74 | #define GDK_CURSOR_XCURSOR(cursor) (gdk_x11_cursor_get_xcursor (cursor)) |
75 | #define GDK_IMAGE_XDISPLAY(image) (gdk_x11_image_get_xdisplay (image)) |
76 | #define GDK_IMAGE_XIMAGE(image) (gdk_x11_image_get_ximage (image)) |
77 | |
78 | #if (!defined (GDK_DISABLE_DEPRECATED) && !defined (GDK_MULTIHEAD_SAFE)) || defined (GDK_COMPILATION) |
79 | #define GDK_DISPLAY() gdk_display |
80 | #endif |
81 | |
82 | #ifdef GDK_COMPILATION |
83 | |
84 | #include "gdkprivate-x11.h" |
85 | #include "gdkscreen-x11.h" |
86 | |
87 | #define GDK_DISPLAY_XDISPLAY(display) (GDK_DISPLAY_X11(display)->xdisplay) |
88 | |
89 | #define GDK_WINDOW_XDISPLAY(win) (GDK_SCREEN_X11 (GDK_WINDOW_SCREEN (win))->xdisplay) |
90 | #define GDK_WINDOW_XID(win) (GDK_DRAWABLE_IMPL_X11(((GdkWindowObject *)win)->impl)->xid) |
91 | #define GDK_PIXMAP_XDISPLAY(pix) (GDK_SCREEN_X11 (GDK_PIXMAP_SCREEN (pix))->xdisplay) |
92 | #define GDK_PIXMAP_XID(pix) (GDK_DRAWABLE_IMPL_X11(((GdkPixmapObject *)pix)->impl)->xid) |
93 | #define GDK_DRAWABLE_XDISPLAY(win) (GDK_IS_WINDOW (win) ? GDK_WINDOW_XDISPLAY (win) : GDK_PIXMAP_XDISPLAY (win)) |
94 | #define GDK_DRAWABLE_XID(win) (GDK_IS_WINDOW (win) ? GDK_WINDOW_XID (win) : GDK_PIXMAP_XID (win)) |
95 | #define GDK_GC_XDISPLAY(gc) (GDK_SCREEN_XDISPLAY(GDK_GC_X11(gc)->screen)) |
96 | #define GDK_GC_XGC(gc) (GDK_GC_X11(gc)->xgc) |
97 | #define GDK_SCREEN_XDISPLAY(screen) (GDK_SCREEN_X11 (screen)->xdisplay) |
98 | #define GDK_SCREEN_XSCREEN(screen) (GDK_SCREEN_X11 (screen)->xscreen) |
99 | #define GDK_SCREEN_XNUMBER(screen) (GDK_SCREEN_X11 (screen)->screen_num) |
100 | #define GDK_VISUAL_XVISUAL(vis) (((GdkVisualPrivate *) vis)->xvisual) |
101 | #define GDK_GC_GET_XGC(gc) (GDK_GC_X11(gc)->dirty_mask ? _gdk_x11_gc_flush (gc) : ((GdkGCX11 *)(gc))->xgc) |
102 | #define GDK_WINDOW_XWINDOW GDK_DRAWABLE_XID |
103 | |
104 | #else /* GDK_COMPILATION */ |
105 | |
106 | #ifndef GDK_MULTIHEAD_SAFE |
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 | #define GDK_WINDOW_XDISPLAY(win) (gdk_x11_drawable_get_xdisplay (gdk_x11_window_get_drawable_impl (win))) |
113 | #define GDK_WINDOW_XID(win) (gdk_x11_drawable_get_xid (win)) |
114 | #define GDK_WINDOW_XWINDOW(win) (gdk_x11_drawable_get_xid (win)) |
115 | #define GDK_PIXMAP_XDISPLAY(win) (gdk_x11_drawable_get_xdisplay (gdk_x11_pixmap_get_drawable_impl (win))) |
116 | #define GDK_PIXMAP_XID(win) (gdk_x11_drawable_get_xid (win)) |
117 | #define GDK_DRAWABLE_XDISPLAY(win) (gdk_x11_drawable_get_xdisplay (win)) |
118 | #define GDK_DRAWABLE_XID(win) (gdk_x11_drawable_get_xid (win)) |
119 | #define GDK_GC_XDISPLAY(gc) (gdk_x11_gc_get_xdisplay (gc)) |
120 | #define GDK_GC_XGC(gc) (gdk_x11_gc_get_xgc (gc)) |
121 | #define GDK_SCREEN_XDISPLAY(screen) (gdk_x11_display_get_xdisplay (gdk_screen_get_display (screen))) |
122 | #define GDK_SCREEN_XSCREEN(screen) (gdk_x11_screen_get_xscreen (screen)) |
123 | #define GDK_SCREEN_XNUMBER(screen) (gdk_x11_screen_get_screen_number (screen)) |
124 | #define GDK_VISUAL_XVISUAL(visual) (gdk_x11_visual_get_xvisual (visual)) |
125 | |
126 | #endif /* GDK_COMPILATION */ |
127 | |
128 | GdkVisual* gdk_x11_screen_lookup_visual (GdkScreen *screen, |
129 | VisualID xvisualid); |
130 | #ifndef GDK_DISABLE_DEPRECATED |
131 | #ifndef GDK_MULTIHEAD_SAFE |
132 | GdkVisual* gdkx_visual_get (VisualID xvisualid); |
133 | #endif |
134 | #endif |
135 | |
136 | #ifdef GDK_ENABLE_BROKEN |
137 | /* XXX: An X Colormap is useless unless we also have the visual. */ |
138 | GdkColormap* gdkx_colormap_get (Colormap xcolormap); |
139 | #endif |
140 | |
141 | GdkColormap *gdk_x11_colormap_foreign_new (GdkVisual *visual, |
142 | Colormap xcolormap); |
143 | |
144 | #if !defined (GDK_DISABLE_DEPRECATED) || defined (GDK_COMPILATION) |
145 | gpointer gdk_xid_table_lookup_for_display (GdkDisplay *display, |
146 | XID xid); |
147 | #endif |
148 | guint32 gdk_x11_get_server_time (GdkWindow *window); |
149 | guint32 gdk_x11_display_get_user_time (GdkDisplay *display); |
150 | |
151 | const gchar * gdk_x11_display_get_startup_notification_id (GdkDisplay *display); |
152 | |
153 | void gdk_x11_display_set_cursor_theme (GdkDisplay *display, |
154 | const gchar *theme, |
155 | const gint size); |
156 | |
157 | void gdk_x11_display_broadcast_startup_message (GdkDisplay *display, |
158 | const char *message_type, |
159 | ...) G_GNUC_NULL_TERMINATED; |
160 | |
161 | /* returns TRUE if we support the given WM spec feature */ |
162 | gboolean gdk_x11_screen_supports_net_wm_hint (GdkScreen *screen, |
163 | GdkAtom property); |
164 | |
165 | XID gdk_x11_screen_get_monitor_output (GdkScreen *screen, |
166 | gint monitor_num); |
167 | |
168 | #ifndef GDK_MULTIHEAD_SAFE |
169 | #ifndef GDK_DISABLE_DEPRECATED |
170 | gpointer gdk_xid_table_lookup (XID xid); |
171 | gboolean gdk_net_wm_supports (GdkAtom property); |
172 | #endif |
173 | void gdk_x11_grab_server (void); |
174 | void gdk_x11_ungrab_server (void); |
175 | #endif |
176 | |
177 | GdkDisplay *gdk_x11_lookup_xdisplay (Display *xdisplay); |
178 | |
179 | |
180 | /* Functions to get the X Atom equivalent to the GdkAtom */ |
181 | Atom gdk_x11_atom_to_xatom_for_display (GdkDisplay *display, |
182 | GdkAtom atom); |
183 | GdkAtom gdk_x11_xatom_to_atom_for_display (GdkDisplay *display, |
184 | Atom xatom); |
185 | Atom gdk_x11_get_xatom_by_name_for_display (GdkDisplay *display, |
186 | const gchar *atom_name); |
187 | const gchar * gdk_x11_get_xatom_name_for_display (GdkDisplay *display, |
188 | Atom xatom); |
189 | #ifndef GDK_MULTIHEAD_SAFE |
190 | Atom gdk_x11_atom_to_xatom (GdkAtom atom); |
191 | GdkAtom gdk_x11_xatom_to_atom (Atom xatom); |
192 | Atom gdk_x11_get_xatom_by_name (const gchar *atom_name); |
193 | const gchar * gdk_x11_get_xatom_name (Atom xatom); |
194 | #endif |
195 | |
196 | void gdk_x11_display_grab (GdkDisplay *display); |
197 | void gdk_x11_display_ungrab (GdkDisplay *display); |
198 | void gdk_x11_register_standard_event_type (GdkDisplay *display, |
199 | gint event_base, |
200 | gint n_events); |
201 | |
202 | #if !defined(GDK_DISABLE_DEPRECATED) || defined(GDK_COMPILATION) |
203 | |
204 | gpointer gdk_x11_font_get_xfont (GdkFont *font); |
205 | #define GDK_FONT_XFONT(font) (gdk_x11_font_get_xfont (font)) |
206 | |
207 | #define gdk_font_lookup_for_display(display, xid) ((GdkFont*) gdk_xid_table_lookup_for_display (display, ((xid)|XID_FONT_BIT))) |
208 | |
209 | #endif /* !GDK_DISABLE_DEPRECATED || GDK_COMPILATION */ |
210 | |
211 | #ifndef GDK_DISABLE_DEPRECATED |
212 | |
213 | Display * gdk_x11_font_get_xdisplay (GdkFont *font); |
214 | const char * gdk_x11_font_get_name (GdkFont *font); |
215 | |
216 | #define GDK_FONT_XDISPLAY(font) (gdk_x11_font_get_xdisplay (font)) |
217 | |
218 | #ifndef GDK_MULTIHEAD_SAFE |
219 | |
220 | #define gdk_font_lookup(xid) ((GdkFont*) gdk_xid_table_lookup (xid)) |
221 | |
222 | #endif /* GDK_MULTIHEAD_SAFE */ |
223 | #endif /* GDK_DISABLE_DEPRECATED */ |
224 | |
225 | void gdk_x11_set_sm_client_id (const gchar *sm_client_id); |
226 | |
227 | GdkWindow *gdk_x11_window_foreign_new_for_display (GdkDisplay *display, |
228 | Window window); |
229 | GdkWindow *gdk_x11_window_lookup_for_display (GdkDisplay *display, |
230 | Window window); |
231 | |
232 | gint gdk_x11_display_text_property_to_text_list (GdkDisplay *display, |
233 | GdkAtom encoding, |
234 | gint format, |
235 | const guchar *text, |
236 | gint length, |
237 | gchar ***list); |
238 | void gdk_x11_free_text_list (gchar **list); |
239 | gint gdk_x11_display_string_to_compound_text (GdkDisplay *display, |
240 | const gchar *str, |
241 | GdkAtom *encoding, |
242 | gint *format, |
243 | guchar **ctext, |
244 | gint *length); |
245 | gboolean gdk_x11_display_utf8_to_compound_text (GdkDisplay *display, |
246 | const gchar *str, |
247 | GdkAtom *encoding, |
248 | gint *format, |
249 | guchar **ctext, |
250 | gint *length); |
251 | void gdk_x11_free_compound_text (guchar *ctext); |
252 | |
253 | |
254 | G_END_DECLS |
255 | |
256 | #endif /* __GDK_X_H__ */ |
257 | |