]> Pileus Git - ~andy/gtk/blob - gdk/gdkprivate.h
c1abc26ecc8fc1c05427ed1982cfbef2588c4653
[~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
49
50 struct _GdkWindowPrivate
51 {
52   GdkWindow window;
53   GdkWindow *parent;
54   Window xwindow;
55   Display *xdisplay;
56   gint16 x;
57   gint16 y;
58   guint16 width;
59   guint16 height;
60   guint8 resize_count;
61   guint8 window_type;
62   guint ref_count;
63   guint destroyed : 2;
64   guint dnd_drag_enabled : 1,
65     dnd_drag_datashow : 1,
66     dnd_drag_destructive_op : 1,
67     dnd_drag_accepted : 1,
68     dnd_drop_enabled : 1,
69     dnd_drop_destructive_op : 1;
70   GdkAtom dnd_drag_data_type, *dnd_drag_data_typesavail;
71   guint dnd_drag_data_numtypesavail;
72   /* We have to turn on MotionMask/EnterWindowMask/LeaveWindowMask
73      during drags, then set it back to what it was after */
74   glong dnd_drag_savedeventmask, dnd_drag_eventmask;
75   GdkAtom *dnd_drop_data_typesavail;
76   guint dnd_drop_data_numtypesavail;
77   /* need to allow custom drag/drop cursors */
78
79   gint extension_events;
80
81   GList *filters;
82 };
83
84 struct _GdkImagePrivate
85 {
86   GdkImage image;
87   XImage *ximage;
88   Display *xdisplay;
89   gpointer x_shm_info;
90
91   void (*image_put) (GdkDrawable *window,
92                      GdkGC       *gc,
93                      GdkImage    *image,
94                      gint         xsrc,
95                      gint         ysrc,
96                      gint         xdest,
97                      gint         ydest,
98                      gint         width,
99                      gint         height);
100 };
101
102 struct _GdkGCPrivate
103 {
104   GdkGC gc;
105   GC xgc;
106   Display *xdisplay;
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   gint next_color;
118   guint ref_count;
119 };
120
121 struct _GdkVisualPrivate
122 {
123   GdkVisual visual;
124   Visual *xvisual;
125 };
126
127 struct _GdkFontPrivate
128 {
129   GdkFont font;
130   /* XFontStruct *xfont; */
131   /* generic pointer point to XFontStruct or XFontSet */
132   gpointer xfont;
133   Display *xdisplay;
134   guint ref_count;
135 };
136
137 struct _GdkCursorPrivate
138 {
139   GdkCursor cursor;
140   Cursor xcursor;
141   Display *xdisplay;
142 };
143
144 struct _GdkDndGlobals {
145   GdkAtom            gdk_XdeEnter, gdk_XdeLeave, gdk_XdeRequest;
146   GdkAtom            gdk_XdeDataAvailable, gdk_XdeDataShow, gdk_XdeCancel;
147   GdkAtom            gdk_XdeTypelist;
148   Cursor          gdk_cursor_dragdefault, gdk_cursor_dragok;
149   GdkWindow     **drag_startwindows;
150   guint           drag_numwindows;
151   guint8          drag_really;
152   GdkPoint        drag_dropcoords;
153 };
154 typedef struct _GdkDndGlobals GdkDndGlobals;
155
156 struct _GdkEventFilter {
157   GdkFilterFunc function;
158   gpointer data;
159 };
160
161 #ifdef USE_XIM
162
163 struct _GdkICPrivate
164 {
165   XIC xic;
166   GdkIMStyle style;
167 };
168
169 typedef struct _GdkICPrivate GdkICPrivate;
170
171 #endif /* USE_XIM */
172
173 struct _GdkColorContextPrivate
174 {
175   GdkColorContext color_context;
176   Display *xdisplay;
177   XStandardColormap std_cmap;
178 };
179
180 typedef enum {
181   GDK_DEBUG_MISC = 1<<0,
182   GDK_DEBUG_EVENTS = 1 << 1,
183   GDK_DEBUG_DND = 1<<2,
184   GDK_DEBUG_COLOR_CONTEXT = 1<<3,
185   GDK_DEBUG_XIM = 1<<4
186 } GdkDebugFlag;
187
188 void gdk_window_init (void);
189 void gdk_visual_init (void);
190
191 void gdk_image_init  (void);
192 void gdk_image_exit (void);
193
194 GdkColormap* gdk_colormap_lookup (Colormap  xcolormap);
195 GdkVisual*   gdk_visual_lookup   (Visual   *xvisual);
196
197 void gdk_window_add_colormap_windows (GdkWindow *window);
198 void gdk_window_destroy_notify       (GdkWindow *window);
199
200 void     gdk_xid_table_insert (XID      *xid,
201                                gpointer  data);
202 void     gdk_xid_table_remove (XID       xid);
203 gpointer gdk_xid_table_lookup (XID       xid);
204
205
206 extern gint              gdk_debug_level;
207 extern gint              gdk_show_events;
208 extern gint              gdk_use_xshm;
209 extern gint              gdk_stack_trace;
210 extern gchar            *gdk_display_name;
211 extern Display          *gdk_display;
212 extern gint              gdk_screen;
213 extern Window            gdk_root_window;
214 extern Window            gdk_leader_window;
215 extern GdkWindowPrivate  gdk_root_parent;
216 extern Atom              gdk_wm_delete_window;
217 extern Atom              gdk_wm_take_focus;
218 extern Atom              gdk_wm_protocols;
219 extern Atom              gdk_wm_window_protocols[];
220 extern Atom              gdk_selection_property;
221 extern GdkDndGlobals     gdk_dnd;
222 extern GdkWindow        *selection_owner[];
223 extern gchar            *gdk_progname;
224 extern gchar            *gdk_progclass;
225 extern gint              gdk_error_code;
226 extern gint              gdk_error_warnings;
227
228 /* Debugging support */
229
230 #ifdef G_ENABLE_DEBUG
231
232 #define GDK_NOTE(type,action)                G_STMT_START { \
233     if (gdk_debug_flags & GDK_DEBUG_##type)                 \
234        action;                               } G_STMT_END
235
236 #else /* !G_ENABLE_DEBUG */
237
238 #define GDK_NOTE(type,action)
239       
240 #endif /* G_ENABLE_DEBUG */
241
242 extern guint gdk_debug_flags;
243
244
245 #ifdef __cplusplus
246 }
247 #endif /* __cplusplus */
248
249
250 #endif /* __GDK_PRIVATE_H__ */