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 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
28 #error "Only <gdk/gdk.h> can be included directly."
31 #ifndef __GDK_WINDOW_H__
32 #define __GDK_WINDOW_H__
34 #include <gdk/gdkdrawable.h>
35 #include <gdk/gdktypes.h>
36 #include <gdk/gdkevents.h>
40 typedef struct _GdkGeometry GdkGeometry;
41 typedef struct _GdkWindowAttr GdkWindowAttr;
42 typedef struct _GdkPointerHooks GdkPointerHooks;
43 typedef struct _GdkOffscreenChildHooks GdkOffscreenChildHooks;
44 typedef struct _GdkWindowRedirect GdkWindowRedirect;
45 typedef struct _GdkWindowPaint GdkWindowPaint;
47 /* Classes of windows.
48 * InputOutput: Almost every window should be of this type. Such windows
49 * receive events and are also displayed on screen.
50 * InputOnly: Used only in special circumstances when events need to be
51 * stolen from another window or windows. Input only windows
52 * have no visible output, so they are handy for placing over
53 * top of a group of windows in order to grab the events (or
54 * filter the events) from those windows.
63 * Root: There is only 1 root window and it is initialized
64 * at startup. Creating a window of type GDK_WINDOW_ROOT
66 * Toplevel: Windows which interact with the window manager.
67 * Child: Windows which are children of some other type of window.
68 * (Any other type of window). Most windows are child windows.
69 * Dialog: A special kind of toplevel window which interacts with
70 * the window manager slightly differently than a regular
71 * toplevel window. Dialog windows should be used for any
73 * Foreign: A window that actually belongs to another application
86 /* Window attribute mask values.
87 * GDK_WA_TITLE: The "title" field is valid.
88 * GDK_WA_X: The "x" field is valid.
89 * GDK_WA_Y: The "y" field is valid.
90 * GDK_WA_CURSOR: The "cursor" field is valid.
91 * GDK_WA_COLORMAP: The "colormap" field is valid.
92 * GDK_WA_VISUAL: The "visual" field is valid.
96 GDK_WA_TITLE = 1 << 1,
99 GDK_WA_CURSOR = 1 << 4,
100 GDK_WA_COLORMAP = 1 << 5,
101 GDK_WA_VISUAL = 1 << 6,
102 GDK_WA_WMCLASS = 1 << 7,
103 GDK_WA_NOREDIR = 1 << 8,
104 GDK_WA_TYPE_HINT = 1 << 9
105 } GdkWindowAttributesType;
107 /* Size restriction enumeration.
111 GDK_HINT_POS = 1 << 0,
112 GDK_HINT_MIN_SIZE = 1 << 1,
113 GDK_HINT_MAX_SIZE = 1 << 2,
114 GDK_HINT_BASE_SIZE = 1 << 3,
115 GDK_HINT_ASPECT = 1 << 4,
116 GDK_HINT_RESIZE_INC = 1 << 5,
117 GDK_HINT_WIN_GRAVITY = 1 << 6,
118 GDK_HINT_USER_POS = 1 << 7,
119 GDK_HINT_USER_SIZE = 1 << 8
123 /* Window type hints.
124 * These are hints for the window manager that indicate
125 * what type of function the window has. The window manager
126 * can use this when determining decoration and behaviour
127 * of the window. The hint must be set before mapping the
130 * Normal: Normal toplevel window
131 * Dialog: Dialog window
132 * Menu: Window used to implement a menu.
133 * Toolbar: Window used to implement toolbars.
137 GDK_WINDOW_TYPE_HINT_NORMAL,
138 GDK_WINDOW_TYPE_HINT_DIALOG,
139 GDK_WINDOW_TYPE_HINT_MENU, /* Torn off menu */
140 GDK_WINDOW_TYPE_HINT_TOOLBAR,
141 GDK_WINDOW_TYPE_HINT_SPLASHSCREEN,
142 GDK_WINDOW_TYPE_HINT_UTILITY,
143 GDK_WINDOW_TYPE_HINT_DOCK,
144 GDK_WINDOW_TYPE_HINT_DESKTOP,
145 GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU, /* A drop down menu (from a menubar) */
146 GDK_WINDOW_TYPE_HINT_POPUP_MENU, /* A popup menu (from right-click) */
147 GDK_WINDOW_TYPE_HINT_TOOLTIP,
148 GDK_WINDOW_TYPE_HINT_NOTIFICATION,
149 GDK_WINDOW_TYPE_HINT_COMBO,
150 GDK_WINDOW_TYPE_HINT_DND
153 /* The next two enumeration values current match the
154 * Motif constants. If this is changed, the implementation
155 * of gdk_window_set_decorations/gdk_window_set_functions
156 * will need to change as well.
160 GDK_DECOR_ALL = 1 << 0,
161 GDK_DECOR_BORDER = 1 << 1,
162 GDK_DECOR_RESIZEH = 1 << 2,
163 GDK_DECOR_TITLE = 1 << 3,
164 GDK_DECOR_MENU = 1 << 4,
165 GDK_DECOR_MINIMIZE = 1 << 5,
166 GDK_DECOR_MAXIMIZE = 1 << 6
171 GDK_FUNC_ALL = 1 << 0,
172 GDK_FUNC_RESIZE = 1 << 1,
173 GDK_FUNC_MOVE = 1 << 2,
174 GDK_FUNC_MINIMIZE = 1 << 3,
175 GDK_FUNC_MAXIMIZE = 1 << 4,
176 GDK_FUNC_CLOSE = 1 << 5
179 /* Currently, these are the same values numerically as in the
180 * X protocol. If you change that, gdkwindow-x11.c/gdk_window_set_geometry_hints()
185 GDK_GRAVITY_NORTH_WEST = 1,
187 GDK_GRAVITY_NORTH_EAST,
191 GDK_GRAVITY_SOUTH_WEST,
193 GDK_GRAVITY_SOUTH_EAST,
200 GDK_WINDOW_EDGE_NORTH_WEST,
201 GDK_WINDOW_EDGE_NORTH,
202 GDK_WINDOW_EDGE_NORTH_EAST,
203 GDK_WINDOW_EDGE_WEST,
204 GDK_WINDOW_EDGE_EAST,
205 GDK_WINDOW_EDGE_SOUTH_WEST,
206 GDK_WINDOW_EDGE_SOUTH,
207 GDK_WINDOW_EDGE_SOUTH_EAST
210 struct _GdkWindowAttr
217 GdkWindowClass wclass;
219 GdkColormap *colormap;
220 GdkWindowType window_type;
223 gchar *wmclass_class;
224 gboolean override_redirect;
225 GdkWindowTypeHint type_hint;
240 GdkGravity win_gravity;
243 struct _GdkPointerHooks
245 GdkWindow* (*get_pointer) (GdkWindow *window,
248 GdkModifierType *mask);
249 GdkWindow* (*window_at_pointer) (GdkScreen *screen, /* unused */
254 struct _GdkOffscreenChildHooks
256 void (*from_parent) (GdkWindow *offscreen_child,
261 void (*to_parent) (GdkWindow *offscreen_child,
268 typedef struct _GdkWindowObject GdkWindowObject;
269 typedef struct _GdkWindowObjectClass GdkWindowObjectClass;
271 #define GDK_TYPE_WINDOW (gdk_window_object_get_type ())
272 #define GDK_WINDOW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW, GdkWindow))
273 #define GDK_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW, GdkWindowObjectClass))
274 #define GDK_IS_WINDOW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW))
275 #define GDK_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW))
276 #define GDK_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW, GdkWindowObjectClass))
277 #define GDK_WINDOW_OBJECT(object) ((GdkWindowObject *) GDK_WINDOW (object))
279 struct _GdkWindowObject
281 GdkDrawable parent_instance;
283 GdkDrawable *impl; /* window-system-specific delegate object */
285 GdkWindowObject *parent;
292 gint extension_events;
298 GdkPixmap *bg_pixmap;
302 GdkRegion *update_area;
303 guint update_freeze_count;
309 GdkWindowState state;
311 guint guffaw_gravity : 1;
312 guint input_only : 1;
313 guint modal_hint : 1;
314 guint composited : 1;
318 guint accept_focus : 1;
319 guint focus_on_map : 1;
322 GdkEventMask event_mask;
324 guint update_and_descendants_freeze_count;
326 GdkWindowRedirect *redirect;
327 const GdkOffscreenChildHooks *offscreen_hooks;
329 int abs_x, abs_y; /* Absolute offset in impl */
332 GdkRegion *clip_region; /* Clip region (wrt toplevel) in window coords */
333 GdkRegion *clip_region_with_children; /* Clip region in window coords */
334 GdkColormap *colormap;
336 gint8 toplevel_window_type;
338 GdkWindowPaint *implicit_paint;
340 cairo_surface_t *cairo_surface;
343 struct _GdkWindowObjectClass
345 GdkDrawableClass parent_class;
350 GType gdk_window_object_get_type (void) G_GNUC_CONST;
351 GdkWindow* gdk_window_new (GdkWindow *parent,
352 GdkWindowAttr *attributes,
353 gint attributes_mask);
354 void gdk_window_destroy (GdkWindow *window);
355 GdkWindowType gdk_window_get_window_type (GdkWindow *window);
356 GdkWindow* gdk_window_at_pointer (gint *win_x,
358 void gdk_window_show (GdkWindow *window);
359 void gdk_window_hide (GdkWindow *window);
360 void gdk_window_withdraw (GdkWindow *window);
361 void gdk_window_show_unraised (GdkWindow *window);
362 void gdk_window_move (GdkWindow *window,
365 void gdk_window_resize (GdkWindow *window,
368 void gdk_window_move_resize (GdkWindow *window,
373 void gdk_window_reparent (GdkWindow *window,
374 GdkWindow *new_parent,
377 void gdk_window_clear (GdkWindow *window);
378 void gdk_window_clear_area (GdkWindow *window,
383 void gdk_window_clear_area_e (GdkWindow *window,
388 void gdk_window_raise (GdkWindow *window);
389 void gdk_window_lower (GdkWindow *window);
390 void gdk_window_focus (GdkWindow *window,
392 void gdk_window_set_user_data (GdkWindow *window,
394 void gdk_window_set_override_redirect (GdkWindow *window,
395 gboolean override_redirect);
396 void gdk_window_set_accept_focus (GdkWindow *window,
397 gboolean accept_focus);
398 void gdk_window_set_focus_on_map (GdkWindow *window,
399 gboolean focus_on_map);
400 void gdk_window_add_filter (GdkWindow *window,
401 GdkFilterFunc function,
403 void gdk_window_remove_filter (GdkWindow *window,
404 GdkFilterFunc function,
406 void gdk_window_scroll (GdkWindow *window,
409 void gdk_window_move_region (GdkWindow *window,
410 const GdkRegion *region,
413 void gdk_window_set_has_native (GdkWindow *window,
414 gboolean has_native);
417 * This allows for making shaped (partially transparent) windows
418 * - cool feature, needed for Drag and Drag for example.
419 * The shape_mask can be the mask
420 * from gdk_pixmap_create_from_xpm. Stefan Wille
422 void gdk_window_shape_combine_mask (GdkWindow *window,
426 void gdk_window_shape_combine_region (GdkWindow *window,
427 const GdkRegion *shape_region,
432 * This routine allows you to quickly take the shapes of all the child windows
433 * of a window and use their shapes as the shape mask for this window - useful
434 * for container windows that dont want to look like a big box
438 void gdk_window_set_child_shapes (GdkWindow *window);
440 void gdk_window_set_composited (GdkWindow *window,
441 gboolean composited);
444 * This routine allows you to merge (ie ADD) child shapes to your
445 * own window's shape keeping its current shape and ADDING the child
450 void gdk_window_merge_child_shapes (GdkWindow *window);
452 void gdk_window_input_shape_combine_mask (GdkWindow *window,
456 void gdk_window_input_shape_combine_region (GdkWindow *window,
457 const GdkRegion *shape_region,
460 void gdk_window_set_child_input_shapes (GdkWindow *window);
461 void gdk_window_merge_child_input_shapes (GdkWindow *window);
465 * Check if a window has been shown, and whether all its
466 * parents up to a toplevel have been shown, respectively.
467 * Note that a window that is_viewable below is not necessarily
468 * viewable in the X sense.
470 gboolean gdk_window_is_visible (GdkWindow *window);
471 gboolean gdk_window_is_viewable (GdkWindow *window);
473 GdkWindowState gdk_window_get_state (GdkWindow *window);
475 /* Set static bit gravity on the parent, and static
476 * window gravity on all children.
478 gboolean gdk_window_set_static_gravities (GdkWindow *window,
479 gboolean use_static);
481 /* Functions to create/lookup windows from their native equivalents */
482 #ifndef GDK_MULTIHEAD_SAFE
483 GdkWindow* gdk_window_foreign_new (GdkNativeWindow anid);
484 GdkWindow* gdk_window_lookup (GdkNativeWindow anid);
486 GdkWindow *gdk_window_foreign_new_for_display (GdkDisplay *display,
487 GdkNativeWindow anid);
488 GdkWindow* gdk_window_lookup_for_display (GdkDisplay *display,
489 GdkNativeWindow anid);
494 #ifndef GDK_DISABLE_DEPRECATED
495 void gdk_window_set_hints (GdkWindow *window,
504 void gdk_window_set_type_hint (GdkWindow *window,
505 GdkWindowTypeHint hint);
506 GdkWindowTypeHint gdk_window_get_type_hint (GdkWindow *window);
508 void gdk_window_set_modal_hint (GdkWindow *window,
511 void gdk_window_set_skip_taskbar_hint (GdkWindow *window,
512 gboolean skips_taskbar);
513 void gdk_window_set_skip_pager_hint (GdkWindow *window,
514 gboolean skips_pager);
515 void gdk_window_set_urgency_hint (GdkWindow *window,
518 void gdk_window_set_geometry_hints (GdkWindow *window,
519 const GdkGeometry *geometry,
520 GdkWindowHints geom_mask);
521 void gdk_set_sm_client_id (const gchar *sm_client_id);
523 void gdk_window_begin_paint_rect (GdkWindow *window,
524 const GdkRectangle *rectangle);
525 void gdk_window_begin_paint_region (GdkWindow *window,
526 const GdkRegion *region);
527 void gdk_window_end_paint (GdkWindow *window);
529 void gdk_window_set_title (GdkWindow *window,
531 void gdk_window_set_role (GdkWindow *window,
533 void gdk_window_set_startup_id (GdkWindow *window,
534 const gchar *startup_id);
535 void gdk_window_set_transient_for (GdkWindow *window,
537 void gdk_window_set_background (GdkWindow *window,
538 const GdkColor *color);
539 void gdk_window_set_back_pixmap (GdkWindow *window,
541 gboolean parent_relative);
542 void gdk_window_set_cursor (GdkWindow *window,
544 void gdk_window_get_user_data (GdkWindow *window,
546 void gdk_window_get_geometry (GdkWindow *window,
552 void gdk_window_get_position (GdkWindow *window,
555 gint gdk_window_get_origin (GdkWindow *window,
559 #if !defined (GDK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION)
560 /* Used by gtk_handle_box_button_changed () */
561 gboolean gdk_window_get_deskrelative_origin (GdkWindow *window,
566 void gdk_window_get_root_origin (GdkWindow *window,
569 void gdk_window_get_frame_extents (GdkWindow *window,
571 GdkWindow* gdk_window_get_pointer (GdkWindow *window,
574 GdkModifierType *mask);
575 GdkWindow * gdk_window_get_parent (GdkWindow *window);
576 GdkWindow * gdk_window_get_toplevel (GdkWindow *window);
578 GList * gdk_window_get_children (GdkWindow *window);
579 GList * gdk_window_peek_children (GdkWindow *window);
580 GdkEventMask gdk_window_get_events (GdkWindow *window);
581 void gdk_window_set_events (GdkWindow *window,
582 GdkEventMask event_mask);
584 void gdk_window_set_icon_list (GdkWindow *window,
586 void gdk_window_set_icon (GdkWindow *window,
587 GdkWindow *icon_window,
590 void gdk_window_set_icon_name (GdkWindow *window,
592 void gdk_window_set_group (GdkWindow *window,
594 GdkWindow* gdk_window_get_group (GdkWindow *window);
595 void gdk_window_set_decorations (GdkWindow *window,
596 GdkWMDecoration decorations);
597 gboolean gdk_window_get_decorations (GdkWindow *window,
598 GdkWMDecoration *decorations);
599 void gdk_window_set_functions (GdkWindow *window,
600 GdkWMFunction functions);
601 #if !defined(GDK_MULTIHEAD_SAFE) && !defined(GDK_DISABLE_DEPRECATED)
602 GList * gdk_window_get_toplevels (void);
605 void gdk_window_beep (GdkWindow *window);
606 void gdk_window_iconify (GdkWindow *window);
607 void gdk_window_deiconify (GdkWindow *window);
608 void gdk_window_stick (GdkWindow *window);
609 void gdk_window_unstick (GdkWindow *window);
610 void gdk_window_maximize (GdkWindow *window);
611 void gdk_window_unmaximize (GdkWindow *window);
612 void gdk_window_fullscreen (GdkWindow *window);
613 void gdk_window_unfullscreen (GdkWindow *window);
614 void gdk_window_set_keep_above (GdkWindow *window,
616 void gdk_window_set_keep_below (GdkWindow *window,
618 void gdk_window_set_opacity (GdkWindow *window,
620 void gdk_window_register_dnd (GdkWindow *window);
622 void gdk_window_begin_resize_drag (GdkWindow *window,
628 void gdk_window_begin_move_drag (GdkWindow *window,
634 /* Interface for dirty-region queueing */
635 void gdk_window_invalidate_rect (GdkWindow *window,
636 const GdkRectangle *rect,
637 gboolean invalidate_children);
638 void gdk_window_invalidate_region (GdkWindow *window,
639 const GdkRegion *region,
640 gboolean invalidate_children);
641 void gdk_window_invalidate_maybe_recurse (GdkWindow *window,
642 const GdkRegion *region,
643 gboolean (*child_func) (GdkWindow *, gpointer),
645 GdkRegion *gdk_window_get_update_area (GdkWindow *window);
647 void gdk_window_freeze_updates (GdkWindow *window);
648 void gdk_window_thaw_updates (GdkWindow *window);
650 void gdk_window_freeze_toplevel_updates_libgtk_only (GdkWindow *window);
651 void gdk_window_thaw_toplevel_updates_libgtk_only (GdkWindow *window);
653 void gdk_window_process_all_updates (void);
654 void gdk_window_process_updates (GdkWindow *window,
655 gboolean update_children);
657 /* Enable/disable flicker, so you can tell if your code is inefficient. */
658 void gdk_window_set_debug_updates (gboolean setting);
660 void gdk_window_constrain_size (GdkGeometry *geometry,
667 void gdk_window_get_internal_paint_info (GdkWindow *window,
668 GdkDrawable **real_drawable,
672 void gdk_window_enable_synchronized_configure (GdkWindow *window);
673 void gdk_window_configure_finished (GdkWindow *window);
675 #ifndef GDK_MULTIHEAD_SAFE
676 GdkPointerHooks *gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks);
677 #endif /* GDK_MULTIHEAD_SAFE */
679 GdkWindow *gdk_get_default_root_window (void);
681 /* Offscreen redirection */
682 GdkPixmap *gdk_window_get_offscreen_pixmap (GdkWindow *window);
684 void gdk_window_redirect_to_drawable (GdkWindow *window,
685 GdkDrawable *drawable,
692 void gdk_window_remove_redirection (GdkWindow *window);
694 void gdk_window_set_offscreen_hooks (GdkWindow *offscreen_window,
695 const GdkOffscreenChildHooks *hooks);
697 #ifndef GDK_DISABLE_DEPRECATED
698 #define GDK_ROOT_PARENT() (gdk_get_default_root_window ())
699 #define gdk_window_get_size gdk_drawable_get_size
700 #define gdk_window_get_type gdk_window_get_window_type
701 #define gdk_window_get_colormap gdk_drawable_get_colormap
702 #define gdk_window_set_colormap gdk_drawable_set_colormap
703 #define gdk_window_get_visual gdk_drawable_get_visual
704 #define gdk_window_ref gdk_drawable_ref
705 #define gdk_window_unref gdk_drawable_unref
707 #define gdk_window_copy_area(drawable,gc,x,y,source_drawable,source_x,source_y,width,height) \
708 gdk_draw_pixmap(drawable,gc,source_drawable,source_x,source_y,x,y,width,height)
709 #endif /* GDK_DISABLE_DEPRECATED */
713 #endif /* __GDK_WINDOW_H__ */