1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
6 onscreen display areas in the target window system
8 <!-- ##### SECTION Long_Description ##### -->
10 A #GdkWindow is a rectangular region on the screen. It's a low-level object,
11 used to implement high-level objects such as #GtkWidget and #GtkWindow on the
12 GTK+ level. A #GtkWindow is a toplevel window, the thing a user might think of
13 as a "window" with a titlebar and so on; a #GtkWindow may contain many #GdkWindow.
14 For example, each #GtkButton has a #GdkWindow associated with it.
17 <!-- ##### SECTION See_Also ##### -->
22 <!-- ##### STRUCT GdkWindow ##### -->
24 An opaque structure representing an onscreen drawable.
25 Pointers to structures of type #GdkPixmap, #GdkBitmap,
26 and #GdkWindow, can often be used interchangeably.
27 The type #GdkDrawable refers generically to any of
31 @user_data: used to store the #GtkWidget associated with this window
33 <!-- ##### ENUM GdkWindowType ##### -->
35 Describes the kind of window.
38 @GDK_WINDOW_ROOT: root window; this window has no parent, covers the entire screen, and is created by the window system
39 @GDK_WINDOW_TOPLEVEL: toplevel window (used to implement #GtkWindow)
40 @GDK_WINDOW_CHILD: child window (used to implement e.g. #GtkButton)
41 @GDK_WINDOW_DIALOG: useless/deprecated compatibility type
42 @GDK_WINDOW_TEMP: override redirect temporary window (used to implement #GtkMenu)
43 @GDK_WINDOW_FOREIGN: foreign window (see gdk_window_foreign_new())
45 <!-- ##### ENUM GdkWindowClass ##### -->
47 @GDK_INPUT_OUTPUT windows are the standard kind of window you might expect.
48 @GDK_INPUT_ONLY windows are invisible; they are used to trap events, but
49 you can't draw on them.
52 @GDK_INPUT_OUTPUT: window for graphics and events
53 @GDK_INPUT_ONLY: window for events only
55 <!-- ##### ENUM GdkWindowHints ##### -->
57 Used to indicate which fields of a #GdkGeometry struct should be paid attention
58 to. Also, the presence/absence of @GDK_HINT_POS, @GDK_HINT_USER_POS, and
59 @GDK_HINT_USER_SIZE is significant, though they don't directly refer to
60 #GdkGeometry fields. @GDK_HINT_USER_POS will be set automatically by #GtkWindow
61 if you call gtk_window_move(). @GDK_HINT_USER_POS and @GDK_HINT_USER_SIZE
62 should be set if the user specified a size/position using a --geometry
63 command-line argument; gtk_window_parse_geometry() automatically sets these
67 @GDK_HINT_POS: indicates that the program has positioned the window
68 @GDK_HINT_MIN_SIZE: min size fields are set
69 @GDK_HINT_MAX_SIZE: max size fields are set
70 @GDK_HINT_BASE_SIZE: base size fields are set
71 @GDK_HINT_ASPECT: aspect ratio fields are set
72 @GDK_HINT_RESIZE_INC: resize increment fields are set
73 @GDK_HINT_WIN_GRAVITY: window gravity field is set
74 @GDK_HINT_USER_POS: indicates that the window's position was explicitly set by the user
75 @GDK_HINT_USER_SIZE: indicates that the window's size was explicitly set by the user
77 <!-- ##### STRUCT GdkGeometry ##### -->
79 The #GdkGeometry struct gives the window manager information about
80 a window's geometry constraints. Normally you would set these on
81 the GTK+ level using gtk_window_set_geometry_hints(). #GtkWindow
82 then sets the hints on the #GdkWindow it creates.
86 gdk_window_set_geometry_hints() expects the hints to be fully valid already and
87 simply passes them to the window manager; in contrast,
88 gtk_window_set_geometry_hints() performs some interpretation. For example,
89 #GtkWindow will apply the hints to the geometry widget instead of the toplevel
90 window, if you set a geometry widget. Also, the
91 @min_width/@min_height/@max_width/@max_height fields may be set to -1, and
92 #GtkWindow will substitute the size request of the window or geometry widget. If
93 the minimum size hint is not provided, #GtkWindow will use its requisition as
94 the minimum size. If the minimum size is provided and a geometry widget is set,
95 #GtkWindow will take the minimum size as the minimum size of the geometry widget
96 rather than the entire window. The base size is treated similarly.
100 The canonical use-case for gtk_window_set_geometry_hints() is to get a terminal
101 widget to resize properly. Here, the terminal text area should be the geometry
102 widget; #GtkWindow will then automatically set the base size to the size of
103 other widgets in the terminal window, such as the menubar and scrollbar. Then,
104 the @width_inc and @height_inc fields should be set to the size of one character
105 in the terminal. Finally, the base size should be set to the size of one
106 character. The net effect is that the minimum size of the terminal
107 will have a 1x1 character terminal area, and only terminal sizes on
108 the "character grid" will be allowed.
112 Here's an example of how the terminal example would be implemented, assuming
113 a terminal area widget called "terminal" and a toplevel window "toplevel":
114 <informalexample><programlisting>
117 hints.base_width = terminal->char_width;
118 hints.base_height = terminal->char_height;
119 hints.min_width = terminal->char_width;
120 hints.min_height = terminal->char_height;
121 hints.width_inc = terminal->char_width;
122 hints.height_inc = terminal->char_height;
124 gtk_window_set_geometry_hints (GTK_WINDOW (toplevel),
125 GTK_WIDGET (terminal),
127 GDK_HINT_RESIZE_INC |
130 </programlisting></informalexample>
134 The other useful fields are the @min_aspect and @max_aspect fields; these
135 contain a width/height ratio as a floating point number. If a geometry widget is
136 set, the aspect applies to the geometry widget rather than the entire window.
137 The most common use of these hints is probably to set @min_aspect and
138 @max_aspect to the same value, thus forcing the window to keep a constant aspect
142 @min_width: minimum width of window (or -1 to use requisition, with #GtkWindow only)
143 @min_height minimum height of window (or -1 to use requisition, with #GtkWindow only)
145 @max_width: maximum width of window (or -1 to use requisition, with #GtkWindow only)
146 @max_height: maximum height of window (or -1 to use requisition, with #GtkWindow only)
147 @base_width: allowed window widths are @base_width + @width_inc * N where N is any integer (-1 allowed with #GtkWindow)
148 @base_height: allowed window widths are @base_height + @height_inc * N where N is any integer (-1 allowed with #GtkWindow)
149 @width_inc: width resize increment
150 @height_inc: height resize increment
151 @min_aspect: minimum width/height ratio
152 @max_aspect: maximum width/height ratio
153 @win_gravity: window gravity, see gtk_window_set_gravity()
155 <!-- ##### ENUM GdkGravity ##### -->
157 Defines the reference point of a window and the meaning of coordinates
158 passed to gtk_window_move(). See gtk_window_move() and the "implementation
159 notes" section of the
160 <ulink url="http://www.freedesktop.org/standards/wm-spec.html">extended
161 window manager hints</ulink> specification for more details.
164 @GDK_GRAVITY_NORTH_WEST: the reference point is at the top left corner.
165 @GDK_GRAVITY_NORTH: the reference point is in the middle of the top edge.
166 @GDK_GRAVITY_NORTH_EAST: the reference point is at the top right corner.
167 @GDK_GRAVITY_WEST: the reference point is at the middle of the left edge.
168 @GDK_GRAVITY_CENTER: the reference point is at the center of the window.
169 @GDK_GRAVITY_EAST: the reference point is at the middle of the right edge.
170 @GDK_GRAVITY_SOUTH_WEST: the reference point is at the lower left corner.
171 @GDK_GRAVITY_SOUTH: the reference point is at the middle of the lower edge.
172 @GDK_GRAVITY_SOUTH_EAST: the reference point is at the lower right corner.
173 @GDK_GRAVITY_STATIC: the reference point is at the top left corner of the
174 window itself, ignoring window manager decorations.
177 <!-- ##### ENUM GdkWindowEdge ##### -->
179 Determines a window edge or corner.
182 @GDK_WINDOW_EDGE_NORTH_WEST: the top left corner.
183 @GDK_WINDOW_EDGE_NORTH: the top edge.
184 @GDK_WINDOW_EDGE_NORTH_EAST: the top right corner.
185 @GDK_WINDOW_EDGE_WEST: the left edge.
186 @GDK_WINDOW_EDGE_EAST: the right edge.
187 @GDK_WINDOW_EDGE_SOUTH_WEST: the lower left corner.
188 @GDK_WINDOW_EDGE_SOUTH: the lower edge.
189 @GDK_WINDOW_EDGE_SOUTH_EAST: the lower right corner.
192 <!-- ##### ENUM GdkWindowTypeHint ##### -->
194 These are hints for the window manager that indicate what type of function
195 the window has. The window manager can use this when determining decoration
196 and behaviour of the window. The hint must be set before mapping the window.
199 @GDK_WINDOW_TYPE_HINT_NORMAL: Normal toplevel window.
200 @GDK_WINDOW_TYPE_HINT_DIALOG: Dialog window.
201 @GDK_WINDOW_TYPE_HINT_MENU: Window used to implement a menu.
202 @GDK_WINDOW_TYPE_HINT_TOOLBAR: Window used to implement toolbars.
204 <!-- ##### STRUCT GdkWindowAttr ##### -->
206 Attributes to use for a newly-created window.
209 @title: title of the window (for toplevel windows)
210 @event_mask: event mask (see gdk_window_set_events())
211 @x: X coordinate relative to parent window (see gdk_window_move())
212 @y: Y coordinate relative to parent window (see gdk_window_move())
213 @width: width of window
214 @height: height of window
215 @wclass: #GDK_INPUT_OUTPUT (normal window) or #GDK_INPUT_ONLY (invisible window that receives events)
216 @visual: #GdkVisual for window
217 @colormap: #GdkColormap for window
218 @window_type: type of window
219 @cursor: cursor for the window (see gdk_window_set_cursor())
220 @wmclass_name: don't use (see gtk_window_set_wmclass())
221 @wmclass_class: don't use (see gtk_window_set_wmclass())
222 @override_redirect: %TRUE to bypass the window manager
224 <!-- ##### ENUM GdkWindowAttributesType ##### -->
226 Used to indicate which fields in the #GdkWindowAttr struct should be
227 honored. For example, if you filled in the "cursor" and "x" fields of
228 #GdkWindowAttr, pass "@GDK_WA_X | @GDK_WA_CURSOR" to gdk_window_new(). Fields
229 in #GdkWindowAttr not covered by a bit in this enum are required; for example,
230 the @width/@height, @wclass, and @window_type fields are required, they have no
231 corresponding flag in #GdkWindowAttributesType.
234 @GDK_WA_TITLE: Honor the title field
235 @GDK_WA_X: Honor the X coordinate field
236 @GDK_WA_Y: Honor the Y coordinate field
237 @GDK_WA_CURSOR: Honor the cursor field
238 @GDK_WA_COLORMAP: Honor the colormap field
239 @GDK_WA_VISUAL: Honor the visual field
240 @GDK_WA_WMCLASS: Honor the wmclass_class and wmclass_name fields
241 @GDK_WA_NOREDIR: Honor the override_redirect field
243 <!-- ##### FUNCTION gdk_window_new ##### -->
254 <!-- ##### FUNCTION gdk_window_destroy ##### -->
262 <!-- ##### MACRO gdk_window_ref ##### -->
264 Deprecated equivalent of g_object_ref()
270 <!-- ##### MACRO gdk_window_unref ##### -->
272 Deprecated equivalent of g_object_unref()
277 <!-- ##### FUNCTION gdk_window_get_window_type ##### -->
286 <!-- ##### FUNCTION gdk_window_at_pointer ##### -->
296 <!-- ##### FUNCTION gdk_window_show ##### -->
304 <!-- ##### FUNCTION gdk_window_show_unraised ##### -->
312 <!-- ##### FUNCTION gdk_window_hide ##### -->
320 <!-- ##### FUNCTION gdk_window_is_visible ##### -->
329 <!-- ##### FUNCTION gdk_window_is_viewable ##### -->
338 <!-- ##### FUNCTION gdk_window_get_state ##### -->
347 <!-- ##### FUNCTION gdk_window_withdraw ##### -->
355 <!-- ##### FUNCTION gdk_window_iconify ##### -->
363 <!-- ##### FUNCTION gdk_window_deiconify ##### -->
371 <!-- ##### FUNCTION gdk_window_stick ##### -->
379 <!-- ##### FUNCTION gdk_window_unstick ##### -->
387 <!-- ##### FUNCTION gdk_window_maximize ##### -->
395 <!-- ##### FUNCTION gdk_window_unmaximize ##### -->
403 <!-- ##### FUNCTION gdk_window_move ##### -->
413 <!-- ##### FUNCTION gdk_window_resize ##### -->
423 <!-- ##### FUNCTION gdk_window_move_resize ##### -->
435 <!-- ##### FUNCTION gdk_window_scroll ##### -->
445 <!-- ##### FUNCTION gdk_window_reparent ##### -->
456 <!-- ##### FUNCTION gdk_window_clear ##### -->
464 <!-- ##### FUNCTION gdk_window_clear_area ##### -->
476 <!-- ##### FUNCTION gdk_window_clear_area_e ##### -->
488 <!-- ##### MACRO gdk_window_copy_area ##### -->
490 Deprecated equivalent to gdk_draw_drawable(), see that function for docs
504 <!-- ##### FUNCTION gdk_window_raise ##### -->
512 <!-- ##### FUNCTION gdk_window_lower ##### -->
520 <!-- ##### FUNCTION gdk_window_focus ##### -->
529 <!-- ##### FUNCTION gdk_window_register_dnd ##### -->
531 Registers a window as a potential drop destination.
534 @window: a #GdkWindow.
537 <!-- ##### FUNCTION gdk_window_begin_resize_drag ##### -->
550 <!-- ##### FUNCTION gdk_window_begin_move_drag ##### -->
562 <!-- ##### FUNCTION gdk_window_constrain_size ##### -->
575 <!-- ##### FUNCTION gdk_window_begin_paint_rect ##### -->
584 <!-- ##### FUNCTION gdk_window_begin_paint_region ##### -->
593 <!-- ##### FUNCTION gdk_window_end_paint ##### -->
601 <!-- ##### FUNCTION gdk_window_invalidate_rect ##### -->
608 @invalidate_children:
611 <!-- ##### FUNCTION gdk_window_invalidate_region ##### -->
618 @invalidate_children:
621 <!-- ##### FUNCTION gdk_window_get_update_area ##### -->
630 <!-- ##### FUNCTION gdk_window_freeze_updates ##### -->
638 <!-- ##### FUNCTION gdk_window_thaw_updates ##### -->
646 <!-- ##### FUNCTION gdk_window_process_all_updates ##### -->
653 <!-- ##### FUNCTION gdk_window_process_updates ##### -->
662 <!-- ##### FUNCTION gdk_window_set_debug_updates ##### -->
670 <!-- ##### FUNCTION gdk_window_get_internal_paint_info ##### -->
681 <!-- ##### FUNCTION gdk_window_set_user_data ##### -->
690 <!-- ##### FUNCTION gdk_window_set_override_redirect ##### -->
699 <!-- ##### FUNCTION gdk_window_add_filter ##### -->
709 <!-- ##### FUNCTION gdk_window_remove_filter ##### -->
719 <!-- ##### USER_FUNCTION GdkFilterFunc ##### -->
721 Specifies the type of function used to filter native events before they are
722 converted to GDK events. A filter may translate the native event to a GDK
723 event or handle it without translation.
726 @xevent: the native event to filter.
727 @event: the GDK event to which the X event will be translated.
728 @data: user data set when the filter was installed.
729 @Returns: a #GdkFilterReturn value.
732 <!-- ##### ENUM GdkFilterReturn ##### -->
734 Specifies the result of applying a #GdkFilterFunc to a native event.
737 @GDK_FILTER_CONTINUE: event not handled, continue processing.
738 @GDK_FILTER_TRANSLATE: translated event stored.
739 @GDK_FILTER_REMOVE: event handled, terminate processing.
741 <!-- ##### TYPEDEF GdkXEvent ##### -->
743 Used to represent native events (<type>XEvent</type>s for the X11
744 backend, <type>MSG</type>s for Win32).
748 <!-- ##### FUNCTION gdk_window_shape_combine_mask ##### -->
759 <!-- ##### FUNCTION gdk_window_shape_combine_region ##### -->
770 <!-- ##### FUNCTION gdk_window_set_child_shapes ##### -->
778 <!-- ##### FUNCTION gdk_window_merge_child_shapes ##### -->
786 <!-- ##### FUNCTION gdk_window_set_static_gravities ##### -->
796 <!-- ##### FUNCTION gdk_window_set_hints ##### -->
811 <!-- ##### FUNCTION gdk_window_set_title ##### -->
820 <!-- ##### FUNCTION gdk_window_set_background ##### -->
829 <!-- ##### FUNCTION gdk_window_set_back_pixmap ##### -->
839 <!-- ##### MACRO GDK_PARENT_RELATIVE ##### -->
841 A special value for <literal>GdkPixmap*</literal> variables, indicating
842 that the background pixmap for a window should be inherited from the parent
847 <!-- ##### FUNCTION gdk_window_set_cursor ##### -->
856 <!-- ##### MACRO gdk_window_set_colormap ##### -->
858 Deprecated equivalent to gdk_drawable_set_colormap()
863 <!-- ##### FUNCTION gdk_window_get_user_data ##### -->
872 <!-- ##### FUNCTION gdk_window_get_geometry ##### -->
885 <!-- ##### FUNCTION gdk_window_set_geometry_hints ##### -->
895 <!-- ##### FUNCTION gdk_window_set_icon_list ##### -->
904 <!-- ##### FUNCTION gdk_window_set_modal_hint ##### -->
913 <!-- ##### FUNCTION gdk_window_set_type_hint ##### -->
922 <!-- ##### FUNCTION gdk_window_get_position ##### -->
932 <!-- ##### FUNCTION gdk_window_get_root_origin ##### -->
942 <!-- ##### FUNCTION gdk_window_get_frame_extents ##### -->
951 <!-- ##### MACRO gdk_window_get_size ##### -->
953 Deprecated equivalent of gdk_drawable_get_size().
958 <!-- ##### MACRO gdk_window_get_visual ##### -->
960 Deprecated equivalent of gdk_drawable_get_visual().
966 <!-- ##### MACRO gdk_window_get_colormap ##### -->
968 Deprecated equivalent of gdk_drawable_get_colormap().
971 @Returns: colormap for the window
974 <!-- ##### MACRO gdk_window_get_type ##### -->
976 Deprecated equivalent of gdk_drawable_get_type().
979 @Returns: type of drawable
982 <!-- ##### FUNCTION gdk_window_get_origin ##### -->
993 <!-- ##### FUNCTION gdk_window_get_deskrelative_origin ##### -->
1004 <!-- ##### FUNCTION gdk_window_get_pointer ##### -->
1016 <!-- ##### ENUM GdkModifierType ##### -->
1037 <!-- ##### FUNCTION gdk_window_get_parent ##### -->
1046 <!-- ##### FUNCTION gdk_window_get_toplevel ##### -->
1055 <!-- ##### FUNCTION gdk_window_get_children ##### -->
1064 <!-- ##### FUNCTION gdk_window_peek_children ##### -->
1073 <!-- ##### FUNCTION gdk_window_get_events ##### -->
1082 <!-- ##### FUNCTION gdk_window_set_events ##### -->
1091 <!-- ##### FUNCTION gdk_window_set_icon ##### -->
1102 <!-- ##### FUNCTION gdk_window_set_icon_name ##### -->
1111 <!-- ##### FUNCTION gdk_window_set_transient_for ##### -->
1120 <!-- ##### FUNCTION gdk_window_set_role ##### -->
1129 <!-- ##### FUNCTION gdk_window_set_group ##### -->
1138 <!-- ##### FUNCTION gdk_window_set_decorations ##### -->
1147 <!-- ##### FUNCTION gdk_window_get_decorations ##### -->
1152 @window: The window to get the decorations from
1153 @decorations: The window decorations will be written here
1154 @Returns: %TRUE if the window has decorations set, %FALSE otherwise.
1157 <!-- ##### ENUM GdkWMDecoration ##### -->
1159 These are hints originally defined by the Motif toolkit.
1160 The window manager can use them when determining how to decorate
1161 the window. The hint must be set before mapping the window.
1164 @GDK_DECOR_ALL: all decorations should be applied.
1165 @GDK_DECOR_BORDER: a frame should be drawn around the window.
1166 @GDK_DECOR_RESIZEH: the frame should have resize handles.
1167 @GDK_DECOR_TITLE: a titlebar should be placed above the window.
1168 @GDK_DECOR_MENU: a button for opening a menu should be included.
1169 @GDK_DECOR_MINIMIZE: a minimize button should be included.
1170 @GDK_DECOR_MAXIMIZE: a maximize button should be included.
1172 <!-- ##### FUNCTION gdk_window_set_functions ##### -->
1181 <!-- ##### ENUM GdkWMFunction ##### -->
1183 These are hints originally defined by the Motif toolkit.
1184 The window manager can use them when determining the functions
1185 to offer for the window.
1186 The hint must be set before mapping the window.
1189 @GDK_FUNC_ALL: all functions should be offered.
1190 @GDK_FUNC_RESIZE: the window should be resizable.
1191 @GDK_FUNC_MOVE: the window should be movable.
1192 @GDK_FUNC_MINIMIZE: the window should be minimizable.
1193 @GDK_FUNC_MAXIMIZE: the window should be maximizable.
1194 @GDK_FUNC_CLOSE: the window should be closable.
1196 <!-- ##### FUNCTION gdk_window_get_toplevels ##### -->
1204 <!-- ##### FUNCTION gdk_get_default_root_window ##### -->
1212 <!-- ##### STRUCT GdkPointerHooks ##### -->
1214 A table of pointers to functions for getting quantities related to
1215 the current pointer position. GDK has one global table of this type,
1216 which can be set using gdk_set_pointer_hooks().
1219 This is only useful for such low-level tools as an event recorder.
1220 Applications should never have any reason to use this facility
1223 @get_pointer: Obtains the current pointer position and modifier state.
1224 The position is given in coordinates relative to the window containing
1225 the pointer, which is returned in @window.
1226 @window_at_pointer: Obtains the window underneath the mouse pointer,
1227 returning the location of that window in @win_x, @win_y. Returns %NULL
1228 if the window under the mouse pointer is not known to GDK (for example,
1229 belongs to another application).
1232 <!-- ##### FUNCTION gdk_set_pointer_hooks ##### -->