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, see <http://www.gnu.org/licenses/>.
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
25 /* Uninstalled header defining types and functions internal to GDK */
27 #ifndef __GDK_INTERNALS_H__
28 #define __GDK_INTERNALS_H__
31 #include "gdkwindowimpl.h"
32 #include "gdkdisplay.h"
33 #include "gdkprivate.h"
37 /**********************
38 * General Facilities *
39 **********************/
41 /* Debugging support */
43 typedef struct _GdkColorInfo GdkColorInfo;
44 typedef struct _GdkEventFilter GdkEventFilter;
45 typedef struct _GdkClientFilter GdkClientFilter;
48 GDK_COLOR_WRITEABLE = 1 << 0
53 GdkColorInfoFlags flags;
58 GDK_EVENT_FILTER_REMOVED = 1 << 0
59 } GdkEventFilterFlags;
61 struct _GdkEventFilter {
62 GdkFilterFunc function;
64 GdkEventFilterFlags flags;
68 struct _GdkClientFilter {
70 GdkFilterFunc function;
75 GDK_DEBUG_MISC = 1 << 0,
76 GDK_DEBUG_EVENTS = 1 << 1,
77 GDK_DEBUG_DND = 1 << 2,
78 GDK_DEBUG_XIM = 1 << 3,
79 GDK_DEBUG_NOGRABS = 1 << 4,
80 GDK_DEBUG_INPUT = 1 << 5,
81 GDK_DEBUG_CURSOR = 1 << 6,
82 GDK_DEBUG_MULTIHEAD = 1 << 7,
83 GDK_DEBUG_XINERAMA = 1 << 8,
84 GDK_DEBUG_DRAW = 1 << 9,
85 GDK_DEBUG_EVENTLOOP = 1 << 10
89 GDK_RENDERING_MODE_SIMILAR = 0,
90 GDK_RENDERING_MODE_IMAGE,
91 GDK_RENDERING_MODE_RECORDING
94 extern GList *_gdk_default_filters;
95 extern GdkWindow *_gdk_parent_root;
97 extern guint _gdk_debug_flags;
98 extern GdkRenderingMode _gdk_rendering_mode;
100 #ifdef G_ENABLE_DEBUG
102 #define GDK_NOTE(type,action) G_STMT_START { \
103 if (_gdk_debug_flags & GDK_DEBUG_##type) \
104 { action; }; } G_STMT_END
106 #else /* !G_ENABLE_DEBUG */
108 #define GDK_NOTE(type,action)
110 #endif /* G_ENABLE_DEBUG */
123 typedef struct _GdkArgContext GdkArgContext;
124 typedef struct _GdkArgDesc GdkArgDesc;
126 typedef void (*GdkArgFunc) (const char *name, const char *arg, gpointer data);
128 struct _GdkArgContext
144 typedef struct _GdkEventPrivate GdkEventPrivate;
148 /* Following flag is set for events on the event queue during
149 * translation and cleared afterwards.
151 GDK_EVENT_PENDING = 1 << 0,
153 /* The following flag is set for:
154 * 1) touch events emulating pointer events
155 * 2) pointer events being emulated by a touch sequence.
157 GDK_EVENT_POINTER_EMULATED = 1 << 1
160 struct _GdkEventPrivate
165 gpointer windowing_data;
167 GdkDevice *source_device;
170 typedef struct _GdkWindowPaint GdkWindowPaint;
174 GObject parent_instance;
176 GdkWindowImpl *impl; /* window-system-specific delegate object */
186 GdkEventMask event_mask;
191 cairo_pattern_t *background;
195 cairo_region_t *update_area;
196 guint update_freeze_count;
202 gint8 toplevel_window_type;
205 GdkWindowState state;
207 guint guffaw_gravity : 1;
208 guint input_only : 1;
209 guint modal_hint : 1;
210 guint composited : 1;
211 guint has_alpha_background : 1;
215 guint accept_focus : 1;
216 guint focus_on_map : 1;
218 guint support_multidevice : 1;
219 guint synthesize_crossing_event_queued : 1;
220 guint effective_visibility : 2;
221 guint visibility : 2; /* The visibility wrt the toplevel (i.e. based on clip_region) */
222 guint native_visibility : 2; /* the native visibility of a impl windows */
223 guint viewable : 1; /* mapped and all parents mapped */
224 guint applied_shape : 1;
225 GdkFullscreenMode fullscreen_mode;
227 /* The GdkWindow that has the impl, ref:ed if another window.
228 * This ref is required to keep the wrapper of the impl window alive
229 * for as long as any GdkWindow references the impl. */
230 GdkWindow *impl_window;
232 guint update_and_descendants_freeze_count;
234 gint abs_x, abs_y; /* Absolute offset in impl */
237 /* The clip region is the part of the window, in window coordinates
238 that is fully or partially (i.e. semi transparently) visible in
239 the window hierarchy from the toplevel and down */
240 cairo_region_t *clip_region;
241 /* This is the clip region, with additionally all the opaque
242 child windows removed */
243 cairo_region_t *clip_region_with_children;
244 /* The layered region is the subset of clip_region that
245 is covered by non-opaque sibling or ancestor sibling window. */
246 cairo_region_t *layered_region;
249 GHashTable *device_cursor;
251 GSList *implicit_paint;
253 GList *outstanding_moves;
255 cairo_region_t *shape;
256 cairo_region_t *input_shape;
258 cairo_surface_t *cairo_surface;
260 GList *devices_inside;
261 GHashTable *device_events;
263 GHashTable *source_event_masks;
264 gulong device_added_handler_id;
265 gulong device_changed_handler_id;
267 guint num_offscreen_children;
269 GdkFrameClock *frame_clock; /* NULL to use from parent or default */
272 #define GDK_WINDOW_TYPE(d) (((GDK_WINDOW (d)))->window_type)
273 #define GDK_WINDOW_DESTROYED(d) (GDK_WINDOW (d)->destroyed)
275 extern gchar *_gdk_display_name;
276 extern gint _gdk_screen_number;
277 extern gchar *_gdk_display_arg_name;
278 extern gboolean _gdk_disable_multidevice;
280 GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
282 void _gdk_event_filter_unref (GdkWindow *window,
283 GdkEventFilter *filter);
285 void _gdk_event_set_pointer_emulated (GdkEvent *event,
287 gboolean _gdk_event_get_pointer_emulated (GdkEvent *event);
289 void _gdk_event_emit (GdkEvent *event);
290 GList* _gdk_event_queue_find_first (GdkDisplay *display);
291 void _gdk_event_queue_remove_link (GdkDisplay *display,
293 GList* _gdk_event_queue_prepend (GdkDisplay *display,
295 GList* _gdk_event_queue_append (GdkDisplay *display,
297 GList* _gdk_event_queue_insert_after (GdkDisplay *display,
298 GdkEvent *after_event,
300 GList* _gdk_event_queue_insert_before(GdkDisplay *display,
301 GdkEvent *after_event,
303 void _gdk_event_button_generate (GdkDisplay *display,
306 void _gdk_windowing_event_data_copy (const GdkEvent *src,
308 void _gdk_windowing_event_data_free (GdkEvent *event);
310 void gdk_synthesize_window_state (GdkWindow *window,
311 GdkWindowState unset_flags,
312 GdkWindowState set_flags);
314 gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
315 GdkRectangle *extents);
317 /*************************************
318 * Interfaces used by windowing code *
319 *************************************/
322 _gdk_window_ref_cairo_surface (GdkWindow *window);
324 void _gdk_window_destroy (GdkWindow *window,
325 gboolean foreign_destroy);
326 void _gdk_window_clear_update_area (GdkWindow *window);
327 void _gdk_window_update_size (GdkWindow *window);
328 gboolean _gdk_window_update_viewable (GdkWindow *window);
330 void _gdk_window_process_updates_recurse (GdkWindow *window,
331 cairo_region_t *expose_region);
333 void _gdk_screen_close (GdkScreen *screen);
335 /*****************************************
336 * Interfaces provided by windowing code *
337 *****************************************/
339 /* Font/string functions implemented in module-specific code */
341 void _gdk_cursor_destroy (GdkCursor *cursor);
343 extern const GOptionEntry _gdk_windowing_args[];
344 gchar *_gdk_windowing_substitute_screen_number (const gchar *display_name,
347 void _gdk_windowing_got_event (GdkDisplay *display,
352 #define GDK_WINDOW_IS_MAPPED(window) (((window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0)
354 #define GDK_TYPE_PAINTABLE (_gdk_paintable_get_type ())
355 #define GDK_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_PAINTABLE, GdkPaintable))
356 #define GDK_IS_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_PAINTABLE))
357 #define GDK_PAINTABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GDK_TYPE_PAINTABLE, GdkPaintableIface))
359 typedef struct _GdkPaintable GdkPaintable;
360 typedef struct _GdkPaintableIface GdkPaintableIface;
362 struct _GdkPaintableIface
364 GTypeInterface g_iface;
366 void (* begin_paint_region) (GdkPaintable *paintable,
368 const cairo_region_t *region);
369 void (* end_paint) (GdkPaintable *paintable);
372 GType _gdk_paintable_get_type (void) G_GNUC_CONST;
374 void _gdk_window_invalidate_for_expose (GdkWindow *window,
375 cairo_region_t *region);
377 GdkWindow * _gdk_window_find_child_at (GdkWindow *window,
379 GdkWindow * _gdk_window_find_descendant_at (GdkWindow *toplevel,
384 void _gdk_window_add_damage (GdkWindow *toplevel,
385 cairo_region_t *damaged_region);
387 GdkEvent * _gdk_make_event (GdkWindow *window,
389 GdkEvent *event_in_queue,
390 gboolean before_event);
391 gboolean _gdk_window_event_parent_of (GdkWindow *parent,
394 void _gdk_synthesize_crossing_events (GdkDisplay *display,
398 GdkDevice *source_device,
399 GdkCrossingMode mode,
402 GdkModifierType mask,
404 GdkEvent *event_in_queue,
406 gboolean non_linear);
407 void _gdk_display_set_window_under_pointer (GdkDisplay *display,
412 void _gdk_synthesize_crossing_events_for_geometry_change (GdkWindow *changed_window);
414 gboolean _gdk_window_has_impl (GdkWindow *window);
415 GdkWindow * _gdk_window_get_impl_window (GdkWindow *window);
417 /*****************************
418 * offscreen window routines *
419 *****************************/
420 GType gdk_offscreen_window_get_type (void);
421 void _gdk_offscreen_window_new (GdkWindow *window,
422 GdkWindowAttr *attributes,
423 gint attributes_mask);
424 cairo_surface_t * _gdk_offscreen_window_create_surface (GdkWindow *window,
431 #endif /* __GDK_INTERNALS_H__ */