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;
62 struct _GdkEventFilter {
63 GdkFilterFunc function;
67 struct _GdkClientFilter {
69 GdkFilterFunc function;
74 GDK_DEBUG_MISC = 1 << 0,
75 GDK_DEBUG_EVENTS = 1 << 1,
76 GDK_DEBUG_DND = 1 << 2,
77 GDK_DEBUG_XIM = 1 << 3,
78 GDK_DEBUG_NOGRABS = 1 << 4,
79 GDK_DEBUG_COLORMAP = 1 << 5,
80 GDK_DEBUG_INPUT = 1 << 6,
81 GDK_DEBUG_CURSOR = 1 << 7,
82 GDK_DEBUG_MULTIHEAD = 1 << 8,
83 GDK_DEBUG_XINERAMA = 1 << 9,
84 GDK_DEBUG_DRAW = 1 <<10,
85 GDK_DEBUG_EVENTLOOP = 1 <<11
88 extern GList *_gdk_default_filters;
89 extern GdkWindow *_gdk_parent_root;
91 extern guint _gdk_debug_flags;
92 extern gboolean _gdk_native_windows;
96 #define GDK_NOTE(type,action) G_STMT_START { \
97 if (_gdk_debug_flags & GDK_DEBUG_##type) \
98 { action; }; } G_STMT_END
100 #else /* !G_ENABLE_DEBUG */
102 #define GDK_NOTE(type,action)
104 #endif /* G_ENABLE_DEBUG */
117 typedef struct _GdkArgContext GdkArgContext;
118 typedef struct _GdkArgDesc GdkArgDesc;
120 typedef void (*GdkArgFunc) (const char *name, const char *arg, gpointer data);
122 struct _GdkArgContext
138 typedef struct _GdkEventPrivate GdkEventPrivate;
142 /* Following flag is set for events on the event queue during
143 * translation and cleared afterwards.
145 GDK_EVENT_PENDING = 1 << 0
148 struct _GdkEventPrivate
153 gpointer windowing_data;
157 /* Tracks information about the pointer grab on this display */
161 GdkWindow *native_window;
163 gulong serial_end; /* exclusive, i.e. not active on serial_end */
164 gboolean owner_events;
168 GdkGrabOwnership ownership;
171 guint implicit_ungrab : 1;
174 typedef struct _GdkInputWindow GdkInputWindow;
176 typedef void (* GdkDisplayPointerInfoForeach) (GdkDisplay *display,
178 GdkPointerWindowInfo *device_info,
181 /* Private version of GdkWindowObject. The initial part of this strucuture
182 is public for historical reasons. Don't change that part */
183 typedef struct _GdkWindowPaint GdkWindowPaint;
185 #define GDK_WINDOW_OBJECT(object) ((GdkWindowObject *) GDK_WINDOW (object))
187 struct _GdkWindowObject
189 GdkDrawable parent_instance;
191 GdkDrawable *impl; /* window-system-specific delegate object */
193 GdkWindowObject *parent;
201 gint extension_events;
206 cairo_pattern_t *background;
210 cairo_region_t *update_area;
211 guint update_freeze_count;
217 GdkWindowState state;
219 guint guffaw_gravity : 1;
220 guint input_only : 1;
221 guint modal_hint : 1;
222 guint composited : 1;
226 guint accept_focus : 1;
227 guint focus_on_map : 1;
229 guint support_multidevice : 1;
231 GdkEventMask event_mask;
233 guint update_and_descendants_freeze_count;
235 /* The GdkWindowObject that has the impl, ref:ed if another window.
236 * This ref is required to keep the wrapper of the impl window alive
237 * for as long as any GdkWindow references the impl. */
238 GdkWindowObject *impl_window;
239 int abs_x, abs_y; /* Absolute offset in impl */
242 cairo_region_t *clip_region; /* Clip region (wrt toplevel) in window coords */
243 cairo_region_t *clip_region_with_children; /* Clip region in window coords */
245 GHashTable *device_cursor;
246 gint8 toplevel_window_type;
247 guint synthesize_crossing_event_queued : 1;
248 guint effective_visibility : 2;
249 guint visibility : 2; /* The visibility wrt the toplevel (i.e. based on clip_region) */
250 guint native_visibility : 2; /* the native visibility of a impl windows */
251 guint viewable : 1; /* mapped and all parents mapped */
252 guint applied_shape : 1;
254 guint num_offscreen_children;
255 GdkWindowPaint *implicit_paint;
256 GdkInputWindow *input_window; /* only set for impl windows */
258 GList *outstanding_moves;
260 cairo_region_t *shape;
261 cairo_region_t *input_shape;
263 cairo_surface_t *cairo_surface;
264 guint outstanding_surfaces; /* only set on impl window */
266 GList *devices_inside;
267 GHashTable *device_events;
270 #define GDK_WINDOW_TYPE(d) (((GdkWindowObject*)(GDK_WINDOW (d)))->window_type)
271 #define GDK_WINDOW_DESTROYED(d) (((GdkWindowObject*)(GDK_WINDOW (d)))->destroyed)
273 extern GdkEventFunc _gdk_event_func; /* Callback for events */
274 extern gpointer _gdk_event_data;
275 extern GDestroyNotify _gdk_event_notify;
277 extern GSList *_gdk_displays;
278 extern gchar *_gdk_display_name;
279 extern gint _gdk_screen_number;
280 extern gchar *_gdk_display_arg_name;
281 extern gboolean _gdk_enable_multidevice;
283 void _gdk_events_queue (GdkDisplay *display);
284 GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
286 GList* _gdk_event_queue_find_first (GdkDisplay *display);
287 void _gdk_event_queue_remove_link (GdkDisplay *display,
289 GList* _gdk_event_queue_prepend (GdkDisplay *display,
291 GList* _gdk_event_queue_append (GdkDisplay *display,
293 GList* _gdk_event_queue_insert_after (GdkDisplay *display,
294 GdkEvent *after_event,
296 GList* _gdk_event_queue_insert_before(GdkDisplay *display,
297 GdkEvent *after_event,
299 void _gdk_event_button_generate (GdkDisplay *display,
302 void _gdk_windowing_event_data_copy (const GdkEvent *src,
304 void _gdk_windowing_event_data_free (GdkEvent *event);
306 void gdk_synthesize_window_state (GdkWindow *window,
307 GdkWindowState unset_flags,
308 GdkWindowState set_flags);
310 GdkDeviceManager * _gdk_device_manager_new (GdkDisplay *display);
312 gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
313 GdkRectangle *extents);
315 cairo_surface_t *_gdk_drawable_ref_cairo_surface (GdkDrawable *drawable);
317 cairo_surface_t * _gdk_drawable_create_cairo_surface (GdkDrawable *drawable,
321 /*************************************
322 * Interfaces used by windowing code *
323 *************************************/
325 void _gdk_window_impl_new (GdkWindow *window,
326 GdkWindow *real_parent,
328 GdkEventMask event_mask,
329 GdkWindowAttr *attributes,
330 gint attributes_mask);
331 void _gdk_window_destroy (GdkWindow *window,
332 gboolean foreign_destroy);
333 void _gdk_window_clear_update_area (GdkWindow *window);
334 void _gdk_window_update_size (GdkWindow *window);
335 gboolean _gdk_window_update_viewable (GdkWindow *window);
337 void _gdk_window_process_updates_recurse (GdkWindow *window,
338 cairo_region_t *expose_region);
340 void _gdk_screen_close (GdkScreen *screen);
342 const char *_gdk_get_sm_client_id (void);
344 /*****************************************
345 * Interfaces provided by windowing code *
346 *****************************************/
348 /* Font/string functions implemented in module-specific code */
350 void _gdk_cursor_destroy (GdkCursor *cursor);
352 void _gdk_windowing_init (void);
354 extern const GOptionEntry _gdk_windowing_args[];
355 void _gdk_windowing_set_default_display (GdkDisplay *display);
357 gchar *_gdk_windowing_substitute_screen_number (const gchar *display_name,
360 gulong _gdk_windowing_window_get_next_serial (GdkDisplay *display);
361 void _gdk_windowing_window_get_offsets (GdkWindow *window,
364 cairo_region_t *_gdk_windowing_window_get_shape (GdkWindow *window);
365 cairo_region_t *_gdk_windowing_window_get_input_shape(GdkWindow *window);
366 void _gdk_windowing_window_beep (GdkWindow *window);
369 void _gdk_windowing_get_device_state (GdkDisplay *display,
374 GdkModifierType *mask);
375 GdkWindow* _gdk_windowing_window_at_device_position (GdkDisplay *display,
379 GdkModifierType *mask,
380 gboolean get_toplevel);
381 GdkGrabStatus _gdk_windowing_device_grab (GdkDevice *device,
384 gboolean owner_events,
385 GdkEventMask event_mask,
386 GdkWindow *confine_to,
389 void _gdk_windowing_got_event (GdkDisplay *display,
394 void _gdk_windowing_window_process_updates_recurse (GdkWindow *window,
395 cairo_region_t *expose_region);
396 void _gdk_windowing_before_process_all_updates (void);
397 void _gdk_windowing_after_process_all_updates (void);
399 /* Return the number of bits-per-pixel for images of the specified depth. */
400 gint _gdk_windowing_get_bits_for_depth (GdkDisplay *display,
404 #define GDK_WINDOW_IS_MAPPED(window) ((((GdkWindowObject*)window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0)
407 /* Called when gdk_window_destroy() is called on a foreign window
408 * or an ancestor of the foreign window. It should generally reparent
409 * the window out of it's current heirarchy, hide it, and then
410 * send a message to the owner requesting that the window be destroyed.
412 void _gdk_windowing_window_destroy_foreign (GdkWindow *window);
414 void _gdk_windowing_display_set_sm_client_id (GdkDisplay *display,
415 const gchar *sm_client_id);
417 void _gdk_windowing_window_set_composited (GdkWindow *window,
418 gboolean composited);
420 #define GDK_TYPE_PAINTABLE (_gdk_paintable_get_type ())
421 #define GDK_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_PAINTABLE, GdkPaintable))
422 #define GDK_IS_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_PAINTABLE))
423 #define GDK_PAINTABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GDK_TYPE_PAINTABLE, GdkPaintableIface))
425 typedef struct _GdkPaintable GdkPaintable;
426 typedef struct _GdkPaintableIface GdkPaintableIface;
428 struct _GdkPaintableIface
430 GTypeInterface g_iface;
432 void (* begin_paint_region) (GdkPaintable *paintable,
434 const cairo_region_t *region);
435 void (* end_paint) (GdkPaintable *paintable);
438 GType _gdk_paintable_get_type (void) G_GNUC_CONST;
440 /* Implementation types */
441 GType _gdk_window_impl_get_type (void) G_GNUC_CONST;
443 struct GdkAppLaunchContextPrivate
453 char *_gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
456 void _gdk_windowing_launch_failed (GAppLaunchContext *context,
457 const char *startup_notify_id);
459 void _gdk_display_device_grab_update (GdkDisplay *display,
461 gulong current_serial);
462 GdkDeviceGrabInfo *_gdk_display_get_last_device_grab (GdkDisplay *display,
464 GdkDeviceGrabInfo *_gdk_display_add_device_grab (GdkDisplay *display,
467 GdkWindow *native_window,
468 GdkGrabOwnership grab_ownership,
469 gboolean owner_events,
470 GdkEventMask event_mask,
471 unsigned long serial_start,
474 GdkDeviceGrabInfo * _gdk_display_has_device_grab (GdkDisplay *display,
477 gboolean _gdk_display_end_device_grab (GdkDisplay *display,
482 gboolean _gdk_display_check_grab_ownership (GdkDisplay *display,
485 void _gdk_display_enable_motion_hints (GdkDisplay *display,
488 GdkPointerWindowInfo * _gdk_display_get_pointer_info (GdkDisplay *display,
491 void _gdk_display_pointer_info_foreach (GdkDisplay *display,
492 GdkDisplayPointerInfoForeach func,
495 void _gdk_window_invalidate_for_expose (GdkWindow *window,
496 cairo_region_t *region);
498 gboolean _gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface,
502 GdkWindow * _gdk_window_find_child_at (GdkWindow *window,
504 GdkWindow * _gdk_window_find_descendant_at (GdkWindow *toplevel,
509 void _gdk_window_add_damage (GdkWindow *toplevel,
510 cairo_region_t *damaged_region);
512 GdkEvent * _gdk_make_event (GdkWindow *window,
514 GdkEvent *event_in_queue,
515 gboolean before_event);
516 gboolean _gdk_window_event_parent_of (GdkWindow *parent,
519 void _gdk_synthesize_crossing_events (GdkDisplay *display,
523 GdkCrossingMode mode,
526 GdkModifierType mask,
528 GdkEvent *event_in_queue,
530 gboolean non_linear);
531 void _gdk_display_set_window_under_pointer (GdkDisplay *display,
536 void _gdk_synthesize_crossing_events_for_geometry_change (GdkWindow *changed_window);
538 cairo_region_t *_gdk_window_calculate_full_clip_region (GdkWindow *window,
539 GdkWindow *base_window,
540 gboolean do_children,
542 gint *base_y_offset);
543 gboolean _gdk_window_has_impl (GdkWindow *window);
544 GdkWindow * _gdk_window_get_impl_window (GdkWindow *window);
545 GdkWindow *_gdk_window_get_input_window_for_event (GdkWindow *native_window,
546 GdkEventType event_type,
550 /*****************************
551 * offscreen window routines *
552 *****************************/
553 GType gdk_offscreen_window_get_type (void);
554 void _gdk_offscreen_window_new (GdkWindow *window,
556 GdkWindowAttr *attributes,
557 gint attributes_mask);
560 /************************************
561 * Initialization and exit routines *
562 ************************************/
564 void _gdk_windowing_exit (void);
568 #endif /* __GDK_INTERNALS_H__ */