]> Pileus Git - ~andy/gtk/blob - gdk/x11/gdkx.h
test the window state stuff
[~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/gdkprivate.h>
31 #include <gdk/gdkcursor.h>
32
33 #include <X11/Xlib.h>
34 #include <X11/Xutil.h>
35
36 #include <gdk/x11/gdkwindow-x11.h>
37 #include <gdk/x11/gdkpixmap-x11.h>
38
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;
44
45 #ifdef USE_XIM
46 typedef struct _GdkICPrivate        GdkICPrivate;
47 #endif /* USE_XIM */
48
49 struct _GdkCursorPrivate
50 {
51   GdkCursor cursor;
52   Cursor xcursor;
53   Display *xdisplay;
54 };
55
56 struct _GdkFontPrivateX
57 {
58   GdkFontPrivate base;
59   /* XFontStruct *xfont; */
60   /* generic pointer point to XFontStruct or XFontSet */
61   gpointer xfont;
62   Display *xdisplay;
63
64   GSList *names;
65 };
66
67 struct _GdkVisualPrivate
68 {
69   GdkVisual visual;
70   Visual *xvisual;
71 };
72
73 struct _GdkColormapPrivateX11
74 {
75   Colormap xcolormap;
76   Display *xdisplay;
77   gint private_val;
78
79   GHashTable *hash;
80   GdkColorInfo *info;
81   time_t last_sync_time;
82 };
83
84 struct _GdkImagePrivateX11
85 {
86   XImage *ximage;
87   Display *xdisplay;
88   gpointer x_shm_info;
89 };
90
91
92 #ifdef USE_XIM
93
94 struct _GdkICPrivate
95 {
96   XIC xic;
97   GdkICAttr *attr;
98   GdkICAttributesType mask;
99 };
100
101 #endif /* USE_XIM */
102
103
104 typedef struct _GdkGCX11      GdkGCX11;
105 typedef struct _GdkGCX11Class GdkGCX11Class;
106
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))
113
114 struct _GdkGCX11
115 {
116   GdkGC parent_instance;
117   
118   GC xgc;
119   Display *xdisplay;
120   GdkRegion *clip_region;
121   guint dirty_mask;
122
123   /* We can't conditionalize on HAVE_XFT here, so we simply always
124    * have this here as a gpointer.
125    */
126   gpointer xft_draw;
127   gulong fg_pixel;
128 };
129
130 struct _GdkGCX11Class
131 {
132   GdkGCClass parent_class;
133
134 };
135
136 GType gdk_gc_x11_get_type (void);
137
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)
155
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
159
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;
165
166 extern Atom              gdk_selection_property;
167
168 extern gchar            *gdk_progclass;
169
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,
177                                           Window    win);
178
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);
182
183 /* Return the Gdk* for a particular XID */
184 gpointer      gdk_xid_table_lookup     (XID              xid);
185
186 guint32       gdk_x11_get_server_time  (GdkWindow       *window);
187
188 /* returns TRUE if we support the given WM spec feature */
189 gboolean      gdk_wmspec_supported     (GdkAtom property);
190
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))
194
195 GC _gdk_x11_gc_flush (GdkGC *gc);
196
197 #endif /* __GDK_X_H__ */