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