]> Pileus Git - ~andy/gtk/blob - gdk/gdkwindow.h
Seal gdk
[~andy/gtk] / gdk / gdkwindow.h
1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 /*
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/.
25  */
26
27 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
28 #error "Only <gdk/gdk.h> can be included directly."
29 #endif
30
31 #ifndef __GDK_WINDOW_H__
32 #define __GDK_WINDOW_H__
33
34 #include <gdk/gdkdrawable.h>
35 #include <gdk/gdktypes.h>
36 #include <gdk/gdkevents.h>
37
38 G_BEGIN_DECLS
39
40 typedef struct _GdkGeometry          GdkGeometry;
41 typedef struct _GdkWindowAttr        GdkWindowAttr;
42 typedef struct _GdkPointerHooks      GdkPointerHooks;
43 typedef struct _GdkWindowRedirect    GdkWindowRedirect;
44
45 /**
46  * GdkWindowClass:
47  * @GDK_INPUT_OUTPUT: window for graphics and events
48  * @GDK_INPUT_ONLY: window for events only
49  *
50  * @GDK_INPUT_OUTPUT windows are the standard kind of window you might expect.
51  * Such windows receive events and are also displayed on screen.
52  * @GDK_INPUT_ONLY windows are invisible; they are usually placed above other
53  * windows in order to trap or filter the events. You can't draw on
54  * @GDK_INPUT_ONLY windows.
55  */
56 typedef enum
57 {
58   GDK_INPUT_OUTPUT,
59   GDK_INPUT_ONLY
60 } GdkWindowClass;
61
62 /**
63  * GdkWindowType:
64  * @GDK_WINDOW_ROOT: root window; this window has no parent, covers the entire
65  *  screen, and is created by the window system
66  * @GDK_WINDOW_TOPLEVEL: toplevel window (used to implement #GtkWindow)
67  * @GDK_WINDOW_CHILD: child window (used to implement e.g. #GtkEntry)
68  * @GDK_WINDOW_DIALOG: useless/deprecated compatibility type
69  * @GDK_WINDOW_TEMP: override redirect temporary window (used to implement
70  *  #GtkMenu)
71  * @GDK_WINDOW_FOREIGN: foreign window (see gdk_window_foreign_new())
72  * @GDK_WINDOW_OFFSCREEN: offscreen window (see
73  *  <xref linkend="OFFSCREEN-WINDOWS"/>). Since 2.18
74  *
75  * Describes the kind of window.
76  */
77 typedef enum
78 {
79   GDK_WINDOW_ROOT,
80   GDK_WINDOW_TOPLEVEL,
81   GDK_WINDOW_CHILD,
82   GDK_WINDOW_DIALOG,
83   GDK_WINDOW_TEMP,
84   GDK_WINDOW_FOREIGN,
85   GDK_WINDOW_OFFSCREEN
86 } GdkWindowType;
87
88 /**
89  * GdkWindowAttributesType:
90  * @GDK_WA_TITLE: Honor the title field
91  * @GDK_WA_X: Honor the X coordinate field
92  * @GDK_WA_Y: Honor the Y coordinate field
93  * @GDK_WA_CURSOR: Honor the cursor field
94  * @GDK_WA_COLORMAP: Honor the colormap field
95  * @GDK_WA_VISUAL: Honor the visual field
96  * @GDK_WA_WMCLASS: Honor the wmclass_class and wmclass_name fields
97  * @GDK_WA_NOREDIR: Honor the override_redirect field
98  * @GDK_WA_TYPE_HINT: Honor the type_hint field
99  *
100  * Used to indicate which fields in the #GdkWindowAttr struct should be honored.
101  * For example, if you filled in the "cursor" and "x" fields of #GdkWindowAttr,
102  * pass "@GDK_WA_X | @GDK_WA_CURSOR" to gdk_window_new(). Fields in
103  * #GdkWindowAttr not covered by a bit in this enum are required; for example,
104  * the @width/@height, @wclass, and @window_type fields are required, they have
105  * no corresponding flag in #GdkWindowAttributesType.
106  */
107 typedef enum
108 {
109   GDK_WA_TITLE     = 1 << 1,
110   GDK_WA_X         = 1 << 2,
111   GDK_WA_Y         = 1 << 3,
112   GDK_WA_CURSOR    = 1 << 4,
113   GDK_WA_COLORMAP  = 1 << 5,
114   GDK_WA_VISUAL    = 1 << 6,
115   GDK_WA_WMCLASS   = 1 << 7,
116   GDK_WA_NOREDIR   = 1 << 8,
117   GDK_WA_TYPE_HINT = 1 << 9
118 } GdkWindowAttributesType;
119
120 /* Size restriction enumeration.
121  */
122 /**
123  * GdkWindowHints:
124  * @GDK_HINT_POS: indicates that the program has positioned the window
125  * @GDK_HINT_MIN_SIZE: min size fields are set
126  * @GDK_HINT_MAX_SIZE: max size fields are set
127  * @GDK_HINT_BASE_SIZE: base size fields are set
128  * @GDK_HINT_ASPECT: aspect ratio fields are set
129  * @GDK_HINT_RESIZE_INC: resize increment fields are set
130  * @GDK_HINT_WIN_GRAVITY: window gravity field is set
131  * @GDK_HINT_USER_POS: indicates that the window's position was explicitly set
132  *  by the user
133  * @GDK_HINT_USER_SIZE: indicates that the window's size was explicitly set by
134  *  the user
135  *
136  * Used to indicate which fields of a #GdkGeometry struct should be paid
137  * attention to. Also, the presence/absence of @GDK_HINT_POS,
138  * @GDK_HINT_USER_POS, and @GDK_HINT_USER_SIZE is significant, though they don't
139  * directly refer to #GdkGeometry fields. @GDK_HINT_USER_POS will be set
140  * automatically by #GtkWindow if you call gtk_window_move().
141  * @GDK_HINT_USER_POS and @GDK_HINT_USER_SIZE should be set if the user
142  * specified a size/position using a --geometry command-line argument;
143  * gtk_window_parse_geometry() automatically sets these flags.
144  */
145 typedef enum
146 {
147   GDK_HINT_POS         = 1 << 0,
148   GDK_HINT_MIN_SIZE    = 1 << 1,
149   GDK_HINT_MAX_SIZE    = 1 << 2,
150   GDK_HINT_BASE_SIZE   = 1 << 3,
151   GDK_HINT_ASPECT      = 1 << 4,
152   GDK_HINT_RESIZE_INC  = 1 << 5,
153   GDK_HINT_WIN_GRAVITY = 1 << 6,
154   GDK_HINT_USER_POS    = 1 << 7,
155   GDK_HINT_USER_SIZE   = 1 << 8
156 } GdkWindowHints;
157
158
159 /**
160  * GdkWindowTypeHint:
161  * @GDK_WINDOW_TYPE_HINT_NORMAL: Normal toplevel window.
162  * @GDK_WINDOW_TYPE_HINT_DIALOG: Dialog window.
163  * @GDK_WINDOW_TYPE_HINT_MENU: Window used to implement a menu; GTK+ uses
164  *  this hint only for torn-off menus, see #GtkTearoffMenuItem.
165  * @GDK_WINDOW_TYPE_HINT_TOOLBAR: Window used to implement toolbars.
166  * @GDK_WINDOW_TYPE_HINT_SPLASHSCREEN: Window used to display a splash
167  *  screen during application startup.
168  * @GDK_WINDOW_TYPE_HINT_UTILITY: Utility windows which are not detached
169  *  toolbars or dialogs.
170  * @GDK_WINDOW_TYPE_HINT_DOCK: Used for creating dock or panel windows.
171  * @GDK_WINDOW_TYPE_HINT_DESKTOP: Used for creating the desktop background
172  *  window.
173  * @GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU: A menu that belongs to a menubar.
174  * @GDK_WINDOW_TYPE_HINT_POPUP_MENU: A menu that does not belong to a menubar,
175  *  e.g. a context menu.
176  * @GDK_WINDOW_TYPE_HINT_TOOLTIP: A tooltip.
177  * @GDK_WINDOW_TYPE_HINT_NOTIFICATION: A notification - typically a "bubble"
178  *  that belongs to a status icon.
179  * @GDK_WINDOW_TYPE_HINT_COMBO: A popup from a combo box.
180  * @GDK_WINDOW_TYPE_HINT_DND: A window that is used to implement a DND cursor.
181  *
182  * These are hints for the window manager that indicate what type of function
183  * the window has. The window manager can use this when determining decoration
184  * and behaviour of the window. The hint must be set before mapping the window.
185  *
186  * See the
187  * <ulink url="http://www.freedesktop.org/Standards/wm-spec">Extended
188  * Window Manager Hints</ulink> specification for more details about
189  * window types.
190  */
191 typedef enum
192 {
193   GDK_WINDOW_TYPE_HINT_NORMAL,
194   GDK_WINDOW_TYPE_HINT_DIALOG,
195   GDK_WINDOW_TYPE_HINT_MENU,            /* Torn off menu */
196   GDK_WINDOW_TYPE_HINT_TOOLBAR,
197   GDK_WINDOW_TYPE_HINT_SPLASHSCREEN,
198   GDK_WINDOW_TYPE_HINT_UTILITY,
199   GDK_WINDOW_TYPE_HINT_DOCK,
200   GDK_WINDOW_TYPE_HINT_DESKTOP,
201   GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU,   /* A drop down menu (from a menubar) */
202   GDK_WINDOW_TYPE_HINT_POPUP_MENU,      /* A popup menu (from right-click) */
203   GDK_WINDOW_TYPE_HINT_TOOLTIP,
204   GDK_WINDOW_TYPE_HINT_NOTIFICATION,
205   GDK_WINDOW_TYPE_HINT_COMBO,
206   GDK_WINDOW_TYPE_HINT_DND
207 } GdkWindowTypeHint;
208
209 /* The next two enumeration values current match the
210  * Motif constants. If this is changed, the implementation
211  * of gdk_window_set_decorations/gdk_window_set_functions
212  * will need to change as well.
213  */
214 /**
215  * GdkWMDecoration:
216  * @GDK_DECOR_ALL: all decorations should be applied.
217  * @GDK_DECOR_BORDER: a frame should be drawn around the window.
218  * @GDK_DECOR_RESIZEH: the frame should have resize handles.
219  * @GDK_DECOR_TITLE: a titlebar should be placed above the window.
220  * @GDK_DECOR_MENU: a button for opening a menu should be included.
221  * @GDK_DECOR_MINIMIZE: a minimize button should be included.
222  * @GDK_DECOR_MAXIMIZE: a maximize button should be included.
223  *
224  * These are hints originally defined by the Motif toolkit.
225  * The window manager can use them when determining how to decorate
226  * the window. The hint must be set before mapping the window.
227  */
228 typedef enum
229 {
230   GDK_DECOR_ALL         = 1 << 0,
231   GDK_DECOR_BORDER      = 1 << 1,
232   GDK_DECOR_RESIZEH     = 1 << 2,
233   GDK_DECOR_TITLE       = 1 << 3,
234   GDK_DECOR_MENU        = 1 << 4,
235   GDK_DECOR_MINIMIZE    = 1 << 5,
236   GDK_DECOR_MAXIMIZE    = 1 << 6
237 } GdkWMDecoration;
238
239 /**
240  * GdkWMFunction:
241  * @GDK_FUNC_ALL: all functions should be offered.
242  * @GDK_FUNC_RESIZE: the window should be resizable.
243  * @GDK_FUNC_MOVE: the window should be movable.
244  * @GDK_FUNC_MINIMIZE: the window should be minimizable.
245  * @GDK_FUNC_MAXIMIZE: the window should be maximizable.
246  * @GDK_FUNC_CLOSE: the window should be closable.
247  *
248  * These are hints originally defined by the Motif toolkit. The window manager
249  * can use them when determining the functions to offer for the window. The
250  * hint must be set before mapping the window.
251  */
252 typedef enum
253 {
254   GDK_FUNC_ALL          = 1 << 0,
255   GDK_FUNC_RESIZE       = 1 << 1,
256   GDK_FUNC_MOVE         = 1 << 2,
257   GDK_FUNC_MINIMIZE     = 1 << 3,
258   GDK_FUNC_MAXIMIZE     = 1 << 4,
259   GDK_FUNC_CLOSE        = 1 << 5
260 } GdkWMFunction;
261
262 /* Currently, these are the same values numerically as in the
263  * X protocol. If you change that, gdkwindow-x11.c/gdk_window_set_geometry_hints()
264  * will need fixing.
265  */
266 /**
267  * GdkGravity:
268  * @GDK_GRAVITY_NORTH_WEST: the reference point is at the top left corner.
269  * @GDK_GRAVITY_NORTH: the reference point is in the middle of the top edge.
270  * @GDK_GRAVITY_NORTH_EAST: the reference point is at the top right corner.
271  * @GDK_GRAVITY_WEST: the reference point is at the middle of the left edge.
272  * @GDK_GRAVITY_CENTER: the reference point is at the center of the window.
273  * @GDK_GRAVITY_EAST: the reference point is at the middle of the right edge.
274  * @GDK_GRAVITY_SOUTH_WEST: the reference point is at the lower left corner.
275  * @GDK_GRAVITY_SOUTH: the reference point is at the middle of the lower edge.
276  * @GDK_GRAVITY_SOUTH_EAST: the reference point is at the lower right corner.
277  * @GDK_GRAVITY_STATIC: the reference point is at the top left corner of the
278  *  window itself, ignoring window manager decorations.
279  *
280  * Defines the reference point of a window and the meaning of coordinates
281  * passed to gtk_window_move(). See gtk_window_move() and the "implementation
282  * notes" section of the
283  * <ulink url="http://www.freedesktop.org/Standards/wm-spec">Extended
284  * Window Manager Hints</ulink> specification for more details.
285  */
286 typedef enum
287 {
288   GDK_GRAVITY_NORTH_WEST = 1,
289   GDK_GRAVITY_NORTH,
290   GDK_GRAVITY_NORTH_EAST,
291   GDK_GRAVITY_WEST,
292   GDK_GRAVITY_CENTER,
293   GDK_GRAVITY_EAST,
294   GDK_GRAVITY_SOUTH_WEST,
295   GDK_GRAVITY_SOUTH,
296   GDK_GRAVITY_SOUTH_EAST,
297   GDK_GRAVITY_STATIC
298 } GdkGravity;
299
300
301 /**
302  * GdkWindowEdge:
303  * @GDK_WINDOW_EDGE_NORTH_WEST: the top left corner.
304  * @GDK_WINDOW_EDGE_NORTH: the top edge.
305  * @GDK_WINDOW_EDGE_NORTH_EAST: the top right corner.
306  * @GDK_WINDOW_EDGE_WEST: the left edge.
307  * @GDK_WINDOW_EDGE_EAST: the right edge.
308  * @GDK_WINDOW_EDGE_SOUTH_WEST: the lower left corner.
309  * @GDK_WINDOW_EDGE_SOUTH: the lower edge.
310  * @GDK_WINDOW_EDGE_SOUTH_EAST: the lower right corner.
311  *
312  * Determines a window edge or corner.
313  */
314 typedef enum
315 {
316   GDK_WINDOW_EDGE_NORTH_WEST,
317   GDK_WINDOW_EDGE_NORTH,
318   GDK_WINDOW_EDGE_NORTH_EAST,
319   GDK_WINDOW_EDGE_WEST,
320   GDK_WINDOW_EDGE_EAST,
321   GDK_WINDOW_EDGE_SOUTH_WEST,
322   GDK_WINDOW_EDGE_SOUTH,
323   GDK_WINDOW_EDGE_SOUTH_EAST  
324 } GdkWindowEdge;
325
326 /**
327  * GdkWindowAttr:
328  * @title: title of the window (for toplevel windows)
329  * @event_mask: event mask (see gdk_window_set_events())
330  * @x: X coordinate relative to parent window (see gdk_window_move())
331  * @y: Y coordinate relative to parent window (see gdk_window_move())
332  * @width: width of window
333  * @height: height of window
334  * @wclass: #GDK_INPUT_OUTPUT (normal window) or #GDK_INPUT_ONLY (invisible
335  *  window that receives events)
336  * @visual: #GdkVisual for window
337  * @colormap: #GdkColormap for window
338  * @window_type: type of window
339  * @cursor: cursor for the window (see gdk_window_set_cursor())
340  * @wmclass_name: don't use (see gtk_window_set_wmclass())
341  * @wmclass_class: don't use (see gtk_window_set_wmclass())
342  * @override_redirect: %TRUE to bypass the window manager
343  * @type_hint: a hint of the function of the window
344  *
345  * Attributes to use for a newly-created window.
346  */
347 struct _GdkWindowAttr
348 {
349   gchar *title;
350   gint event_mask;
351   gint x, y;
352   gint width;
353   gint height;
354   GdkWindowClass wclass;
355   GdkVisual *visual;
356   GdkColormap *colormap;
357   GdkWindowType window_type;
358   GdkCursor *cursor;
359   gchar *wmclass_name;
360   gchar *wmclass_class;
361   gboolean override_redirect;
362   GdkWindowTypeHint type_hint;
363 };
364
365 /**
366  * GdkGeometry:
367  * @min_width: minimum width of window (or -1 to use requisition, with
368  *  #GtkWindow only)
369  * @min_height: minimum height of window (or -1 to use requisition, with
370  *  #GtkWindow only)
371  * @max_width: maximum width of window (or -1 to use requisition, with
372  *  #GtkWindow only)
373  * @max_height: maximum height of window (or -1 to use requisition, with
374  *  #GtkWindow only)
375  * @base_width: allowed window widths are @base_width + @width_inc * N where N
376  *  is any integer (-1 allowed with #GtkWindow)
377  * @base_height: allowed window widths are @base_height + @height_inc * N where
378  *  N is any integer (-1 allowed with #GtkWindow)
379  * @width_inc: width resize increment
380  * @height_inc: height resize increment
381  * @min_aspect: minimum width/height ratio
382  * @max_aspect: maximum width/height ratio
383  * @win_gravity: window gravity, see gtk_window_set_gravity()
384  *
385  * The #GdkGeometry struct gives the window manager information about
386  * a window's geometry constraints. Normally you would set these on
387  * the GTK+ level using gtk_window_set_geometry_hints(). #GtkWindow
388  * then sets the hints on the #GdkWindow it creates.
389  *
390  * gdk_window_set_geometry_hints() expects the hints to be fully valid already
391  * and simply passes them to the window manager; in contrast,
392  * gtk_window_set_geometry_hints() performs some interpretation. For example,
393  * #GtkWindow will apply the hints to the geometry widget instead of the
394  * toplevel window, if you set a geometry widget. Also, the
395  * @min_width/@min_height/@max_width/@max_height fields may be set to -1, and
396  * #GtkWindow will substitute the size request of the window or geometry widget.
397  * If the minimum size hint is not provided, #GtkWindow will use its requisition
398  * as the minimum size. If the minimum size is provided and a geometry widget is
399  * set, #GtkWindow will take the minimum size as the minimum size of the
400  * geometry widget rather than the entire window. The base size is treated
401  * similarly.
402  *
403  * The canonical use-case for gtk_window_set_geometry_hints() is to get a
404  * terminal widget to resize properly. Here, the terminal text area should be
405  * the geometry widget; #GtkWindow will then automatically set the base size to
406  * the size of other widgets in the terminal window, such as the menubar and
407  * scrollbar. Then, the @width_inc and @height_inc fields should be set to the
408  * size of one character in the terminal. Finally, the base size should be set
409  * to the size of one character. The net effect is that the minimum size of the
410  * terminal will have a 1x1 character terminal area, and only terminal sizes on
411  * the "character grid" will be allowed.
412  *
413  * Here's an example of how the terminal example would be implemented, assuming
414  * a terminal area widget called "terminal" and a toplevel window "toplevel":
415  *
416  * <informalexample><programlisting><![CDATA[
417  *      GdkGeometry hints;
418  *
419  *      hints.base_width = terminal->char_width;
420  *         hints.base_height = terminal->char_height;
421  *         hints.min_width = terminal->char_width;
422  *         hints.min_height = terminal->char_height;
423  *         hints.width_inc = terminal->char_width;
424  *         hints.height_inc = terminal->char_height;
425  *
426  *  gtk_window_set_geometry_hints (GTK_WINDOW (toplevel),
427  *                                 GTK_WIDGET (terminal),
428  *                                 &hints,
429  *                                 GDK_HINT_RESIZE_INC |
430  *                                 GDK_HINT_MIN_SIZE |
431  *                                 GDK_HINT_BASE_SIZE);
432  * ]]></programlisting></informalexample>
433  *
434  * The other useful fields are the @min_aspect and @max_aspect fields; these
435  * contain a width/height ratio as a floating point number. If a geometry widget
436  * is set, the aspect applies to the geometry widget rather than the entire
437  * window. The most common use of these hints is probably to set @min_aspect and
438  * @max_aspect to the same value, thus forcing the window to keep a constant
439  * aspect ratio.
440  */
441 struct _GdkGeometry
442 {
443   gint min_width;
444   gint min_height;
445   gint max_width;
446   gint max_height;
447   gint base_width;
448   gint base_height;
449   gint width_inc;
450   gint height_inc;
451   gdouble min_aspect;
452   gdouble max_aspect;
453   GdkGravity win_gravity;
454 };
455
456 /**
457  * GdkPointerHooks:
458  * @get_pointer: Obtains the current pointer position and modifier state.
459  *  The position is given in coordinates relative to the window containing
460  *  the pointer, which is returned in @window.
461  * @window_at_pointer: Obtains the window underneath the mouse pointer,
462  *  returning the location of that window in @win_x, @win_y. Returns %NULL
463  *  if the window under the mouse pointer is not known to GDK (for example,
464  *  belongs to another application).
465  *
466  * A table of pointers to functions for getting quantities related to
467  * the current pointer position. GDK has one global table of this type,
468  * which can be set using gdk_set_pointer_hooks().
469  *
470  * This is only useful for such low-level tools as an event recorder.
471  * Applications should never have any reason to use this facility
472  */
473 struct _GdkPointerHooks 
474 {
475   GdkWindow* (*get_pointer)       (GdkWindow       *window,
476                                    gint            *x,
477                                    gint            *y,
478                                    GdkModifierType *mask);
479   GdkWindow* (*window_at_pointer) (GdkScreen       *screen, /* unused */
480                                    gint            *win_x,
481                                    gint            *win_y);
482 };
483
484 typedef struct _GdkWindowObject GdkWindowObject;
485 typedef struct _GdkWindowObjectClass GdkWindowObjectClass;
486
487 #define GDK_TYPE_WINDOW              (gdk_window_object_get_type ())
488 #define GDK_WINDOW(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW, GdkWindow))
489 #define GDK_WINDOW_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW, GdkWindowObjectClass))
490 #define GDK_IS_WINDOW(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW))
491 #define GDK_IS_WINDOW_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW))
492 #define GDK_WINDOW_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW, GdkWindowObjectClass))
493
494 #ifndef GDK_DISABLE_DEPRECATED
495 #define GDK_WINDOW_OBJECT(object)    ((GdkWindowObject *) GDK_WINDOW (object))
496
497 #ifndef GDK_COMPILATION
498
499 /* We used to export all of GdkWindowObject, but we don't want to keep doing so.
500    However, there are various parts of it accessed by macros and other code,
501    so we keep the old exported version public, but in reality it is larger. */
502
503 /**** DON'T CHANGE THIS STRUCT, the real version is in gdkinternals.h ****/
504 struct _GdkWindowObject
505 {
506   GdkDrawable parent_instance;
507
508   GdkDrawable *GSEAL (impl); /* window-system-specific delegate object */
509   
510   GdkWindowObject *GSEAL (parent);
511
512   gpointer GSEAL (user_data);
513
514   gint GSEAL (x);
515   gint GSEAL (y);
516   
517   gint GSEAL (extension_events);
518
519   GList *GSEAL (filters);
520   GList *GSEAL (children);
521
522   GdkColor GSEAL (bg_color);
523   GdkPixmap *GSEAL (bg_pixmap);
524   
525   GSList *GSEAL (paint_stack);
526   
527   GdkRegion *GSEAL (update_area);
528   guint GSEAL (update_freeze_count);
529   
530   guint8 GSEAL (window_type);
531   guint8 GSEAL (depth);
532   guint8 GSEAL (resize_count);
533
534   GdkWindowState GSEAL (state);
535   
536   guint GSEAL (guffaw_gravity) : 1;
537   guint GSEAL (input_only) : 1;
538   guint GSEAL (modal_hint) : 1;
539   guint GSEAL (composited) : 1;
540   
541   guint GSEAL (destroyed) : 2;
542
543   guint GSEAL (accept_focus) : 1;
544   guint GSEAL (focus_on_map) : 1;
545   guint GSEAL (shaped) : 1;
546   
547   GdkEventMask GSEAL (event_mask);
548
549   guint GSEAL (update_and_descendants_freeze_count);
550
551   GdkWindowRedirect *GSEAL (redirect);
552 };
553 #endif
554 #endif
555
556 struct _GdkWindowObjectClass
557 {
558   GdkDrawableClass parent_class;
559 };
560
561 /* Windows
562  */
563 GType         gdk_window_object_get_type       (void) G_GNUC_CONST;
564 GdkWindow*    gdk_window_new                   (GdkWindow     *parent,
565                                                 GdkWindowAttr *attributes,
566                                                 gint           attributes_mask);
567 void          gdk_window_destroy               (GdkWindow     *window);
568 GdkWindowType gdk_window_get_window_type       (GdkWindow     *window);
569 gboolean      gdk_window_is_destroyed          (GdkWindow     *window);
570 GdkWindow*    gdk_window_at_pointer            (gint          *win_x,
571                                                 gint          *win_y);
572 void          gdk_window_show                  (GdkWindow     *window);
573 void          gdk_window_hide                  (GdkWindow     *window);
574 void          gdk_window_withdraw              (GdkWindow     *window);
575 void          gdk_window_show_unraised         (GdkWindow     *window);
576 void          gdk_window_move                  (GdkWindow     *window,
577                                                 gint           x,
578                                                 gint           y);
579 void          gdk_window_resize                (GdkWindow     *window,
580                                                 gint           width,
581                                                 gint           height);
582 void          gdk_window_move_resize           (GdkWindow     *window,
583                                                 gint           x,
584                                                 gint           y,
585                                                 gint           width,
586                                                 gint           height);
587 void          gdk_window_reparent              (GdkWindow     *window,
588                                                 GdkWindow     *new_parent,
589                                                 gint           x,
590                                                 gint           y);
591 void          gdk_window_clear                 (GdkWindow     *window);
592 void          gdk_window_clear_area            (GdkWindow     *window,
593                                                 gint           x,
594                                                 gint           y,
595                                                 gint           width,
596                                                 gint           height);
597 void          gdk_window_clear_area_e          (GdkWindow     *window,
598                                                 gint           x,
599                                                 gint           y,
600                                                 gint           width,
601                                                 gint           height);
602 void          gdk_window_raise                 (GdkWindow     *window);
603 void          gdk_window_lower                 (GdkWindow     *window);
604 void          gdk_window_restack               (GdkWindow     *window,
605                                                 GdkWindow     *sibling,
606                                                 gboolean       above);
607 void          gdk_window_focus                 (GdkWindow     *window,
608                                                 guint32        timestamp);
609 void          gdk_window_set_user_data         (GdkWindow     *window,
610                                                 gpointer       user_data);
611 void          gdk_window_set_override_redirect (GdkWindow     *window,
612                                                 gboolean       override_redirect);
613 gboolean      gdk_window_get_accept_focus      (GdkWindow     *window);
614 void          gdk_window_set_accept_focus      (GdkWindow     *window,
615                                                 gboolean       accept_focus);
616 gboolean      gdk_window_get_focus_on_map      (GdkWindow     *window);
617 void          gdk_window_set_focus_on_map      (GdkWindow     *window,
618                                                 gboolean       focus_on_map);
619 void          gdk_window_add_filter            (GdkWindow     *window,
620                                                 GdkFilterFunc  function,
621                                                 gpointer       data);
622 void          gdk_window_remove_filter         (GdkWindow     *window,
623                                                 GdkFilterFunc  function,
624                                                 gpointer       data);
625 void          gdk_window_scroll                (GdkWindow     *window,
626                                                 gint           dx,
627                                                 gint           dy);
628 void          gdk_window_move_region           (GdkWindow       *window,
629                                                 const GdkRegion *region,
630                                                 gint             dx,
631                                                 gint             dy);
632 gboolean      gdk_window_ensure_native        (GdkWindow       *window);
633
634 /* 
635  * This allows for making shaped (partially transparent) windows
636  * - cool feature, needed for Drag and Drag for example.
637  *  The shape_mask can be the mask
638  *  from gdk_pixmap_create_from_xpm.   Stefan Wille
639  */
640 void gdk_window_shape_combine_mask  (GdkWindow        *window,
641                                      GdkBitmap        *mask,
642                                      gint              x,
643                                      gint              y);
644 void gdk_window_shape_combine_region (GdkWindow       *window,
645                                       const GdkRegion *shape_region,
646                                       gint             offset_x,
647                                       gint             offset_y);
648
649 /*
650  * This routine allows you to quickly take the shapes of all the child windows
651  * of a window and use their shapes as the shape mask for this window - useful
652  * for container windows that dont want to look like a big box
653  * 
654  * - Raster
655  */
656 void gdk_window_set_child_shapes (GdkWindow *window);
657
658 gboolean gdk_window_get_composited (GdkWindow *window);
659 void gdk_window_set_composited   (GdkWindow *window,
660                                   gboolean   composited);
661
662 /*
663  * This routine allows you to merge (ie ADD) child shapes to your
664  * own window's shape keeping its current shape and ADDING the child
665  * shapes to it.
666  * 
667  * - Raster
668  */
669 void gdk_window_merge_child_shapes         (GdkWindow       *window);
670
671 void gdk_window_input_shape_combine_mask   (GdkWindow       *window,
672                                             GdkBitmap       *mask,
673                                             gint             x,
674                                             gint             y);
675 void gdk_window_input_shape_combine_region (GdkWindow       *window,
676                                             const GdkRegion *shape_region,
677                                             gint             offset_x,
678                                             gint             offset_y);
679 void gdk_window_set_child_input_shapes     (GdkWindow       *window);
680 void gdk_window_merge_child_input_shapes   (GdkWindow       *window);
681
682
683 /*
684  * Check if a window has been shown, and whether all its
685  * parents up to a toplevel have been shown, respectively.
686  * Note that a window that is_viewable below is not necessarily
687  * viewable in the X sense.
688  */
689 gboolean gdk_window_is_visible     (GdkWindow *window);
690 gboolean gdk_window_is_viewable    (GdkWindow *window);
691 gboolean gdk_window_is_input_only  (GdkWindow *window);
692 gboolean gdk_window_is_shaped      (GdkWindow *window);
693
694 GdkWindowState gdk_window_get_state (GdkWindow *window);
695
696 /* Set static bit gravity on the parent, and static
697  * window gravity on all children.
698  */
699 gboolean gdk_window_set_static_gravities (GdkWindow *window,
700                                           gboolean   use_static);   
701
702 /* Functions to create/lookup windows from their native equivalents */ 
703 #ifndef GDK_MULTIHEAD_SAFE
704 GdkWindow*    gdk_window_foreign_new (GdkNativeWindow anid);
705 GdkWindow*    gdk_window_lookup      (GdkNativeWindow anid);
706 #endif
707 GdkWindow    *gdk_window_foreign_new_for_display (GdkDisplay      *display,
708                                                   GdkNativeWindow  anid);
709 GdkWindow*    gdk_window_lookup_for_display (GdkDisplay      *display,
710                                              GdkNativeWindow  anid);
711
712
713 /* GdkWindow */
714
715 void              gdk_window_set_type_hint (GdkWindow        *window,
716                                             GdkWindowTypeHint hint);
717 GdkWindowTypeHint gdk_window_get_type_hint (GdkWindow        *window);
718
719 gboolean      gdk_window_get_modal_hint   (GdkWindow       *window);
720 void          gdk_window_set_modal_hint   (GdkWindow       *window,
721                                            gboolean         modal);
722
723 void gdk_window_set_skip_taskbar_hint (GdkWindow *window,
724                                        gboolean   skips_taskbar);
725 void gdk_window_set_skip_pager_hint   (GdkWindow *window,
726                                        gboolean   skips_pager);
727 void gdk_window_set_urgency_hint      (GdkWindow *window,
728                                        gboolean   urgent);
729
730 void          gdk_window_set_geometry_hints (GdkWindow          *window,
731                                              const GdkGeometry  *geometry,
732                                              GdkWindowHints      geom_mask);
733 void          gdk_set_sm_client_id          (const gchar        *sm_client_id);
734
735 void          gdk_window_begin_paint_rect   (GdkWindow          *window,
736                                              const GdkRectangle *rectangle);
737 void          gdk_window_begin_paint_region (GdkWindow          *window,
738                                              const GdkRegion    *region);
739 void          gdk_window_end_paint          (GdkWindow          *window);
740 void          gdk_window_flush             (GdkWindow          *window);
741
742 void          gdk_window_set_title         (GdkWindow     *window,
743                                             const gchar   *title);
744 void          gdk_window_set_role          (GdkWindow     *window,
745                                             const gchar   *role);
746 void          gdk_window_set_startup_id    (GdkWindow     *window,
747                                             const gchar   *startup_id);
748 void          gdk_window_set_transient_for (GdkWindow     *window,
749                                             GdkWindow     *parent);
750 void          gdk_window_get_background  (GdkWindow       *window,
751                                           GdkColor        *color);
752 void          gdk_window_set_background  (GdkWindow       *window,
753                                           const GdkColor  *color);
754 void          gdk_window_get_back_pixmap (GdkWindow       *window,
755                                           GdkPixmap      **pixmap,
756                                           gboolean        *parent_relative);
757 void          gdk_window_set_back_pixmap (GdkWindow       *window,
758                                           GdkPixmap       *pixmap,
759                                           gboolean         parent_relative);
760 void          gdk_window_set_cursor      (GdkWindow       *window,
761                                           GdkCursor       *cursor);
762 GdkCursor    *gdk_window_get_cursor      (GdkWindow       *window);
763 void          gdk_window_get_user_data   (GdkWindow       *window,
764                                           gpointer        *data);
765 void          gdk_window_get_geometry    (GdkWindow       *window,
766                                           gint            *x,
767                                           gint            *y,
768                                           gint            *width,
769                                           gint            *height,
770                                           gint            *depth);
771 void          gdk_window_get_position    (GdkWindow       *window,
772                                           gint            *x,
773                                           gint            *y);
774 gint          gdk_window_get_origin      (GdkWindow       *window,
775                                           gint            *x,
776                                           gint            *y);
777 void          gdk_window_get_root_coords (GdkWindow       *window,
778                                           gint             x,
779                                           gint             y,
780                                           gint            *root_x,
781                                           gint            *root_y);
782 void       gdk_window_coords_to_parent   (GdkWindow       *window,
783                                           gdouble          x,
784                                           gdouble          y,
785                                           gdouble         *parent_x,
786                                           gdouble         *parent_y);
787 void       gdk_window_coords_from_parent (GdkWindow       *window,
788                                           gdouble          parent_x,
789                                           gdouble          parent_y,
790                                           gdouble         *x,
791                                           gdouble         *y);
792
793 #if !defined (GDK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION) || defined (GDK_COMPILATION)
794 /* Used by gtk_handle_box_button_changed () */
795 gboolean      gdk_window_get_deskrelative_origin (GdkWindow       *window,
796                                           gint            *x,
797                                           gint            *y);
798 #endif
799
800 void          gdk_window_get_root_origin (GdkWindow       *window,
801                                           gint            *x,
802                                           gint            *y);
803 void          gdk_window_get_frame_extents (GdkWindow     *window,
804                                             GdkRectangle  *rect);
805 GdkWindow*    gdk_window_get_pointer     (GdkWindow       *window,
806                                           gint            *x,
807                                           gint            *y,
808                                           GdkModifierType *mask);
809 GdkWindow *   gdk_window_get_parent      (GdkWindow       *window);
810 GdkWindow *   gdk_window_get_toplevel    (GdkWindow       *window);
811
812 GdkWindow *   gdk_window_get_effective_parent   (GdkWindow *window);
813 GdkWindow *   gdk_window_get_effective_toplevel (GdkWindow *window);
814
815 GList *       gdk_window_get_children    (GdkWindow       *window);
816 GList *       gdk_window_peek_children   (GdkWindow       *window);
817 GdkEventMask  gdk_window_get_events      (GdkWindow       *window);
818 void          gdk_window_set_events      (GdkWindow       *window,
819                                           GdkEventMask     event_mask);
820
821 void          gdk_window_set_icon_list   (GdkWindow       *window,
822                                           GList           *pixbufs);
823 void          gdk_window_set_icon        (GdkWindow       *window, 
824                                           GdkWindow       *icon_window,
825                                           GdkPixmap       *pixmap,
826                                           GdkBitmap       *mask);
827 void          gdk_window_set_icon_name   (GdkWindow       *window, 
828                                           const gchar     *name);
829 void          gdk_window_set_group       (GdkWindow       *window, 
830                                           GdkWindow       *leader);
831 GdkWindow*    gdk_window_get_group       (GdkWindow       *window);
832 void          gdk_window_set_decorations (GdkWindow       *window,
833                                           GdkWMDecoration  decorations);
834 gboolean      gdk_window_get_decorations (GdkWindow       *window,
835                                           GdkWMDecoration *decorations);
836 void          gdk_window_set_functions   (GdkWindow       *window,
837                                           GdkWMFunction    functions);
838
839 void          gdk_window_beep            (GdkWindow       *window);
840 void          gdk_window_iconify         (GdkWindow       *window);
841 void          gdk_window_deiconify       (GdkWindow       *window);
842 void          gdk_window_stick           (GdkWindow       *window);
843 void          gdk_window_unstick         (GdkWindow       *window);
844 void          gdk_window_maximize        (GdkWindow       *window);
845 void          gdk_window_unmaximize      (GdkWindow       *window);
846 void          gdk_window_fullscreen      (GdkWindow       *window);
847 void          gdk_window_unfullscreen    (GdkWindow       *window);
848 void          gdk_window_set_keep_above  (GdkWindow       *window,
849                                           gboolean         setting);
850 void          gdk_window_set_keep_below  (GdkWindow       *window,
851                                           gboolean         setting);
852 void          gdk_window_set_opacity     (GdkWindow       *window,
853                                           gdouble          opacity);
854 void          gdk_window_register_dnd    (GdkWindow       *window);
855
856 void gdk_window_begin_resize_drag (GdkWindow     *window,
857                                    GdkWindowEdge  edge,
858                                    gint           button,
859                                    gint           root_x,
860                                    gint           root_y,
861                                    guint32        timestamp);
862 void gdk_window_begin_move_drag   (GdkWindow     *window,
863                                    gint           button,
864                                    gint           root_x,
865                                    gint           root_y,
866                                    guint32        timestamp);
867
868 /* Interface for dirty-region queueing */
869 void       gdk_window_invalidate_rect           (GdkWindow          *window,
870                                                  const GdkRectangle *rect,
871                                                  gboolean            invalidate_children);
872 void       gdk_window_invalidate_region         (GdkWindow          *window,
873                                                  const GdkRegion    *region,
874                                                  gboolean            invalidate_children);
875 void       gdk_window_invalidate_maybe_recurse  (GdkWindow          *window,
876                                                  const GdkRegion    *region,
877                                                  gboolean (*child_func) (GdkWindow *, gpointer),
878                                                  gpointer   user_data);
879 GdkRegion *gdk_window_get_update_area     (GdkWindow    *window);
880
881 void       gdk_window_freeze_updates      (GdkWindow    *window);
882 void       gdk_window_thaw_updates        (GdkWindow    *window);
883
884 void       gdk_window_freeze_toplevel_updates_libgtk_only (GdkWindow *window);
885 void       gdk_window_thaw_toplevel_updates_libgtk_only   (GdkWindow *window);
886
887 void       gdk_window_process_all_updates (void);
888 void       gdk_window_process_updates     (GdkWindow    *window,
889                                            gboolean      update_children);
890
891 /* Enable/disable flicker, so you can tell if your code is inefficient. */
892 void       gdk_window_set_debug_updates   (gboolean      setting);
893
894 void       gdk_window_constrain_size      (GdkGeometry  *geometry,
895                                            guint         flags,
896                                            gint          width,
897                                            gint          height,
898                                            gint         *new_width,
899                                            gint         *new_height);
900
901 void gdk_window_get_internal_paint_info (GdkWindow    *window,
902                                          GdkDrawable **real_drawable,
903                                          gint         *x_offset,
904                                          gint         *y_offset);
905
906 void gdk_window_enable_synchronized_configure (GdkWindow *window);
907 void gdk_window_configure_finished            (GdkWindow *window);
908
909 #ifndef GDK_MULTIHEAD_SAFE
910 GdkPointerHooks *gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks);   
911 #endif /* GDK_MULTIHEAD_SAFE */
912
913 GdkWindow *gdk_get_default_root_window (void);
914
915 /* Offscreen redirection */
916 GdkPixmap *gdk_offscreen_window_get_pixmap     (GdkWindow     *window);
917 void       gdk_offscreen_window_set_embedder   (GdkWindow     *window,
918                                                 GdkWindow     *embedder);
919 GdkWindow *gdk_offscreen_window_get_embedder   (GdkWindow     *window);
920 void       gdk_window_geometry_changed         (GdkWindow     *window);
921
922 void       gdk_window_redirect_to_drawable   (GdkWindow     *window,
923                                               GdkDrawable   *drawable,
924                                               gint           src_x,
925                                               gint           src_y,
926                                               gint           dest_x,
927                                               gint           dest_y,
928                                               gint           width,
929                                               gint           height);
930 void       gdk_window_remove_redirection     (GdkWindow     *window);
931
932
933 G_END_DECLS
934
935 #endif /* __GDK_WINDOW_H__ */