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 | |
---|
20 | /* |
---|
21 | * Modified by the GTK+ Team and others 1997-1999. 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_PRIVATE_H__ |
---|
28 | #define __GDK_PRIVATE_H__ |
---|
29 | |
---|
30 | |
---|
31 | #include <X11/Xlib.h> |
---|
32 | #include <X11/Xutil.h> |
---|
33 | #include <gdk/gdktypes.h> |
---|
34 | |
---|
35 | #define gdk_window_lookup(xid) ((GdkWindow*) gdk_xid_table_lookup (xid)) |
---|
36 | #define gdk_pixmap_lookup(xid) ((GdkPixmap*) gdk_xid_table_lookup (xid)) |
---|
37 | #define gdk_font_lookup(xid) ((GdkFont*) gdk_xid_table_lookup (xid)) |
---|
38 | |
---|
39 | |
---|
40 | #ifdef __cplusplus |
---|
41 | extern "C" { |
---|
42 | #endif /* __cplusplus */ |
---|
43 | |
---|
44 | |
---|
45 | typedef struct _GdkWindowPrivate GdkWindowPrivate; |
---|
46 | typedef struct _GdkWindowPrivate GdkPixmapPrivate; |
---|
47 | typedef struct _GdkImagePrivate GdkImagePrivate; |
---|
48 | typedef struct _GdkGCPrivate GdkGCPrivate; |
---|
49 | typedef struct _GdkColormapPrivate GdkColormapPrivate; |
---|
50 | typedef struct _GdkColorInfo GdkColorInfo; |
---|
51 | typedef struct _GdkVisualPrivate GdkVisualPrivate; |
---|
52 | typedef struct _GdkFontPrivate GdkFontPrivate; |
---|
53 | typedef struct _GdkCursorPrivate GdkCursorPrivate; |
---|
54 | typedef struct _GdkEventFilter GdkEventFilter; |
---|
55 | typedef struct _GdkClientFilter GdkClientFilter; |
---|
56 | typedef struct _GdkColorContextPrivate GdkColorContextPrivate; |
---|
57 | typedef struct _GdkRegionPrivate GdkRegionPrivate; |
---|
58 | |
---|
59 | |
---|
60 | struct _GdkWindowPrivate |
---|
61 | { |
---|
62 | GdkWindow window; |
---|
63 | GdkWindow *parent; |
---|
64 | Window xwindow; |
---|
65 | Display *xdisplay; |
---|
66 | gint16 x; |
---|
67 | gint16 y; |
---|
68 | guint16 width; |
---|
69 | guint16 height; |
---|
70 | guint8 resize_count; |
---|
71 | guint8 window_type; |
---|
72 | guint ref_count; |
---|
73 | guint destroyed : 2; |
---|
74 | guint mapped : 1; |
---|
75 | guint guffaw_gravity : 1; |
---|
76 | |
---|
77 | gint extension_events; |
---|
78 | |
---|
79 | GList *filters; |
---|
80 | GdkColormap *colormap; |
---|
81 | GList *children; |
---|
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 | typedef enum { |
---|
111 | GDK_COLOR_WRITEABLE = 1 << 0 |
---|
112 | } GdkColorInfoFlags; |
---|
113 | |
---|
114 | struct _GdkColorInfo |
---|
115 | { |
---|
116 | GdkColorInfoFlags flags; |
---|
117 | guint ref_count; |
---|
118 | }; |
---|
119 | |
---|
120 | struct _GdkColormapPrivate |
---|
121 | { |
---|
122 | GdkColormap colormap; |
---|
123 | Colormap xcolormap; |
---|
124 | Display *xdisplay; |
---|
125 | GdkVisual *visual; |
---|
126 | gint private_val; |
---|
127 | |
---|
128 | GHashTable *hash; |
---|
129 | GdkColorInfo *info; |
---|
130 | time_t last_sync_time; |
---|
131 | |
---|
132 | guint ref_count; |
---|
133 | }; |
---|
134 | |
---|
135 | struct _GdkVisualPrivate |
---|
136 | { |
---|
137 | GdkVisual visual; |
---|
138 | Visual *xvisual; |
---|
139 | }; |
---|
140 | |
---|
141 | struct _GdkFontPrivate |
---|
142 | { |
---|
143 | GdkFont font; |
---|
144 | /* XFontStruct *xfont; */ |
---|
145 | /* generic pointer point to XFontStruct or XFontSet */ |
---|
146 | gpointer xfont; |
---|
147 | Display *xdisplay; |
---|
148 | guint ref_count; |
---|
149 | |
---|
150 | GSList *names; |
---|
151 | }; |
---|
152 | |
---|
153 | struct _GdkCursorPrivate |
---|
154 | { |
---|
155 | GdkCursor cursor; |
---|
156 | Cursor xcursor; |
---|
157 | Display *xdisplay; |
---|
158 | }; |
---|
159 | |
---|
160 | struct _GdkDndCursorInfo { |
---|
161 | Cursor gdk_cursor_dragdefault, gdk_cursor_dragok; |
---|
162 | GdkWindow *drag_pm_default, *drag_pm_ok; |
---|
163 | GdkPoint default_hotspot, ok_hotspot; |
---|
164 | GList *xids; |
---|
165 | }; |
---|
166 | typedef struct _GdkDndCursorInfo GdkDndCursorInfo; |
---|
167 | |
---|
168 | struct _GdkDndGlobals { |
---|
169 | GdkAtom gdk_XdeEnter, gdk_XdeLeave, gdk_XdeRequest; |
---|
170 | GdkAtom gdk_XdeDataAvailable, gdk_XdeDataShow, gdk_XdeCancel; |
---|
171 | GdkAtom gdk_XdeTypelist; |
---|
172 | |
---|
173 | GdkDndCursorInfo *c; |
---|
174 | GdkWindow **drag_startwindows; |
---|
175 | guint drag_numwindows; |
---|
176 | gboolean drag_really, drag_perhaps, dnd_grabbed; |
---|
177 | Window dnd_drag_target; |
---|
178 | GdkPoint drag_dropcoords; |
---|
179 | |
---|
180 | GdkPoint dnd_drag_start, dnd_drag_oldpos; |
---|
181 | GdkRectangle dnd_drag_dropzone; |
---|
182 | GdkWindowPrivate *real_sw; |
---|
183 | Window dnd_drag_curwin; |
---|
184 | Time last_drop_time; /* An incredible hack, sosumi miguel */ |
---|
185 | }; |
---|
186 | typedef struct _GdkDndGlobals GdkDndGlobals; |
---|
187 | |
---|
188 | struct _GdkEventFilter { |
---|
189 | GdkFilterFunc function; |
---|
190 | gpointer data; |
---|
191 | }; |
---|
192 | |
---|
193 | struct _GdkClientFilter { |
---|
194 | GdkAtom type; |
---|
195 | GdkFilterFunc function; |
---|
196 | gpointer data; |
---|
197 | }; |
---|
198 | |
---|
199 | #ifdef USE_XIM |
---|
200 | |
---|
201 | typedef struct _GdkICPrivate GdkICPrivate; |
---|
202 | |
---|
203 | struct _GdkICPrivate |
---|
204 | { |
---|
205 | XIC xic; |
---|
206 | GdkICAttr *attr; |
---|
207 | GdkICAttributesType mask; |
---|
208 | }; |
---|
209 | |
---|
210 | #endif /* USE_XIM */ |
---|
211 | |
---|
212 | struct _GdkColorContextPrivate |
---|
213 | { |
---|
214 | GdkColorContext color_context; |
---|
215 | Display *xdisplay; |
---|
216 | XStandardColormap std_cmap; |
---|
217 | }; |
---|
218 | |
---|
219 | struct _GdkRegionPrivate |
---|
220 | { |
---|
221 | GdkRegion region; |
---|
222 | Region xregion; |
---|
223 | }; |
---|
224 | |
---|
225 | typedef enum { |
---|
226 | GDK_DEBUG_MISC = 1 << 0, |
---|
227 | GDK_DEBUG_EVENTS = 1 << 1, |
---|
228 | GDK_DEBUG_DND = 1 << 2, |
---|
229 | GDK_DEBUG_COLOR_CONTEXT = 1 << 3, |
---|
230 | GDK_DEBUG_XIM = 1 << 4 |
---|
231 | } GdkDebugFlag; |
---|
232 | |
---|
233 | void gdk_events_init (void); |
---|
234 | void gdk_window_init (void); |
---|
235 | void gdk_visual_init (void); |
---|
236 | void gdk_dnd_init (void); |
---|
237 | |
---|
238 | void gdk_image_init (void); |
---|
239 | void gdk_image_exit (void); |
---|
240 | |
---|
241 | GdkColormap* gdk_colormap_lookup (Colormap xcolormap); |
---|
242 | GdkVisual* gdk_visual_lookup (Visual *xvisual); |
---|
243 | |
---|
244 | void gdk_window_add_colormap_windows (GdkWindow *window); |
---|
245 | void gdk_window_destroy_notify (GdkWindow *window); |
---|
246 | |
---|
247 | void gdk_xid_table_insert (XID *xid, |
---|
248 | gpointer data); |
---|
249 | void gdk_xid_table_remove (XID xid); |
---|
250 | gpointer gdk_xid_table_lookup (XID xid); |
---|
251 | |
---|
252 | gint gdk_send_xevent (Window window, gboolean propagate, glong event_mask, |
---|
253 | XEvent *event_send); |
---|
254 | |
---|
255 | /* If you pass x = y = -1, it queries the pointer |
---|
256 | to find out where it currently is. |
---|
257 | If you pass x = y = -2, it does anything necessary |
---|
258 | to know that the drag is ending. |
---|
259 | */ |
---|
260 | void gdk_dnd_display_drag_cursor(gint x, |
---|
261 | gint y, |
---|
262 | gboolean drag_ok, |
---|
263 | gboolean change_made); |
---|
264 | |
---|
265 | /* Please see gdkwindow.c for comments on how to use */ |
---|
266 | Window gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y, GList *excludes, gboolean excl_child); |
---|
267 | Window gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child); |
---|
268 | |
---|
269 | extern gint gdk_debug_level; |
---|
270 | extern gint gdk_show_events; |
---|
271 | extern gint gdk_use_xshm; |
---|
272 | extern gint gdk_stack_trace; |
---|
273 | extern gchar *gdk_display_name; |
---|
274 | extern Display *gdk_display; |
---|
275 | extern gint gdk_screen; |
---|
276 | extern Window gdk_root_window; |
---|
277 | extern Window gdk_leader_window; |
---|
278 | extern GdkWindowPrivate gdk_root_parent; |
---|
279 | extern Atom gdk_wm_delete_window; |
---|
280 | extern Atom gdk_wm_take_focus; |
---|
281 | extern Atom gdk_wm_protocols; |
---|
282 | extern Atom gdk_wm_window_protocols[]; |
---|
283 | extern Atom gdk_selection_property; |
---|
284 | extern GdkDndGlobals gdk_dnd; |
---|
285 | extern GdkWindow *selection_owner[]; |
---|
286 | extern gchar *gdk_progclass; |
---|
287 | extern gint gdk_error_code; |
---|
288 | extern gint gdk_error_warnings; |
---|
289 | extern gint gdk_null_window_warnings; |
---|
290 | extern GList *gdk_default_filters; |
---|
291 | extern const int gdk_nevent_masks; |
---|
292 | extern const int gdk_event_mask_table[]; |
---|
293 | |
---|
294 | extern GdkWindowPrivate *gdk_xgrab_window; /* Window that currently holds the |
---|
295 | * x pointer grab |
---|
296 | */ |
---|
297 | |
---|
298 | #ifdef USE_XIM |
---|
299 | /* XIM support */ |
---|
300 | gint gdk_im_open (void); |
---|
301 | void gdk_im_close (void); |
---|
302 | void gdk_ic_cleanup (void); |
---|
303 | |
---|
304 | extern GdkICPrivate *gdk_xim_ic; /* currently using IC */ |
---|
305 | extern GdkWindow *gdk_xim_window; /* currently using Window */ |
---|
306 | #endif /* USE_XIM */ |
---|
307 | |
---|
308 | /* Debugging support */ |
---|
309 | |
---|
310 | #ifdef G_ENABLE_DEBUG |
---|
311 | |
---|
312 | #define GDK_NOTE(type,action) G_STMT_START { \ |
---|
313 | if (gdk_debug_flags & GDK_DEBUG_##type) \ |
---|
314 | { action; }; } G_STMT_END |
---|
315 | |
---|
316 | #else /* !G_ENABLE_DEBUG */ |
---|
317 | |
---|
318 | #define GDK_NOTE(type,action) |
---|
319 | |
---|
320 | #endif /* G_ENABLE_DEBUG */ |
---|
321 | |
---|
322 | extern guint gdk_debug_flags; |
---|
323 | |
---|
324 | |
---|
325 | gboolean _gdk_font_wc_to_glyphs (GdkFont *font, |
---|
326 | const GdkWChar *text, |
---|
327 | gint text_length, |
---|
328 | gchar **result, |
---|
329 | gint *result_length); |
---|
330 | gchar *_gdk_wcstombs_len (const GdkWChar *src, |
---|
331 | int length); |
---|
332 | |
---|
333 | #ifdef __cplusplus |
---|
334 | } |
---|
335 | #endif /* __cplusplus */ |
---|
336 | |
---|
337 | |
---|
338 | #endif /* __GDK_PRIVATE_H__ */ |
---|