1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser 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.
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 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser 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.
21 * Modified by the GTK+ Team and others 1997-2000. 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/.
27 /* Uninstalled header defining types and functions internal to GDK */
29 #ifndef __GDK_INTERNALS_H__
30 #define __GDK_INTERNALS_H__
33 #include "gdkwindowimpl.h"
34 #include "gdkdisplay.h"
35 #include "gdkprivate.h"
39 /**********************
40 * General Facilities *
41 **********************/
43 /* Debugging support */
45 typedef struct _GdkColorInfo GdkColorInfo;
46 typedef struct _GdkEventFilter GdkEventFilter;
47 typedef struct _GdkClientFilter GdkClientFilter;
50 GDK_COLOR_WRITEABLE = 1 << 0
55 GdkColorInfoFlags flags;
60 GDK_EVENT_FILTER_REMOVED = 1 << 0
61 } GdkEventFilterFlags;
63 struct _GdkEventFilter {
64 GdkFilterFunc function;
66 GdkEventFilterFlags flags;
70 struct _GdkClientFilter {
72 GdkFilterFunc function;
77 GDK_DEBUG_MISC = 1 << 0,
78 GDK_DEBUG_EVENTS = 1 << 1,
79 GDK_DEBUG_DND = 1 << 2,
80 GDK_DEBUG_XIM = 1 << 3,
81 GDK_DEBUG_NOGRABS = 1 << 4,
82 GDK_DEBUG_INPUT = 1 << 5,
83 GDK_DEBUG_CURSOR = 1 << 6,
84 GDK_DEBUG_MULTIHEAD = 1 << 7,
85 GDK_DEBUG_XINERAMA = 1 << 8,
86 GDK_DEBUG_DRAW = 1 << 9,
87 GDK_DEBUG_EVENTLOOP = 1 << 10
91 GDK_RENDERING_MODE_SIMILAR = 0,
92 GDK_RENDERING_MODE_IMAGE,
93 GDK_RENDERING_MODE_RECORDING
96 extern GList *_gdk_default_filters;
97 extern GdkWindow *_gdk_parent_root;
99 extern guint _gdk_debug_flags;
100 extern GdkRenderingMode _gdk_rendering_mode;
102 #ifdef G_ENABLE_DEBUG
104 #define GDK_NOTE(type,action) G_STMT_START { \
105 if (_gdk_debug_flags & GDK_DEBUG_##type) \
106 { action; }; } G_STMT_END
108 #else /* !G_ENABLE_DEBUG */
110 #define GDK_NOTE(type,action)
112 #endif /* G_ENABLE_DEBUG */
125 typedef struct _GdkArgContext GdkArgContext;
126 typedef struct _GdkArgDesc GdkArgDesc;
128 typedef void (*GdkArgFunc) (const char *name, const char *arg, gpointer data);
130 struct _GdkArgContext
146 typedef struct _GdkEventPrivate GdkEventPrivate;
150 /* Following flag is set for events on the event queue during
151 * translation and cleared afterwards.
153 GDK_EVENT_PENDING = 1 << 0
156 struct _GdkEventPrivate
161 gpointer windowing_data;
163 GdkDevice *source_device;
166 typedef struct _GdkWindowPaint GdkWindowPaint;
170 GObject parent_instance;
172 GdkWindowImpl *impl; /* window-system-specific delegate object */
182 GdkEventMask event_mask;
183 gint extension_events;
188 cairo_pattern_t *background;
192 cairo_region_t *update_area;
193 guint update_freeze_count;
199 gint8 toplevel_window_type;
201 GdkWindowState state;
203 guint guffaw_gravity : 1;
204 guint input_only : 1;
205 guint modal_hint : 1;
206 guint composited : 1;
207 guint has_alpha_background : 1;
211 guint accept_focus : 1;
212 guint focus_on_map : 1;
214 guint support_multidevice : 1;
215 guint synthesize_crossing_event_queued : 1;
216 guint effective_visibility : 2;
217 guint visibility : 2; /* The visibility wrt the toplevel (i.e. based on clip_region) */
218 guint native_visibility : 2; /* the native visibility of a impl windows */
219 guint viewable : 1; /* mapped and all parents mapped */
220 guint applied_shape : 1;
222 /* The GdkWindow that has the impl, ref:ed if another window.
223 * This ref is required to keep the wrapper of the impl window alive
224 * for as long as any GdkWindow references the impl. */
225 GdkWindow *impl_window;
227 guint update_and_descendants_freeze_count;
229 gint abs_x, abs_y; /* Absolute offset in impl */
232 /* The clip region is the part of the window, in window coordinates
233 that is fully or partially (i.e. semi transparently) visible in
234 the window hierarchy from the toplevel and down */
235 cairo_region_t *clip_region;
236 /* This is the clip region, with additionally all the opaque
237 child windows removed */
238 cairo_region_t *clip_region_with_children;
239 /* The layered region is the subset of clip_region that
240 is covered by non-opaque sibling or ancestor sibling window. */
241 cairo_region_t *layered_region;
244 GHashTable *device_cursor;
246 GdkWindowPaint *implicit_paint;
248 GList *outstanding_moves;
250 cairo_region_t *shape;
251 cairo_region_t *input_shape;
253 cairo_surface_t *cairo_surface;
255 GList *devices_inside;
256 GHashTable *device_events;
258 GHashTable *source_event_masks;
259 gulong device_added_handler_id;
260 gulong device_changed_handler_id;
262 guint num_offscreen_children;
265 #define GDK_WINDOW_TYPE(d) (((GDK_WINDOW (d)))->window_type)
266 #define GDK_WINDOW_DESTROYED(d) (GDK_WINDOW (d)->destroyed)
268 extern gchar *_gdk_display_name;
269 extern gint _gdk_screen_number;
270 extern gchar *_gdk_display_arg_name;
271 extern gboolean _gdk_disable_multidevice;
273 GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
275 void _gdk_event_filter_unref (GdkWindow *window,
276 GdkEventFilter *filter);
278 void _gdk_event_emit (GdkEvent *event);
279 GList* _gdk_event_queue_find_first (GdkDisplay *display);
280 void _gdk_event_queue_remove_link (GdkDisplay *display,
282 GList* _gdk_event_queue_prepend (GdkDisplay *display,
284 GList* _gdk_event_queue_append (GdkDisplay *display,
286 GList* _gdk_event_queue_insert_after (GdkDisplay *display,
287 GdkEvent *after_event,
289 GList* _gdk_event_queue_insert_before(GdkDisplay *display,
290 GdkEvent *after_event,
292 void _gdk_event_button_generate (GdkDisplay *display,
295 void _gdk_windowing_event_data_copy (const GdkEvent *src,
297 void _gdk_windowing_event_data_free (GdkEvent *event);
299 void gdk_synthesize_window_state (GdkWindow *window,
300 GdkWindowState unset_flags,
301 GdkWindowState set_flags);
303 gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
304 GdkRectangle *extents);
306 /*************************************
307 * Interfaces used by windowing code *
308 *************************************/
311 _gdk_window_ref_cairo_surface (GdkWindow *window);
313 void _gdk_window_destroy (GdkWindow *window,
314 gboolean foreign_destroy);
315 void _gdk_window_clear_update_area (GdkWindow *window);
316 void _gdk_window_update_size (GdkWindow *window);
317 gboolean _gdk_window_update_viewable (GdkWindow *window);
319 void _gdk_window_process_updates_recurse (GdkWindow *window,
320 cairo_region_t *expose_region);
322 void _gdk_screen_close (GdkScreen *screen);
324 /*****************************************
325 * Interfaces provided by windowing code *
326 *****************************************/
328 /* Font/string functions implemented in module-specific code */
330 void _gdk_cursor_destroy (GdkCursor *cursor);
332 extern const GOptionEntry _gdk_windowing_args[];
333 gchar *_gdk_windowing_substitute_screen_number (const gchar *display_name,
336 void _gdk_windowing_got_event (GdkDisplay *display,
341 #define GDK_WINDOW_IS_MAPPED(window) (((window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0)
343 #define GDK_TYPE_PAINTABLE (_gdk_paintable_get_type ())
344 #define GDK_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_PAINTABLE, GdkPaintable))
345 #define GDK_IS_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_PAINTABLE))
346 #define GDK_PAINTABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GDK_TYPE_PAINTABLE, GdkPaintableIface))
348 typedef struct _GdkPaintable GdkPaintable;
349 typedef struct _GdkPaintableIface GdkPaintableIface;
351 struct _GdkPaintableIface
353 GTypeInterface g_iface;
355 void (* begin_paint_region) (GdkPaintable *paintable,
357 const cairo_region_t *region);
358 void (* end_paint) (GdkPaintable *paintable);
361 GType _gdk_paintable_get_type (void) G_GNUC_CONST;
363 void _gdk_window_invalidate_for_expose (GdkWindow *window,
364 cairo_region_t *region);
366 GdkWindow * _gdk_window_find_child_at (GdkWindow *window,
368 GdkWindow * _gdk_window_find_descendant_at (GdkWindow *toplevel,
373 void _gdk_window_add_damage (GdkWindow *toplevel,
374 cairo_region_t *damaged_region);
376 GdkEvent * _gdk_make_event (GdkWindow *window,
378 GdkEvent *event_in_queue,
379 gboolean before_event);
380 gboolean _gdk_window_event_parent_of (GdkWindow *parent,
383 void _gdk_synthesize_crossing_events (GdkDisplay *display,
387 GdkDevice *source_device,
388 GdkCrossingMode mode,
391 GdkModifierType mask,
393 GdkEvent *event_in_queue,
395 gboolean non_linear);
396 void _gdk_display_set_window_under_pointer (GdkDisplay *display,
401 void _gdk_synthesize_crossing_events_for_geometry_change (GdkWindow *changed_window);
403 gboolean _gdk_window_has_impl (GdkWindow *window);
404 GdkWindow * _gdk_window_get_impl_window (GdkWindow *window);
406 /*****************************
407 * offscreen window routines *
408 *****************************/
409 GType gdk_offscreen_window_get_type (void);
410 void _gdk_offscreen_window_new (GdkWindow *window,
411 GdkWindowAttr *attributes,
412 gint attributes_mask);
413 cairo_surface_t * _gdk_offscreen_window_create_surface (GdkWindow *window,
420 #endif /* __GDK_INTERNALS_H__ */