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 _GdkWindowRedirect GdkWindowRedirect;
45 /* Classes of windows.
46 * InputOutput: Almost every window should be of this type. Such windows
47 * receive events and are also displayed on screen.
48 * InputOnly: Used only in special circumstances when events need to be
49 * stolen from another window or windows. Input only windows
50 * have no visible output, so they are handy for placing over
51 * top of a group of windows in order to grab the events (or
52 * filter the events) from those windows.
61 * Root: There is only 1 root window and it is initialized
62 * at startup. Creating a window of type GDK_WINDOW_ROOT
64 * Toplevel: Windows which interact with the window manager.
65 * Child: Windows which are children of some other type of window.
66 * (Any other type of window). Most windows are child windows.
67 * Dialog: A special kind of toplevel window which interacts with
68 * the window manager slightly differently than a regular
69 * toplevel window. Dialog windows should be used for any
71 * Foreign: A window that actually belongs to another application
84 /* Window attribute mask values.
85 * GDK_WA_TITLE: The "title" field is valid.
86 * GDK_WA_X: The "x" field is valid.
87 * GDK_WA_Y: The "y" field is valid.
88 * GDK_WA_CURSOR: The "cursor" field is valid.
89 * GDK_WA_COLORMAP: The "colormap" field is valid.
90 * GDK_WA_VISUAL: The "visual" field is valid.
94 GDK_WA_TITLE = 1 << 1,
97 GDK_WA_CURSOR = 1 << 4,
98 GDK_WA_COLORMAP = 1 << 5,
99 GDK_WA_VISUAL = 1 << 6,
100 GDK_WA_WMCLASS = 1 << 7,
101 GDK_WA_NOREDIR = 1 << 8,
102 GDK_WA_TYPE_HINT = 1 << 9
103 } GdkWindowAttributesType;
105 /* Size restriction enumeration.
109 GDK_HINT_POS = 1 << 0,
110 GDK_HINT_MIN_SIZE = 1 << 1,
111 GDK_HINT_MAX_SIZE = 1 << 2,
112 GDK_HINT_BASE_SIZE = 1 << 3,
113 GDK_HINT_ASPECT = 1 << 4,
114 GDK_HINT_RESIZE_INC = 1 << 5,
115 GDK_HINT_WIN_GRAVITY = 1 << 6,
116 GDK_HINT_USER_POS = 1 << 7,
117 GDK_HINT_USER_SIZE = 1 << 8
121 /* Window type hints.
122 * These are hints for the window manager that indicate
123 * what type of function the window has. The window manager
124 * can use this when determining decoration and behaviour
125 * of the window. The hint must be set before mapping the
128 * Normal: Normal toplevel window
129 * Dialog: Dialog window
130 * Menu: Window used to implement a menu.
131 * Toolbar: Window used to implement toolbars.
135 GDK_WINDOW_TYPE_HINT_NORMAL,
136 GDK_WINDOW_TYPE_HINT_DIALOG,
137 GDK_WINDOW_TYPE_HINT_MENU, /* Torn off menu */
138 GDK_WINDOW_TYPE_HINT_TOOLBAR,
139 GDK_WINDOW_TYPE_HINT_SPLASHSCREEN,
140 GDK_WINDOW_TYPE_HINT_UTILITY,
141 GDK_WINDOW_TYPE_HINT_DOCK,
142 GDK_WINDOW_TYPE_HINT_DESKTOP,
143 GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU, /* A drop down menu (from a menubar) */
144 GDK_WINDOW_TYPE_HINT_POPUP_MENU, /* A popup menu (from right-click) */
145 GDK_WINDOW_TYPE_HINT_TOOLTIP,
146 GDK_WINDOW_TYPE_HINT_NOTIFICATION,
147 GDK_WINDOW_TYPE_HINT_COMBO,
148 GDK_WINDOW_TYPE_HINT_DND
151 /* The next two enumeration values current match the
152 * Motif constants. If this is changed, the implementation
153 * of gdk_window_set_decorations/gdk_window_set_functions
154 * will need to change as well.
158 GDK_DECOR_ALL = 1 << 0,
159 GDK_DECOR_BORDER = 1 << 1,
160 GDK_DECOR_RESIZEH = 1 << 2,
161 GDK_DECOR_TITLE = 1 << 3,
162 GDK_DECOR_MENU = 1 << 4,
163 GDK_DECOR_MINIMIZE = 1 << 5,
164 GDK_DECOR_MAXIMIZE = 1 << 6
169 GDK_FUNC_ALL = 1 << 0,
170 GDK_FUNC_RESIZE = 1 << 1,
171 GDK_FUNC_MOVE = 1 << 2,
172 GDK_FUNC_MINIMIZE = 1 << 3,
173 GDK_FUNC_MAXIMIZE = 1 << 4,
174 GDK_FUNC_CLOSE = 1 << 5
177 /* Currently, these are the same values numerically as in the
178 * X protocol. If you change that, gdkwindow-x11.c/gdk_window_set_geometry_hints()
183 GDK_GRAVITY_NORTH_WEST = 1,
185 GDK_GRAVITY_NORTH_EAST,
189 GDK_GRAVITY_SOUTH_WEST,
191 GDK_GRAVITY_SOUTH_EAST,
198 GDK_WINDOW_EDGE_NORTH_WEST,
199 GDK_WINDOW_EDGE_NORTH,
200 GDK_WINDOW_EDGE_NORTH_EAST,
201 GDK_WINDOW_EDGE_WEST,
202 GDK_WINDOW_EDGE_EAST,
203 GDK_WINDOW_EDGE_SOUTH_WEST,
204 GDK_WINDOW_EDGE_SOUTH,
205 GDK_WINDOW_EDGE_SOUTH_EAST
208 struct _GdkWindowAttr
215 GdkWindowClass wclass;
217 GdkColormap *colormap;
218 GdkWindowType window_type;
221 gchar *wmclass_class;
222 gboolean override_redirect;
223 GdkWindowTypeHint type_hint;
238 GdkGravity win_gravity;
241 struct _GdkPointerHooks
243 GdkWindow* (*get_pointer) (GdkWindow *window,
246 GdkModifierType *mask);
247 GdkWindow* (*window_at_pointer) (GdkScreen *screen, /* unused */
252 typedef struct _GdkWindowObject GdkWindowObject;
253 typedef struct _GdkWindowObjectClass GdkWindowObjectClass;
255 #define GDK_TYPE_WINDOW (gdk_window_object_get_type ())
256 #define GDK_WINDOW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW, GdkWindow))
257 #define GDK_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW, GdkWindowObjectClass))
258 #define GDK_IS_WINDOW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW))
259 #define GDK_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW))
260 #define GDK_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW, GdkWindowObjectClass))
261 #define GDK_WINDOW_OBJECT(object) ((GdkWindowObject *) GDK_WINDOW (object))
263 #ifndef GDK_COMPILATION
264 /* We used to export all of GdkWindowObject, but we don't want to keep doing so.
265 However, there are various parts of it accessed by macros and other code,
266 so we keep the old exported version public, but in reality it is larger. */
268 /**** DON'T CHANGE THIS STRUCT, the real version is in gdkinternals.h ****/
269 struct _GdkWindowObject
271 GdkDrawable parent_instance;
273 GdkDrawable *impl; /* window-system-specific delegate object */
275 GdkWindowObject *parent;
282 gint extension_events;
288 GdkPixmap *bg_pixmap;
292 GdkRegion *update_area;
293 guint update_freeze_count;
299 GdkWindowState state;
301 guint guffaw_gravity : 1;
302 guint input_only : 1;
303 guint modal_hint : 1;
304 guint composited : 1;
308 guint accept_focus : 1;
309 guint focus_on_map : 1;
312 GdkEventMask event_mask;
314 guint update_and_descendants_freeze_count;
316 GdkWindowRedirect *redirect;
320 struct _GdkWindowObjectClass
322 GdkDrawableClass parent_class;
327 GType gdk_window_object_get_type (void) G_GNUC_CONST;
328 GdkWindow* gdk_window_new (GdkWindow *parent,
329 GdkWindowAttr *attributes,
330 gint attributes_mask);
331 void gdk_window_destroy (GdkWindow *window);
332 GdkWindowType gdk_window_get_window_type (GdkWindow *window);
333 GdkWindow* gdk_window_at_pointer (gint *win_x,
335 void gdk_window_show (GdkWindow *window);
336 void gdk_window_hide (GdkWindow *window);
337 void gdk_window_withdraw (GdkWindow *window);
338 void gdk_window_show_unraised (GdkWindow *window);
339 void gdk_window_move (GdkWindow *window,
342 void gdk_window_resize (GdkWindow *window,
345 void gdk_window_move_resize (GdkWindow *window,
350 void gdk_window_reparent (GdkWindow *window,
351 GdkWindow *new_parent,
354 void gdk_window_clear (GdkWindow *window);
355 void gdk_window_clear_area (GdkWindow *window,
360 void gdk_window_clear_area_e (GdkWindow *window,
365 void gdk_window_raise (GdkWindow *window);
366 void gdk_window_lower (GdkWindow *window);
367 void gdk_window_restack (GdkWindow *window,
370 void gdk_window_focus (GdkWindow *window,
372 void gdk_window_set_user_data (GdkWindow *window,
374 void gdk_window_set_override_redirect (GdkWindow *window,
375 gboolean override_redirect);
376 void gdk_window_set_accept_focus (GdkWindow *window,
377 gboolean accept_focus);
378 void gdk_window_set_focus_on_map (GdkWindow *window,
379 gboolean focus_on_map);
380 void gdk_window_add_filter (GdkWindow *window,
381 GdkFilterFunc function,
383 void gdk_window_remove_filter (GdkWindow *window,
384 GdkFilterFunc function,
386 void gdk_window_scroll (GdkWindow *window,
389 void gdk_window_move_region (GdkWindow *window,
390 const GdkRegion *region,
393 gboolean gdk_window_ensure_native (GdkWindow *window);
396 * This allows for making shaped (partially transparent) windows
397 * - cool feature, needed for Drag and Drag for example.
398 * The shape_mask can be the mask
399 * from gdk_pixmap_create_from_xpm. Stefan Wille
401 void gdk_window_shape_combine_mask (GdkWindow *window,
405 void gdk_window_shape_combine_region (GdkWindow *window,
406 const GdkRegion *shape_region,
411 * This routine allows you to quickly take the shapes of all the child windows
412 * of a window and use their shapes as the shape mask for this window - useful
413 * for container windows that dont want to look like a big box
417 void gdk_window_set_child_shapes (GdkWindow *window);
419 void gdk_window_set_composited (GdkWindow *window,
420 gboolean composited);
423 * This routine allows you to merge (ie ADD) child shapes to your
424 * own window's shape keeping its current shape and ADDING the child
429 void gdk_window_merge_child_shapes (GdkWindow *window);
431 void gdk_window_input_shape_combine_mask (GdkWindow *window,
435 void gdk_window_input_shape_combine_region (GdkWindow *window,
436 const GdkRegion *shape_region,
439 void gdk_window_set_child_input_shapes (GdkWindow *window);
440 void gdk_window_merge_child_input_shapes (GdkWindow *window);
444 * Check if a window has been shown, and whether all its
445 * parents up to a toplevel have been shown, respectively.
446 * Note that a window that is_viewable below is not necessarily
447 * viewable in the X sense.
449 gboolean gdk_window_is_visible (GdkWindow *window);
450 gboolean gdk_window_is_viewable (GdkWindow *window);
452 GdkWindowState gdk_window_get_state (GdkWindow *window);
454 /* Set static bit gravity on the parent, and static
455 * window gravity on all children.
457 gboolean gdk_window_set_static_gravities (GdkWindow *window,
458 gboolean use_static);
460 /* Functions to create/lookup windows from their native equivalents */
461 #ifndef GDK_MULTIHEAD_SAFE
462 GdkWindow* gdk_window_foreign_new (GdkNativeWindow anid);
463 GdkWindow* gdk_window_lookup (GdkNativeWindow anid);
465 GdkWindow *gdk_window_foreign_new_for_display (GdkDisplay *display,
466 GdkNativeWindow anid);
467 GdkWindow* gdk_window_lookup_for_display (GdkDisplay *display,
468 GdkNativeWindow anid);
473 #ifndef GDK_DISABLE_DEPRECATED
474 void gdk_window_set_hints (GdkWindow *window,
483 void gdk_window_set_type_hint (GdkWindow *window,
484 GdkWindowTypeHint hint);
485 GdkWindowTypeHint gdk_window_get_type_hint (GdkWindow *window);
487 void gdk_window_set_modal_hint (GdkWindow *window,
490 void gdk_window_set_skip_taskbar_hint (GdkWindow *window,
491 gboolean skips_taskbar);
492 void gdk_window_set_skip_pager_hint (GdkWindow *window,
493 gboolean skips_pager);
494 void gdk_window_set_urgency_hint (GdkWindow *window,
497 void gdk_window_set_geometry_hints (GdkWindow *window,
498 const GdkGeometry *geometry,
499 GdkWindowHints geom_mask);
500 void gdk_set_sm_client_id (const gchar *sm_client_id);
502 void gdk_window_begin_paint_rect (GdkWindow *window,
503 const GdkRectangle *rectangle);
504 void gdk_window_begin_paint_region (GdkWindow *window,
505 const GdkRegion *region);
506 void gdk_window_end_paint (GdkWindow *window);
508 void gdk_window_set_title (GdkWindow *window,
510 void gdk_window_set_role (GdkWindow *window,
512 void gdk_window_set_startup_id (GdkWindow *window,
513 const gchar *startup_id);
514 void gdk_window_set_transient_for (GdkWindow *window,
516 void gdk_window_set_background (GdkWindow *window,
517 const GdkColor *color);
518 void gdk_window_set_back_pixmap (GdkWindow *window,
520 gboolean parent_relative);
521 void gdk_window_set_cursor (GdkWindow *window,
523 GdkCursor *gdk_window_get_cursor (GdkWindow *window);
524 void gdk_window_get_user_data (GdkWindow *window,
526 void gdk_window_get_geometry (GdkWindow *window,
532 void gdk_window_get_position (GdkWindow *window,
535 gint gdk_window_get_origin (GdkWindow *window,
538 void gdk_window_get_root_coords (GdkWindow *window,
544 #if !defined (GDK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION) || defined (GDK_COMPILATION)
545 /* Used by gtk_handle_box_button_changed () */
546 gboolean gdk_window_get_deskrelative_origin (GdkWindow *window,
551 void gdk_window_get_root_origin (GdkWindow *window,
554 void gdk_window_get_frame_extents (GdkWindow *window,
556 GdkWindow* gdk_window_get_pointer (GdkWindow *window,
559 GdkModifierType *mask);
560 GdkWindow * gdk_window_get_parent (GdkWindow *window);
561 GdkWindow * gdk_window_get_toplevel (GdkWindow *window);
563 GList * gdk_window_get_children (GdkWindow *window);
564 GList * gdk_window_peek_children (GdkWindow *window);
565 GdkEventMask gdk_window_get_events (GdkWindow *window);
566 void gdk_window_set_events (GdkWindow *window,
567 GdkEventMask event_mask);
569 void gdk_window_set_icon_list (GdkWindow *window,
571 void gdk_window_set_icon (GdkWindow *window,
572 GdkWindow *icon_window,
575 void gdk_window_set_icon_name (GdkWindow *window,
577 void gdk_window_set_group (GdkWindow *window,
579 GdkWindow* gdk_window_get_group (GdkWindow *window);
580 void gdk_window_set_decorations (GdkWindow *window,
581 GdkWMDecoration decorations);
582 gboolean gdk_window_get_decorations (GdkWindow *window,
583 GdkWMDecoration *decorations);
584 void gdk_window_set_functions (GdkWindow *window,
585 GdkWMFunction functions);
586 #if !defined(GDK_MULTIHEAD_SAFE) && !defined(GDK_DISABLE_DEPRECATED)
587 GList * gdk_window_get_toplevels (void);
590 void gdk_window_beep (GdkWindow *window);
591 void gdk_window_iconify (GdkWindow *window);
592 void gdk_window_deiconify (GdkWindow *window);
593 void gdk_window_stick (GdkWindow *window);
594 void gdk_window_unstick (GdkWindow *window);
595 void gdk_window_maximize (GdkWindow *window);
596 void gdk_window_unmaximize (GdkWindow *window);
597 void gdk_window_fullscreen (GdkWindow *window);
598 void gdk_window_unfullscreen (GdkWindow *window);
599 void gdk_window_set_keep_above (GdkWindow *window,
601 void gdk_window_set_keep_below (GdkWindow *window,
603 void gdk_window_set_opacity (GdkWindow *window,
605 void gdk_window_register_dnd (GdkWindow *window);
607 void gdk_window_begin_resize_drag (GdkWindow *window,
613 void gdk_window_begin_move_drag (GdkWindow *window,
619 /* Interface for dirty-region queueing */
620 void gdk_window_invalidate_rect (GdkWindow *window,
621 const GdkRectangle *rect,
622 gboolean invalidate_children);
623 void gdk_window_invalidate_region (GdkWindow *window,
624 const GdkRegion *region,
625 gboolean invalidate_children);
626 void gdk_window_invalidate_maybe_recurse (GdkWindow *window,
627 const GdkRegion *region,
628 gboolean (*child_func) (GdkWindow *, gpointer),
630 GdkRegion *gdk_window_get_update_area (GdkWindow *window);
632 void gdk_window_freeze_updates (GdkWindow *window);
633 void gdk_window_thaw_updates (GdkWindow *window);
635 void gdk_window_freeze_toplevel_updates_libgtk_only (GdkWindow *window);
636 void gdk_window_thaw_toplevel_updates_libgtk_only (GdkWindow *window);
638 void gdk_window_process_all_updates (void);
639 void gdk_window_process_updates (GdkWindow *window,
640 gboolean update_children);
642 /* Enable/disable flicker, so you can tell if your code is inefficient. */
643 void gdk_window_set_debug_updates (gboolean setting);
645 void gdk_window_constrain_size (GdkGeometry *geometry,
652 void gdk_window_get_internal_paint_info (GdkWindow *window,
653 GdkDrawable **real_drawable,
657 void gdk_window_enable_synchronized_configure (GdkWindow *window);
658 void gdk_window_configure_finished (GdkWindow *window);
660 #ifndef GDK_MULTIHEAD_SAFE
661 GdkPointerHooks *gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks);
662 #endif /* GDK_MULTIHEAD_SAFE */
664 GdkWindow *gdk_get_default_root_window (void);
666 /* Offscreen redirection */
667 GdkPixmap *gdk_offscreen_window_get_pixmap (GdkWindow *window);
668 void gdk_offscreen_window_set_embedder (GdkWindow *window,
669 GdkWindow *embedder);
670 GdkWindow *gdk_offscreen_window_get_embedder (GdkWindow *window);
671 void gdk_window_geometry_changed (GdkWindow *window);
673 void gdk_window_redirect_to_drawable (GdkWindow *window,
674 GdkDrawable *drawable,
681 void gdk_window_remove_redirection (GdkWindow *window);
683 #ifndef GDK_DISABLE_DEPRECATED
684 #define GDK_ROOT_PARENT() (gdk_get_default_root_window ())
685 #define gdk_window_get_size gdk_drawable_get_size
686 #define gdk_window_get_type gdk_window_get_window_type
687 #define gdk_window_get_colormap gdk_drawable_get_colormap
688 #define gdk_window_set_colormap gdk_drawable_set_colormap
689 #define gdk_window_get_visual gdk_drawable_get_visual
690 #define gdk_window_ref gdk_drawable_ref
691 #define gdk_window_unref gdk_drawable_unref
693 #define gdk_window_copy_area(drawable,gc,x,y,source_drawable,source_x,source_y,width,height) \
694 gdk_draw_pixmap(drawable,gc,source_drawable,source_x,source_y,x,y,width,height)
695 #endif /* GDK_DISABLE_DEPRECATED */
699 #endif /* __GDK_WINDOW_H__ */