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 <gdk/gdktypes.h>
34 #include <gdk/gdkwindow.h>
35 #include <gdk/gdkprivate.h>
37 #include <gdk/gdkmedialib.h>
42 /**********************
43 * General Facilities *
44 **********************/
46 /* Debugging support */
48 typedef struct _GdkColorInfo GdkColorInfo;
49 typedef struct _GdkEventFilter GdkEventFilter;
50 typedef struct _GdkClientFilter GdkClientFilter;
53 GDK_COLOR_WRITEABLE = 1 << 0
58 GdkColorInfoFlags flags;
63 GDK_EVENT_FILTER_REMOVED = 1 << 0
64 } GdkEventFilterFlags;
66 struct _GdkEventFilter {
67 GdkFilterFunc function;
69 GdkEventFilterFlags flags;
73 struct _GdkClientFilter {
75 GdkFilterFunc function;
80 GDK_DEBUG_MISC = 1 << 0,
81 GDK_DEBUG_EVENTS = 1 << 1,
82 GDK_DEBUG_DND = 1 << 2,
83 GDK_DEBUG_XIM = 1 << 3,
84 GDK_DEBUG_NOGRABS = 1 << 4,
85 GDK_DEBUG_COLORMAP = 1 << 5,
86 GDK_DEBUG_INPUT = 1 << 6,
87 GDK_DEBUG_CURSOR = 1 << 7,
88 GDK_DEBUG_MULTIHEAD = 1 << 8,
89 GDK_DEBUG_XINERAMA = 1 << 9,
90 GDK_DEBUG_DRAW = 1 <<10,
91 GDK_DEBUG_EVENTLOOP = 1 <<11
94 extern GList *_gdk_default_filters;
95 extern GdkWindow *_gdk_parent_root;
97 extern guint _gdk_debug_flags;
98 extern gboolean _gdk_native_windows;
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
154 struct _GdkEventPrivate
159 gpointer windowing_data;
163 /* Tracks information about the pointer grab on this display */
167 GdkWindow *native_window;
169 gulong serial_end; /* exclusive, i.e. not active on serial_end */
170 gboolean owner_events;
174 GdkGrabOwnership ownership;
177 guint implicit_ungrab : 1;
180 typedef struct _GdkInputWindow GdkInputWindow;
182 typedef void (* GdkDisplayPointerInfoForeach) (GdkDisplay *display,
184 GdkPointerWindowInfo *device_info,
187 /* Private version of GdkWindowObject. The initial part of this strucuture
188 is public for historical reasons. Don't change that part */
189 typedef struct _GdkWindowPaint GdkWindowPaint;
191 #define GDK_WINDOW_OBJECT(object) ((GdkWindowObject *) GDK_WINDOW (object))
193 struct _GdkWindowObject
195 GdkDrawable parent_instance;
197 GdkDrawable *impl; /* window-system-specific delegate object */
199 GdkWindowObject *parent;
207 gint extension_events;
212 cairo_pattern_t *background;
216 cairo_region_t *update_area;
217 guint update_freeze_count;
223 GdkWindowState state;
225 guint guffaw_gravity : 1;
226 guint input_only : 1;
227 guint modal_hint : 1;
228 guint composited : 1;
232 guint accept_focus : 1;
233 guint focus_on_map : 1;
235 guint support_multidevice : 1;
237 GdkEventMask event_mask;
239 guint update_and_descendants_freeze_count;
241 /* The GdkWindowObject that has the impl, ref:ed if another window.
242 * This ref is required to keep the wrapper of the impl window alive
243 * for as long as any GdkWindow references the impl. */
244 GdkWindowObject *impl_window;
245 int abs_x, abs_y; /* Absolute offset in impl */
248 cairo_region_t *clip_region; /* Clip region (wrt toplevel) in window coords */
249 cairo_region_t *clip_region_with_children; /* Clip region in window coords */
251 GHashTable *device_cursor;
252 gint8 toplevel_window_type;
253 guint synthesize_crossing_event_queued : 1;
254 guint effective_visibility : 2;
255 guint visibility : 2; /* The visibility wrt the toplevel (i.e. based on clip_region) */
256 guint native_visibility : 2; /* the native visibility of a impl windows */
257 guint viewable : 1; /* mapped and all parents mapped */
258 guint applied_shape : 1;
260 guint num_offscreen_children;
261 GdkWindowPaint *implicit_paint;
262 GdkInputWindow *input_window; /* only set for impl windows */
264 GList *outstanding_moves;
266 cairo_region_t *shape;
267 cairo_region_t *input_shape;
269 cairo_surface_t *cairo_surface;
270 guint outstanding_surfaces; /* only set on impl window */
272 GList *devices_inside;
273 GHashTable *device_events;
276 #define GDK_WINDOW_TYPE(d) (((GdkWindowObject*)(GDK_WINDOW (d)))->window_type)
277 #define GDK_WINDOW_DESTROYED(d) (((GdkWindowObject*)(GDK_WINDOW (d)))->destroyed)
279 extern GdkEventFunc _gdk_event_func; /* Callback for events */
280 extern gpointer _gdk_event_data;
281 extern GDestroyNotify _gdk_event_notify;
283 extern GSList *_gdk_displays;
284 extern gchar *_gdk_display_name;
285 extern gint _gdk_screen_number;
286 extern gchar *_gdk_display_arg_name;
287 extern gboolean _gdk_enable_multidevice;
289 void _gdk_events_queue (GdkDisplay *display);
290 GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
292 GList* _gdk_event_queue_find_first (GdkDisplay *display);
293 void _gdk_event_queue_remove_link (GdkDisplay *display,
295 GList* _gdk_event_queue_prepend (GdkDisplay *display,
297 GList* _gdk_event_queue_append (GdkDisplay *display,
299 GList* _gdk_event_queue_insert_after (GdkDisplay *display,
300 GdkEvent *after_event,
302 GList* _gdk_event_queue_insert_before(GdkDisplay *display,
303 GdkEvent *after_event,
305 void _gdk_event_button_generate (GdkDisplay *display,
308 void _gdk_windowing_event_data_copy (const GdkEvent *src,
310 void _gdk_windowing_event_data_free (GdkEvent *event);
312 void gdk_synthesize_window_state (GdkWindow *window,
313 GdkWindowState unset_flags,
314 GdkWindowState set_flags);
316 GdkDeviceManager * _gdk_device_manager_new (GdkDisplay *display);
318 gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
319 GdkRectangle *extents);
321 cairo_surface_t *_gdk_drawable_ref_cairo_surface (GdkDrawable *drawable);
323 cairo_surface_t * _gdk_drawable_create_cairo_surface (GdkDrawable *drawable,
327 /*************************************
328 * Interfaces used by windowing code *
329 *************************************/
331 void _gdk_window_impl_new (GdkWindow *window,
332 GdkWindow *real_parent,
334 GdkEventMask event_mask,
335 GdkWindowAttr *attributes,
336 gint attributes_mask);
337 void _gdk_window_destroy (GdkWindow *window,
338 gboolean foreign_destroy);
339 void _gdk_window_clear_update_area (GdkWindow *window);
340 void _gdk_window_update_size (GdkWindow *window);
341 gboolean _gdk_window_update_viewable (GdkWindow *window);
343 void _gdk_window_process_updates_recurse (GdkWindow *window,
344 cairo_region_t *expose_region);
346 void _gdk_screen_close (GdkScreen *screen);
348 const char *_gdk_get_sm_client_id (void);
350 /*****************************************
351 * Interfaces provided by windowing code *
352 *****************************************/
354 /* Font/string functions implemented in module-specific code */
356 void _gdk_cursor_destroy (GdkCursor *cursor);
358 void _gdk_windowing_init (void);
360 extern const GOptionEntry _gdk_windowing_args[];
361 void _gdk_windowing_set_default_display (GdkDisplay *display);
363 gchar *_gdk_windowing_substitute_screen_number (const gchar *display_name,
366 gulong _gdk_windowing_window_get_next_serial (GdkDisplay *display);
367 void _gdk_windowing_window_get_offsets (GdkWindow *window,
370 cairo_region_t *_gdk_windowing_window_get_shape (GdkWindow *window);
371 cairo_region_t *_gdk_windowing_window_get_input_shape(GdkWindow *window);
372 void _gdk_windowing_window_beep (GdkWindow *window);
375 void _gdk_windowing_get_device_state (GdkDisplay *display,
380 GdkModifierType *mask);
381 GdkWindow* _gdk_windowing_window_at_device_position (GdkDisplay *display,
385 GdkModifierType *mask,
386 gboolean get_toplevel);
387 GdkGrabStatus _gdk_windowing_device_grab (GdkDevice *device,
390 gboolean owner_events,
391 GdkEventMask event_mask,
392 GdkWindow *confine_to,
395 void _gdk_windowing_got_event (GdkDisplay *display,
400 void _gdk_windowing_window_process_updates_recurse (GdkWindow *window,
401 cairo_region_t *expose_region);
402 void _gdk_windowing_before_process_all_updates (void);
403 void _gdk_windowing_after_process_all_updates (void);
405 /* Return the number of bits-per-pixel for images of the specified depth. */
406 gint _gdk_windowing_get_bits_for_depth (GdkDisplay *display,
410 #define GDK_WINDOW_IS_MAPPED(window) ((((GdkWindowObject*)window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0)
413 /* Called when gdk_window_destroy() is called on a foreign window
414 * or an ancestor of the foreign window. It should generally reparent
415 * the window out of it's current heirarchy, hide it, and then
416 * send a message to the owner requesting that the window be destroyed.
418 void _gdk_windowing_window_destroy_foreign (GdkWindow *window);
420 void _gdk_windowing_display_set_sm_client_id (GdkDisplay *display,
421 const gchar *sm_client_id);
423 void _gdk_windowing_window_set_composited (GdkWindow *window,
424 gboolean composited);
426 #define GDK_TYPE_PAINTABLE (_gdk_paintable_get_type ())
427 #define GDK_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_PAINTABLE, GdkPaintable))
428 #define GDK_IS_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_PAINTABLE))
429 #define GDK_PAINTABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GDK_TYPE_PAINTABLE, GdkPaintableIface))
431 typedef struct _GdkPaintable GdkPaintable;
432 typedef struct _GdkPaintableIface GdkPaintableIface;
434 struct _GdkPaintableIface
436 GTypeInterface g_iface;
438 void (* begin_paint_region) (GdkPaintable *paintable,
440 const cairo_region_t *region);
441 void (* end_paint) (GdkPaintable *paintable);
444 GType _gdk_paintable_get_type (void) G_GNUC_CONST;
446 /* Implementation types */
447 GType _gdk_window_impl_get_type (void) G_GNUC_CONST;
449 struct GdkAppLaunchContextPrivate
459 char *_gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
462 void _gdk_windowing_launch_failed (GAppLaunchContext *context,
463 const char *startup_notify_id);
465 void _gdk_display_device_grab_update (GdkDisplay *display,
467 gulong current_serial);
468 GdkDeviceGrabInfo *_gdk_display_get_last_device_grab (GdkDisplay *display,
470 GdkDeviceGrabInfo *_gdk_display_add_device_grab (GdkDisplay *display,
473 GdkWindow *native_window,
474 GdkGrabOwnership grab_ownership,
475 gboolean owner_events,
476 GdkEventMask event_mask,
477 unsigned long serial_start,
480 GdkDeviceGrabInfo * _gdk_display_has_device_grab (GdkDisplay *display,
483 gboolean _gdk_display_end_device_grab (GdkDisplay *display,
488 gboolean _gdk_display_check_grab_ownership (GdkDisplay *display,
491 void _gdk_display_enable_motion_hints (GdkDisplay *display,
494 GdkPointerWindowInfo * _gdk_display_get_pointer_info (GdkDisplay *display,
497 void _gdk_display_pointer_info_foreach (GdkDisplay *display,
498 GdkDisplayPointerInfoForeach func,
501 void _gdk_window_invalidate_for_expose (GdkWindow *window,
502 cairo_region_t *region);
504 GdkWindow * _gdk_window_find_child_at (GdkWindow *window,
506 GdkWindow * _gdk_window_find_descendant_at (GdkWindow *toplevel,
511 void _gdk_window_add_damage (GdkWindow *toplevel,
512 cairo_region_t *damaged_region);
514 GdkEvent * _gdk_make_event (GdkWindow *window,
516 GdkEvent *event_in_queue,
517 gboolean before_event);
518 gboolean _gdk_window_event_parent_of (GdkWindow *parent,
521 void _gdk_synthesize_crossing_events (GdkDisplay *display,
525 GdkCrossingMode mode,
528 GdkModifierType mask,
530 GdkEvent *event_in_queue,
532 gboolean non_linear);
533 void _gdk_display_set_window_under_pointer (GdkDisplay *display,
538 void _gdk_synthesize_crossing_events_for_geometry_change (GdkWindow *changed_window);
540 cairo_region_t *_gdk_window_calculate_full_clip_region (GdkWindow *window,
541 GdkWindow *base_window,
542 gboolean do_children,
544 gint *base_y_offset);
545 gboolean _gdk_window_has_impl (GdkWindow *window);
546 GdkWindow * _gdk_window_get_impl_window (GdkWindow *window);
547 GdkWindow *_gdk_window_get_input_window_for_event (GdkWindow *native_window,
548 GdkEventType event_type,
552 /*****************************
553 * offscreen window routines *
554 *****************************/
555 GType gdk_offscreen_window_get_type (void);
556 void _gdk_offscreen_window_new (GdkWindow *window,
557 GdkWindowAttr *attributes,
558 gint attributes_mask);
559 cairo_surface_t * _gdk_offscreen_window_create_surface (GdkWindow *window,
564 /************************************
565 * Initialization and exit routines *
566 ************************************/
568 void _gdk_windowing_exit (void);
572 #endif /* __GDK_INTERNALS_H__ */