]> Pileus Git - ~andy/gtk/blob - gdk/gdkprivate.h
Add drag_end_event for future expansion, plus allow passing in NULL to the gdk filter...
[~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 typedef struct _GdkDndGlobals GdkDndGlobals;
165
166 struct _GdkEventFilter {
167   GdkFilterFunc function;
168   gpointer data;
169 };
170
171 #ifdef USE_XIM
172
173 struct _GdkICPrivate
174 {
175   XIC xic;
176   GdkIMStyle style;
177 };
178
179 typedef struct _GdkICPrivate GdkICPrivate;
180
181 #endif /* USE_XIM */
182
183 struct _GdkColorContextPrivate
184 {
185   GdkColorContext color_context;
186   Display *xdisplay;
187   XStandardColormap std_cmap;
188 };
189
190 struct _GdkRegionPrivate
191 {
192   GdkRegion region;
193   Region xregion;
194 };
195
196 typedef enum {
197   GDK_DEBUG_MISC = 1<<0,
198   GDK_DEBUG_EVENTS = 1 << 1,
199   GDK_DEBUG_DND = 1<<2,
200   GDK_DEBUG_COLOR_CONTEXT = 1<<3,
201   GDK_DEBUG_XIM = 1<<4
202 } GdkDebugFlag;
203
204 void gdk_window_init (void);
205 void gdk_visual_init (void);
206
207 void gdk_image_init  (void);
208 void gdk_image_exit (void);
209
210 GdkColormap* gdk_colormap_lookup (Colormap  xcolormap);
211 GdkVisual*   gdk_visual_lookup   (Visual   *xvisual);
212
213 void gdk_window_add_colormap_windows (GdkWindow *window);
214 void gdk_window_destroy_notify       (GdkWindow *window);
215
216 void     gdk_xid_table_insert (XID      *xid,
217                                gpointer  data);
218 void     gdk_xid_table_remove (XID       xid);
219 gpointer gdk_xid_table_lookup (XID       xid);
220
221 /* If you pass x = y = -1, it queries the pointer
222    to find out where it currently is.
223    If you pass x = y = -2, it does anything necessary
224    to know that the drag is ending.
225 */
226 void gdk_dnd_display_drag_cursor(gint x,
227                                  gint y,
228                                  gboolean drag_ok,
229                                  gboolean change_made);
230
231
232 extern gint              gdk_debug_level;
233 extern gint              gdk_show_events;
234 extern gint              gdk_use_xshm;
235 extern gint              gdk_stack_trace;
236 extern gchar            *gdk_display_name;
237 extern Display          *gdk_display;
238 extern gint              gdk_screen;
239 extern Window            gdk_root_window;
240 extern Window            gdk_leader_window;
241 extern GdkWindowPrivate  gdk_root_parent;
242 extern Atom              gdk_wm_delete_window;
243 extern Atom              gdk_wm_take_focus;
244 extern Atom              gdk_wm_protocols;
245 extern Atom              gdk_wm_window_protocols[];
246 extern Atom              gdk_selection_property;
247 extern GdkDndGlobals     gdk_dnd;
248 extern GdkWindow        *selection_owner[];
249 extern gchar            *gdk_progname;
250 extern gchar            *gdk_progclass;
251 extern gint              gdk_error_code;
252 extern gint              gdk_error_warnings;
253 extern gboolean          gdk_null_window_warnings;
254 extern GList            *default_filters;
255
256 /* Debugging support */
257
258 #ifdef G_ENABLE_DEBUG
259
260 #define GDK_NOTE(type,action)                G_STMT_START { \
261     if (gdk_debug_flags & GDK_DEBUG_##type)                 \
262        { action; };                          } G_STMT_END
263
264 #else /* !G_ENABLE_DEBUG */
265
266 #define GDK_NOTE(type,action)
267       
268 #endif /* G_ENABLE_DEBUG */
269
270 extern guint gdk_debug_flags;
271
272
273 #ifdef __cplusplus
274 }
275 #endif /* __cplusplus */
276
277
278 #endif /* __GDK_PRIVATE_H__ */