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/.
30 #include <gdk/gdkprivate.h>
31 #include <gdk/gdkcursor.h>
34 #include <X11/Xutil.h>
36 #include <gdk/x11/gdkwindow-x11.h>
37 #include <gdk/x11/gdkpixmap-x11.h>
39 typedef struct _GdkColormapPrivateX11 GdkColormapPrivateX11;
40 typedef struct _GdkCursorPrivate GdkCursorPrivate;
41 typedef struct _GdkFontPrivateX GdkFontPrivateX;
42 typedef struct _GdkImagePrivateX11 GdkImagePrivateX11;
43 typedef struct _GdkVisualPrivate GdkVisualPrivate;
46 typedef struct _GdkICPrivate GdkICPrivate;
49 struct _GdkCursorPrivate
56 struct _GdkFontPrivateX
59 /* XFontStruct *xfont; */
60 /* generic pointer point to XFontStruct or XFontSet */
67 struct _GdkVisualPrivate
73 struct _GdkColormapPrivateX11
81 time_t last_sync_time;
84 struct _GdkImagePrivateX11
98 GdkICAttributesType mask;
104 typedef struct _GdkGCX11 GdkGCX11;
105 typedef struct _GdkGCX11Class GdkGCX11Class;
107 #define GDK_TYPE_GC_X11 (gdk_gc_x11_get_type ())
108 #define GDK_GC_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC_X11, GdkGCX11))
109 #define GDK_GC_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GC_X11, GdkGCX11Class))
110 #define GDK_IS_GC_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC_X11))
111 #define GDK_IS_GC_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC_X11))
112 #define GDK_GC_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC_X11, GdkGCX11Class))
116 GdkGC parent_instance;
120 GdkRegion *clip_region;
123 /* We can't conditionalize on HAVE_XFT here, so we simply always
124 * have this here as a gpointer.
130 struct _GdkGCX11Class
132 GdkGCClass parent_class;
136 GType gdk_gc_x11_get_type (void);
138 #define GDK_ROOT_WINDOW() gdk_root_window
139 #define GDK_ROOT_PARENT() ((GdkWindow *)gdk_parent_root)
140 #define GDK_DISPLAY() gdk_display
141 #define GDK_WINDOW_XDISPLAY(win) (GDK_DRAWABLE_IMPL_X11(((GdkWindowObject *)win)->impl)->xdisplay)
142 #define GDK_WINDOW_XID(win) (GDK_DRAWABLE_IMPL_X11(((GdkWindowObject *)win)->impl)->xid)
143 #define GDK_PIXMAP_XDISPLAY(win) (GDK_DRAWABLE_IMPL_X11(((GdkPixmapObject *)win)->impl)->xdisplay)
144 #define GDK_PIXMAP_XID(win) (GDK_DRAWABLE_IMPL_X11(((GdkPixmapObject *)win)->impl)->xid)
145 #define GDK_DRAWABLE_XDISPLAY(win) (GDK_IS_WINDOW (win) ? GDK_WINDOW_XDISPLAY (win) : GDK_PIXMAP_XDISPLAY (win))
146 #define GDK_DRAWABLE_XID(win) (GDK_IS_WINDOW (win) ? GDK_WINDOW_XID (win) : GDK_PIXMAP_XID (win))
147 #define GDK_IMAGE_XDISPLAY(image) (((GdkImagePrivateX11 *) GDK_IMAGE (image)->windowing_data)->xdisplay)
148 #define GDK_IMAGE_XIMAGE(image) (((GdkImagePrivateX11 *) GDK_IMAGE (image)->windowing_data)->ximage)
149 #define GDK_GC_XDISPLAY(gc) (GDK_GC_X11(gc)->xdisplay)
150 #define GDK_COLORMAP_XDISPLAY(cmap) (((GdkColormapPrivateX11 *)GDK_COLORMAP (cmap)->windowing_data)->xdisplay)
151 #define GDK_COLORMAP_XCOLORMAP(cmap) (((GdkColormapPrivateX11 *)GDK_COLORMAP (cmap)->windowing_data)->xcolormap)
152 #define GDK_VISUAL_XVISUAL(vis) (((GdkVisualPrivate *) vis)->xvisual)
153 #define GDK_FONT_XDISPLAY(font) (((GdkFontPrivate *) font)->xdisplay)
154 #define GDK_FONT_XFONT(font) (((GdkFontPrivateX *)font)->xfont)
156 #define GDK_GC_XGC(gc) (GDK_GC_X11(gc)->xgc)
157 #define GDK_GC_GET_XGC(gc) (GDK_GC_X11(gc)->dirty_mask ? _gdk_x11_gc_flush (gc) : GDK_GC_XGC (gc))
158 #define GDK_WINDOW_XWINDOW GDK_DRAWABLE_XID
160 extern Display *gdk_display;
161 extern Window gdk_root_window;
162 extern gint gdk_screen;
163 extern gchar *gdk_display_name;
164 extern Window gdk_leader_window;
166 extern Atom gdk_selection_property;
168 extern gchar *gdk_progclass;
170 GdkVisual* gdkx_visual_get (VisualID xvisualid);
171 /* XXX: Do not use this function until it is fixed. An X Colormap
172 * is useless unless we also have the visual. */
173 GdkColormap* gdkx_colormap_get (Colormap xcolormap);
174 /* Utility function in gdk.c - not sure where it belongs, but it's
175 needed in more than one place, so make it public */
176 Window gdk_get_client_window (Display *dpy,
179 /* Functions to create pixmaps and windows from their X equivalents */
180 GdkPixmap *gdk_pixmap_foreign_new (GdkNativeWindow anid);
181 GdkWindow *gdk_window_foreign_new (GdkNativeWindow anid);
183 /* Return the Gdk* for a particular XID */
184 gpointer gdk_xid_table_lookup (XID xid);
186 guint32 gdk_x11_get_server_time (GdkWindow *window);
188 /* returns TRUE if we support the given WM spec feature */
189 gboolean gdk_wmspec_supported (GdkAtom property);
191 #define gdk_window_lookup(xid) ((GdkWindow*) gdk_xid_table_lookup (xid))
192 #define gdk_pixmap_lookup(xid) ((GdkPixmap*) gdk_xid_table_lookup (xid))
193 #define gdk_font_lookup(xid) ((GdkFont*) gdk_xid_table_lookup (xid))
195 GC _gdk_x11_gc_flush (GdkGC *gc);
197 #endif /* __GDK_X_H__ */