]> Pileus Git - ~andy/gtk/blob - gdk/gdkprivate.h
Merge from themes-2. See the ChangeLog for a somewhat detailed
[~andy/gtk] / gdk / gdkprivate.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 Library 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library 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 #ifndef __GDK_PRIVATE_H__
20 #define __GDK_PRIVATE_H__
21
22
23 #include <X11/Xlib.h>
24 #include <X11/Xutil.h>
25 #include <gdk/gdktypes.h>
26
27 #define gdk_window_lookup(xid)     ((GdkWindow*) gdk_xid_table_lookup (xid))
28 #define gdk_pixmap_lookup(xid)     ((GdkPixmap*) gdk_xid_table_lookup (xid))
29 #define gdk_font_lookup(xid)       ((GdkFont*) gdk_xid_table_lookup (xid))
30
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif /* __cplusplus */
35
36
37 typedef struct _GdkWindowPrivate       GdkWindowPrivate;
38 typedef struct _GdkWindowPrivate       GdkPixmapPrivate;
39 typedef struct _GdkImagePrivate        GdkImagePrivate;
40 typedef struct _GdkGCPrivate           GdkGCPrivate;
41 typedef struct _GdkColormapPrivate     GdkColormapPrivate;
42 typedef struct _GdkColorInfo           GdkColorInfo;
43 typedef struct _GdkVisualPrivate       GdkVisualPrivate;
44 typedef struct _GdkFontPrivate         GdkFontPrivate;
45 typedef struct _GdkCursorPrivate       GdkCursorPrivate;
46 typedef struct _GdkEventFilter         GdkEventFilter;
47 typedef struct _GdkClientFilter        GdkClientFilter;
48 typedef struct _GdkColorContextPrivate GdkColorContextPrivate;
49 typedef struct _GdkRegionPrivate       GdkRegionPrivate;
50
51
52 struct _GdkWindowPrivate
53 {
54   GdkWindow window;
55   GdkWindow *parent;
56   Window xwindow;
57   Display *xdisplay;
58   gint16 x;
59   gint16 y;
60   guint16 width;
61   guint16 height;
62   guint8 resize_count;
63   guint8 window_type;
64   guint ref_count;
65   guint destroyed : 2;
66
67   gint extension_events;
68
69   GList *filters;
70   GdkColormap *colormap;
71   GList *children;
72 };
73
74 struct _GdkImagePrivate
75 {
76   GdkImage image;
77   XImage *ximage;
78   Display *xdisplay;
79   gpointer x_shm_info;
80
81   void (*image_put) (GdkDrawable *window,
82                      GdkGC       *gc,
83                      GdkImage    *image,
84                      gint         xsrc,
85                      gint         ysrc,
86                      gint         xdest,
87                      gint         ydest,
88                      gint         width,
89                      gint         height);
90 };
91
92 struct _GdkGCPrivate
93 {
94   GdkGC gc;
95   GC xgc;
96   Display *xdisplay;
97   guint ref_count;
98 };
99
100 typedef enum {
101   GDK_COLOR_WRITEABLE = 1 << 0
102 } GdkColorInfoFlags;
103
104 struct _GdkColorInfo
105 {
106   GdkColorInfoFlags flags;
107   guint ref_count;
108 };
109
110 struct _GdkColormapPrivate
111 {
112   GdkColormap colormap;
113   Colormap xcolormap;
114   Display *xdisplay;
115   GdkVisual *visual;
116   gint private_val;
117
118   GHashTable *hash;
119   GdkColorInfo *info;
120   time_t last_sync_time;
121   
122   guint ref_count;
123 };
124
125 struct _GdkVisualPrivate
126 {
127   GdkVisual visual;
128   Visual *xvisual;
129 };
130
131 struct _GdkFontPrivate
132 {
133   GdkFont font;
134   /* XFontStruct *xfont; */
135   /* generic pointer point to XFontStruct or XFontSet */
136   gpointer xfont;
137   Display *xdisplay;
138   guint ref_count;
139 };
140
141 struct _GdkCursorPrivate
142 {
143   GdkCursor cursor;
144   Cursor xcursor;
145   Display *xdisplay;
146 };
147
148 struct _GdkDndCursorInfo {
149   Cursor          gdk_cursor_dragdefault, gdk_cursor_dragok;
150   GdkWindow      *drag_pm_default, *drag_pm_ok;
151   GdkPoint        default_hotspot, ok_hotspot;
152   GList *xids;
153 };
154 typedef struct _GdkDndCursorInfo GdkDndCursorInfo;
155
156 struct _GdkDndGlobals {
157   GdkAtom            gdk_XdeEnter, gdk_XdeLeave, gdk_XdeRequest;
158   GdkAtom            gdk_XdeDataAvailable, gdk_XdeDataShow, gdk_XdeCancel;
159   GdkAtom            gdk_XdeTypelist;
160
161   GdkDndCursorInfo  *c;
162   GdkWindow     **drag_startwindows;
163   guint           drag_numwindows;
164   gboolean        drag_really, drag_perhaps, dnd_grabbed;
165   Window          dnd_drag_target;
166   GdkPoint        drag_dropcoords;
167
168   GdkPoint dnd_drag_start, dnd_drag_oldpos;
169   GdkRectangle dnd_drag_dropzone;
170   GdkWindowPrivate *real_sw;
171   Window dnd_drag_curwin;
172   Time last_drop_time; /* An incredible hack, sosumi miguel */
173 };
174 typedef struct _GdkDndGlobals GdkDndGlobals;
175
176 struct _GdkEventFilter {
177   GdkFilterFunc function;
178   gpointer data;
179 };
180
181 struct _GdkClientFilter {
182   GdkAtom       type;
183   GdkFilterFunc function;
184   gpointer      data;
185 };
186
187 #ifdef USE_XIM
188
189 struct _GdkICPrivate
190 {
191   XIC xic;
192   GdkIMStyle style;
193 };
194
195 typedef struct _GdkICPrivate GdkICPrivate;
196
197 #endif /* USE_XIM */
198
199 struct _GdkColorContextPrivate
200 {
201   GdkColorContext color_context;
202   Display *xdisplay;
203   XStandardColormap std_cmap;
204 };
205
206 struct _GdkRegionPrivate
207 {
208   GdkRegion region;
209   Region xregion;
210 };
211
212 typedef enum {
213   GDK_DEBUG_MISC          = 1 << 0,
214   GDK_DEBUG_EVENTS        = 1 << 1,
215   GDK_DEBUG_DND           = 1 << 2,
216   GDK_DEBUG_COLOR_CONTEXT = 1 << 3,
217   GDK_DEBUG_XIM           = 1 << 4
218 } GdkDebugFlag;
219
220 void gdk_window_init (void);
221 void gdk_visual_init (void);
222 void gdk_dnd_init    (void);
223
224 void gdk_image_init  (void);
225 void gdk_image_exit (void);
226
227 GdkColormap* gdk_colormap_lookup (Colormap  xcolormap);
228 GdkVisual*   gdk_visual_lookup   (Visual   *xvisual);
229
230 void gdk_window_add_colormap_windows (GdkWindow *window);
231 void gdk_window_destroy_notify       (GdkWindow *window);
232
233 void     gdk_xid_table_insert (XID      *xid,
234                                gpointer  data);
235 void     gdk_xid_table_remove (XID       xid);
236 gpointer gdk_xid_table_lookup (XID       xid);
237
238 gint gdk_send_xevent (Window window, gboolean propagate, glong event_mask,
239                       XEvent *event_send);
240
241 /* If you pass x = y = -1, it queries the pointer
242    to find out where it currently is.
243    If you pass x = y = -2, it does anything necessary
244    to know that the drag is ending.
245 */
246 void gdk_dnd_display_drag_cursor(gint x,
247                                  gint y,
248                                  gboolean drag_ok,
249                                  gboolean change_made);
250
251 /* Please see gdkwindow.c for comments on how to use */ 
252 Window gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y, GList *excludes, gboolean excl_child);
253 Window gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child);
254
255 extern gint              gdk_debug_level;
256 extern gint              gdk_show_events;
257 extern gint              gdk_use_xshm;
258 extern gint              gdk_stack_trace;
259 extern gchar            *gdk_display_name;
260 extern Display          *gdk_display;
261 extern gint              gdk_screen;
262 extern Window            gdk_root_window;
263 extern Window            gdk_leader_window;
264 extern GdkWindowPrivate  gdk_root_parent;
265 extern Atom              gdk_wm_delete_window;
266 extern Atom              gdk_wm_take_focus;
267 extern Atom              gdk_wm_protocols;
268 extern Atom              gdk_wm_window_protocols[];
269 extern Atom              gdk_selection_property;
270 extern GdkDndGlobals     gdk_dnd;
271 extern GdkWindow        *selection_owner[];
272 extern gchar            *gdk_progclass;
273 extern gint              gdk_error_code;
274 extern gint              gdk_error_warnings;
275 extern gint              gdk_null_window_warnings;
276 extern GList            *gdk_default_filters;
277 extern gboolean          gdk_using_threads;
278
279 /* Threading stuff */
280 #ifdef USE_PTHREADS
281 extern gint              gdk_threads_pipe[2];
282 extern gboolean          gdk_select_waiting;
283 #endif
284
285 /* Debugging support */
286
287 #ifdef G_ENABLE_DEBUG
288
289 #define GDK_NOTE(type,action)                G_STMT_START { \
290     if (gdk_debug_flags & GDK_DEBUG_##type)                 \
291        { action; };                          } G_STMT_END
292
293 #else /* !G_ENABLE_DEBUG */
294
295 #define GDK_NOTE(type,action)
296       
297 #endif /* G_ENABLE_DEBUG */
298
299 extern guint gdk_debug_flags;
300
301
302 #ifdef __cplusplus
303 }
304 #endif /* __cplusplus */
305
306
307 #endif /* __GDK_PRIVATE_H__ */