Windows

Windows — Onscreen display areas in the target window system

Functions

GdkWindow * gdk_window_new ()
void gdk_window_destroy ()
GdkWindowType gdk_window_get_window_type ()
GdkDisplay * gdk_window_get_display ()
GdkScreen * gdk_window_get_screen ()
GdkVisual * gdk_window_get_visual ()
GdkWindow * gdk_window_at_pointer ()
void gdk_window_show ()
void gdk_window_show_unraised ()
void gdk_window_hide ()
gboolean gdk_window_is_destroyed ()
gboolean gdk_window_is_visible ()
gboolean gdk_window_is_viewable ()
gboolean gdk_window_is_input_only ()
gboolean gdk_window_is_shaped ()
GdkWindowState gdk_window_get_state ()
void gdk_window_withdraw ()
void gdk_window_iconify ()
void gdk_window_deiconify ()
void gdk_window_stick ()
void gdk_window_unstick ()
void gdk_window_maximize ()
void gdk_window_unmaximize ()
void gdk_window_fullscreen ()
void gdk_window_unfullscreen ()
GdkFullscreenMode gdk_window_get_fullscreen_mode ()
void gdk_window_set_fullscreen_mode ()
void gdk_window_set_keep_above ()
void gdk_window_set_keep_below ()
void gdk_window_set_opacity ()
void gdk_window_set_composited ()
gboolean gdk_window_get_composited ()
void gdk_window_move ()
void gdk_window_resize ()
void gdk_window_move_resize ()
void gdk_window_scroll ()
void gdk_window_move_region ()
void gdk_window_flush ()
gboolean gdk_window_has_native ()
gboolean gdk_window_ensure_native ()
void gdk_window_reparent ()
void gdk_window_raise ()
void gdk_window_lower ()
void gdk_window_restack ()
void gdk_window_focus ()
void gdk_window_register_dnd ()
void gdk_window_begin_resize_drag ()
void gdk_window_begin_resize_drag_for_device ()
void gdk_window_begin_move_drag ()
void gdk_window_begin_move_drag_for_device ()
gboolean gdk_window_show_window_menu ()
void gdk_window_constrain_size ()
void gdk_window_beep ()
gint gdk_window_get_scale_factor ()
void gdk_window_set_opaque_region ()
cairo_region_t * gdk_window_get_clip_region ()
void gdk_window_begin_paint_rect ()
void gdk_window_begin_paint_region ()
void gdk_window_end_paint ()
cairo_region_t * gdk_window_get_visible_region ()
void (*GdkWindowInvalidateHandlerFunc) ()
void gdk_window_set_invalidate_handler ()
void gdk_window_invalidate_rect ()
void gdk_window_invalidate_region ()
gboolean (*GdkWindowChildFunc) ()
void gdk_window_invalidate_maybe_recurse ()
cairo_region_t * gdk_window_get_update_area ()
void gdk_window_freeze_updates ()
void gdk_window_thaw_updates ()
void gdk_window_process_all_updates ()
void gdk_window_process_updates ()
void gdk_window_set_debug_updates ()
void gdk_window_enable_synchronized_configure ()
void gdk_window_configure_finished ()
GdkFrameClock * gdk_window_get_frame_clock ()
void gdk_window_set_user_data ()
void gdk_window_set_override_redirect ()
void gdk_window_set_accept_focus ()
gboolean gdk_window_get_accept_focus ()
void gdk_window_set_focus_on_map ()
gboolean gdk_window_get_focus_on_map ()
void gdk_window_add_filter ()
void gdk_window_remove_filter ()
GdkFilterReturn (*GdkFilterFunc) ()
void gdk_window_shape_combine_region ()
void gdk_window_set_child_shapes ()
void gdk_window_merge_child_shapes ()
void gdk_window_input_shape_combine_region ()
void gdk_window_set_child_input_shapes ()
void gdk_window_merge_child_input_shapes ()
gboolean gdk_window_set_static_gravities ()
void gdk_window_set_title ()
void gdk_window_set_background ()
void gdk_window_set_background_rgba ()
void gdk_window_set_background_pattern ()
cairo_pattern_t * gdk_window_get_background_pattern ()
void gdk_window_set_cursor ()
GdkCursor * gdk_window_get_cursor ()
void gdk_window_get_user_data ()
void gdk_window_get_geometry ()
void gdk_window_set_geometry_hints ()
int gdk_window_get_width ()
int gdk_window_get_height ()
void gdk_window_set_icon_list ()
void gdk_window_set_modal_hint ()
gboolean gdk_window_get_modal_hint ()
void gdk_window_set_type_hint ()
GdkWindowTypeHint gdk_window_get_type_hint ()
void gdk_window_set_shadow_width ()
void gdk_window_set_skip_taskbar_hint ()
void gdk_window_set_skip_pager_hint ()
void gdk_window_set_urgency_hint ()
void gdk_window_get_position ()
void gdk_window_get_root_origin ()
void gdk_window_get_frame_extents ()
gint gdk_window_get_origin ()
void gdk_window_get_root_coords ()
GdkWindow * gdk_window_get_pointer ()
GdkWindow * gdk_window_get_device_position ()
GdkWindow * gdk_window_get_device_position_double ()
GdkWindow * gdk_window_get_parent ()
GdkWindow * gdk_window_get_toplevel ()
GList * gdk_window_get_children ()
GList * gdk_window_get_children_with_user_data ()
GList * gdk_window_peek_children ()
GdkEventMask gdk_window_get_events ()
void gdk_window_set_events ()
void gdk_window_set_icon_name ()
void gdk_window_set_transient_for ()
void gdk_window_set_role ()
void gdk_window_set_startup_id ()
void gdk_window_set_group ()
GdkWindow * gdk_window_get_group ()
void gdk_window_set_decorations ()
gboolean gdk_window_get_decorations ()
void gdk_window_set_functions ()
GdkWindow * gdk_get_default_root_window ()
gboolean gdk_window_get_support_multidevice ()
void gdk_window_set_support_multidevice ()
GdkCursor * gdk_window_get_device_cursor ()
void gdk_window_set_device_cursor ()
GdkEventMask gdk_window_get_device_events ()
void gdk_window_set_device_events ()
GdkEventMask gdk_window_get_source_events ()
void gdk_window_set_source_events ()
gboolean gdk_window_get_event_compression ()
void gdk_window_set_event_compression ()
cairo_surface_t * gdk_offscreen_window_get_surface ()
void gdk_offscreen_window_set_embedder ()
GdkWindow * gdk_offscreen_window_get_embedder ()
void gdk_window_geometry_changed ()
void gdk_window_coords_from_parent ()
void gdk_window_coords_to_parent ()
GdkWindow * gdk_window_get_effective_parent ()
GdkWindow * gdk_window_get_effective_toplevel ()

Properties

GdkCursor * cursor Read / Write

Signals

CairoSurface* create-surface Run Last
void from-embedder Run Last
GdkWindow* pick-embedded-child Run Last
void to-embedder Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── GdkWindow

Includes

#include <gdk/gdk.h>

Description

A GdkWindow is a (usually) rectangular region on the screen. It’s a low-level object, used to implement high-level objects such as GtkWidget and GtkWindow on the GTK+ level. A GtkWindow is a toplevel window, the thing a user might think of as a “window” with a titlebar and so on; a GtkWindow may contain many GdkWindows. For example, each GtkButton has a GdkWindow associated with it.

Composited Windows

Normally, the windowing system takes care of rendering the contents of a child window onto its parent window. This mechanism can be intercepted by calling gdk_window_set_composited() on the child window. For a “composited” window it is the responsibility of the application to render the window contents at the right spot.


Offscreen Windows

Offscreen windows are more general than composited windows, since they allow not only to modify the rendering of the child window onto its parent, but also to apply coordinate transformations.

To integrate an offscreen window into a window hierarchy, one has to call gdk_offscreen_window_set_embedder() and handle a number of signals. The “pick-embedded-child” signal on the embedder window is used to select an offscreen child at given coordinates, and the “to-embedder” and “from-embedder” signals on the offscreen window are used to translate coordinates between the embedder and the offscreen window.

For rendering an offscreen window onto its embedder, the contents of the offscreen window are available as a surface, via gdk_offscreen_window_get_surface().

Functions

gdk_window_new ()

GdkWindow *
gdk_window_new (GdkWindow *parent,
                GdkWindowAttr *attributes,
                gint attributes_mask);

Creates a new GdkWindow using the attributes from attributes . See GdkWindowAttr and GdkWindowAttributesType for more details. Note: to use this on displays other than the default display, parent must be specified.

Parameters

parent

a GdkWindow, or NULL to create the window as a child of the default root window for the default display.

[allow-none]

attributes

attributes of the new window

 

attributes_mask

mask indicating which fields in attributes are valid.

[type GdkWindowAttributesType]

Returns

the new GdkWindow.

[transfer full]


gdk_window_destroy ()

void
gdk_window_destroy (GdkWindow *window);

Destroys the window system resources associated with window and decrements window 's reference count. The window system resources for all children of window are also destroyed, but the children’s reference counts are not decremented.

Note that a window will not be destroyed automatically when its reference count reaches zero. You must call this function yourself before that happens.

Parameters

window

a GdkWindow

 

gdk_window_get_window_type ()

GdkWindowType
gdk_window_get_window_type (GdkWindow *window);

Gets the type of the window. See GdkWindowType.

Parameters

window

a GdkWindow

 

Returns

type of window


gdk_window_get_display ()

GdkDisplay *
gdk_window_get_display (GdkWindow *window);

Gets the GdkDisplay associated with a GdkWindow.

Parameters

window

a GdkWindow

 

Returns

the GdkDisplay associated with window .

[transfer none]

Since 2.24


gdk_window_get_screen ()

GdkScreen *
gdk_window_get_screen (GdkWindow *window);

Gets the GdkScreen associated with a GdkWindow.

Parameters

window

a GdkWindow

 

Returns

the GdkScreen associated with window .

[transfer none]

Since 2.24


gdk_window_get_visual ()

GdkVisual *
gdk_window_get_visual (GdkWindow *window);

Gets the GdkVisual describing the pixel format of window .

Parameters

window

a GdkWindow

 

Returns

a GdkVisual.

[transfer none]

Since 2.24


gdk_window_at_pointer ()

GdkWindow *
gdk_window_at_pointer (gint *win_x,
                       gint *win_y);

gdk_window_at_pointer has been deprecated since version 3.0 and should not be used in newly-written code.

Use gdk_device_get_window_at_position() instead.

Obtains the window underneath the mouse pointer, returning the location of that window in win_x , win_y . Returns NULL if the window under the mouse pointer is not known to GDK (if the window belongs to another application and a GdkWindow hasn’t been created for it with gdk_window_foreign_new())

NOTE: For multihead-aware widgets or applications use gdk_display_get_window_at_pointer() instead.

Parameters

win_x

return location for origin of the window under the pointer.

[out][allow-none]

win_y

return location for origin of the window under the pointer.

[out][allow-none]

Returns

window under the mouse pointer.

[transfer none]


gdk_window_show ()

void
gdk_window_show (GdkWindow *window);

Like gdk_window_show_unraised(), but also raises the window to the top of the window stack (moves the window to the front of the Z-order).

This function maps a window so it’s visible onscreen. Its opposite is gdk_window_hide().

When implementing a GtkWidget, you should call this function on the widget's GdkWindow as part of the “map” method.

Parameters

window

a GdkWindow

 

gdk_window_show_unraised ()

void
gdk_window_show_unraised (GdkWindow *window);

Shows a GdkWindow onscreen, but does not modify its stacking order. In contrast, gdk_window_show() will raise the window to the top of the window stack.

On the X11 platform, in Xlib terms, this function calls XMapWindow() (it also updates some internal GDK state, which means that you can’t really use XMapWindow() directly on a GDK window).

Parameters

window

a GdkWindow

 

gdk_window_hide ()

void
gdk_window_hide (GdkWindow *window);

For toplevel windows, withdraws them, so they will no longer be known to the window manager; for all windows, unmaps them, so they won’t be displayed. Normally done automatically as part of gtk_widget_hide().

Parameters

window

a GdkWindow

 

gdk_window_is_destroyed ()

gboolean
gdk_window_is_destroyed (GdkWindow *window);

Check to see if a window is destroyed..

Parameters

window

a GdkWindow

 

Returns

TRUE if the window is destroyed

Since 2.18


gdk_window_is_visible ()

gboolean
gdk_window_is_visible (GdkWindow *window);

Checks whether the window has been mapped (with gdk_window_show() or gdk_window_show_unraised()).

Parameters

window

a GdkWindow

 

Returns

TRUE if the window is mapped


gdk_window_is_viewable ()

gboolean
gdk_window_is_viewable (GdkWindow *window);

Check if the window and all ancestors of the window are mapped. (This is not necessarily "viewable" in the X sense, since we only check as far as we have GDK window parents, not to the root window.)

Parameters

window

a GdkWindow

 

Returns

TRUE if the window is viewable


gdk_window_is_input_only ()

gboolean
gdk_window_is_input_only (GdkWindow *window);

Determines whether or not the window is an input only window.

Parameters

window

a toplevel GdkWindow

 

Returns

TRUE if window is input only

Since 2.22


gdk_window_is_shaped ()

gboolean
gdk_window_is_shaped (GdkWindow *window);

Determines whether or not the window is shaped.

Parameters

window

a toplevel GdkWindow

 

Returns

TRUE if window is shaped

Since 2.22


gdk_window_get_state ()

GdkWindowState
gdk_window_get_state (GdkWindow *window);

Gets the bitwise OR of the currently active window state flags, from the GdkWindowState enumeration.

Parameters

window

a GdkWindow

 

Returns

window state bitfield


gdk_window_withdraw ()

void
gdk_window_withdraw (GdkWindow *window);

Withdraws a window (unmaps it and asks the window manager to forget about it). This function is not really useful as gdk_window_hide() automatically withdraws toplevel windows before hiding them.

Parameters

window

a toplevel GdkWindow

 

gdk_window_iconify ()

void
gdk_window_iconify (GdkWindow *window);

Asks to iconify (minimize) window . The window manager may choose to ignore the request, but normally will honor it. Using gtk_window_iconify() is preferred, if you have a GtkWindow widget.

This function only makes sense when window is a toplevel window.

Parameters

window

a toplevel GdkWindow

 

gdk_window_deiconify ()

void
gdk_window_deiconify (GdkWindow *window);

Attempt to deiconify (unminimize) window . On X11 the window manager may choose to ignore the request to deiconify. When using GTK+, use gtk_window_deiconify() instead of the GdkWindow variant. Or better yet, you probably want to use gtk_window_present(), which raises the window, focuses it, unminimizes it, and puts it on the current desktop.

Parameters

window

a toplevel GdkWindow

 

gdk_window_stick ()

void
gdk_window_stick (GdkWindow *window);

“Pins” a window such that it’s on all workspaces and does not scroll with viewports, for window managers that have scrollable viewports. (When using GtkWindow, gtk_window_stick() may be more useful.)

On the X11 platform, this function depends on window manager support, so may have no effect with many window managers. However, GDK will do the best it can to convince the window manager to stick the window. For window managers that don’t support this operation, there’s nothing you can do to force it to happen.

Parameters

window

a toplevel GdkWindow

 

gdk_window_unstick ()

void
gdk_window_unstick (GdkWindow *window);

Reverse operation for gdk_window_stick(); see gdk_window_stick(), and gtk_window_unstick().

Parameters

window

a toplevel GdkWindow

 

gdk_window_maximize ()

void
gdk_window_maximize (GdkWindow *window);

Maximizes the window. If the window was already maximized, then this function does nothing.

On X11, asks the window manager to maximize window , if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don’t have a concept of “maximized”; so you can’t rely on the maximization actually happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

On Windows, reliably maximizes the window.

Parameters

window

a toplevel GdkWindow

 

gdk_window_unmaximize ()

void
gdk_window_unmaximize (GdkWindow *window);

Unmaximizes the window. If the window wasn’t maximized, then this function does nothing.

On X11, asks the window manager to unmaximize window , if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don’t have a concept of “maximized”; so you can’t rely on the unmaximization actually happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

On Windows, reliably unmaximizes the window.

Parameters

window

a toplevel GdkWindow

 

gdk_window_fullscreen ()

void
gdk_window_fullscreen (GdkWindow *window);

Moves the window into fullscreen mode. This means the window covers the entire screen and is above any panels or task bars.

If the window was already fullscreen, then this function does nothing.

On X11, asks the window manager to put window in a fullscreen state, if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don’t have a concept of “fullscreen”; so you can’t rely on the fullscreenification actually happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

Parameters

window

a toplevel GdkWindow

 

Since 2.2


gdk_window_unfullscreen ()

void
gdk_window_unfullscreen (GdkWindow *window);

Moves the window out of fullscreen mode. If the window was not fullscreen, does nothing.

On X11, asks the window manager to move window out of the fullscreen state, if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don’t have a concept of “fullscreen”; so you can’t rely on the unfullscreenification actually happening. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

Parameters

window

a toplevel GdkWindow

 

Since 2.2


gdk_window_get_fullscreen_mode ()

GdkFullscreenMode
gdk_window_get_fullscreen_mode (GdkWindow *window);

Obtains the GdkFullscreenMode of the window .

Parameters

window

a toplevel GdkWindow

 

Returns

The GdkFullscreenMode applied to the window when fullscreen.

Since 3.8


gdk_window_set_fullscreen_mode ()

void
gdk_window_set_fullscreen_mode (GdkWindow *window,
                                GdkFullscreenMode mode);

Specifies whether the window should span over all monitors (in a multi-head setup) or only the current monitor when in fullscreen mode.

The mode argument is from the GdkFullscreenMode enumeration. If GDK_FULLSCREEN_ON_ALL_MONITORS is specified, the fullscreen window will span over all monitors from the GdkScreen.

On X11, searches through the list of monitors from the GdkScreen the ones which delimit the 4 edges of the entire GdkScreen and will ask the window manager to span the window over these monitors.

If the XINERAMA extension is not available or not usable, this function has no effect.

Not all window managers support this, so you can’t rely on the fullscreen window to span over the multiple monitors when GDK_FULLSCREEN_ON_ALL_MONITORS is specified.

Parameters

window

a toplevel GdkWindow

 

mode

fullscreen mode

 

Since 3.8


gdk_window_set_keep_above ()

void
gdk_window_set_keep_above (GdkWindow *window,
                           gboolean setting);

Set if window must be kept above other windows. If the window was already above, then this function does nothing.

On X11, asks the window manager to keep window above, if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don’t have a concept of “keep above”; so you can’t rely on the window being kept above. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

Parameters

window

a toplevel GdkWindow

 

setting

whether to keep window above other windows

 

Since 2.4


gdk_window_set_keep_below ()

void
gdk_window_set_keep_below (GdkWindow *window,
                           gboolean setting);

Set if window must be kept below other windows. If the window was already below, then this function does nothing.

On X11, asks the window manager to keep window below, if the window manager supports this operation. Not all window managers support this, and some deliberately ignore it or don’t have a concept of “keep below”; so you can’t rely on the window being kept below. But it will happen with most standard window managers, and GDK makes a best effort to get it to happen.

Parameters

window

a toplevel GdkWindow

 

setting

whether to keep window below other windows

 

Since 2.4


gdk_window_set_opacity ()

void
gdk_window_set_opacity (GdkWindow *window,
                        gdouble opacity);

Set window to render as partially transparent, with opacity 0 being fully transparent and 1 fully opaque. (Values of the opacity parameter are clamped to the [0,1] range.)

For toplevel windows this depends on support from the windowing system that may not always be there. For instance, On X11, this works only on X screens with a compositing manager running.

For child windows this function only works for non-native windows.

For setting up per-pixel alpha topelevels, see gdk_screen_get_rgba_visual(), and for non-toplevels, see gdk_window_set_composited().

Support for non-toplevel windows was added in 3.8.

Parameters

window

a top-level or non-native GdkWindow

 

opacity

opacity

 

Since 2.12


gdk_window_set_composited ()

void
gdk_window_set_composited (GdkWindow *window,
                           gboolean composited);

Sets a GdkWindow as composited, or unsets it. Composited windows do not automatically have their contents drawn to the screen. Drawing is redirected to an offscreen buffer and an expose event is emitted on the parent of the composited window. It is the responsibility of the parent’s expose handler to manually merge the off-screen content onto the screen in whatever way it sees fit.

It only makes sense for child windows to be composited; see gdk_window_set_opacity() if you need translucent toplevel windows.

An additional effect of this call is that the area of this window is no longer clipped from regions marked for invalidation on its parent. Draws done on the parent window are also no longer clipped by the child.

This call is only supported on some systems (currently, only X11 with new enough Xcomposite and Xdamage extensions). You must call gdk_display_supports_composite() to check if setting a window as composited is supported before attempting to do so.

Parameters

window

a GdkWindow

 

composited

TRUE to set the window as composited

 

Since 2.12


gdk_window_get_composited ()

gboolean
gdk_window_get_composited (GdkWindow *window);

Determines whether window is composited.

See gdk_window_set_composited().

Parameters

window

a GdkWindow

 

Returns

TRUE if the window is composited.

Since 2.22


gdk_window_move ()

void
gdk_window_move (GdkWindow *window,
                 gint x,
                 gint y);

Repositions a window relative to its parent window. For toplevel windows, window managers may ignore or modify the move; you should probably use gtk_window_move() on a GtkWindow widget anyway, instead of using GDK functions. For child windows, the move will reliably succeed.

If you’re also planning to resize the window, use gdk_window_move_resize() to both move and resize simultaneously, for a nicer visual effect.

Parameters

window

a GdkWindow

 

x

X coordinate relative to window’s parent

 

y

Y coordinate relative to window’s parent

 

gdk_window_resize ()

void
gdk_window_resize (GdkWindow *window,
                   gint width,
                   gint height);

Resizes window ; for toplevel windows, asks the window manager to resize the window. The window manager may not allow the resize. When using GTK+, use gtk_window_resize() instead of this low-level GDK function.

Windows may not be resized below 1x1.

If you’re also planning to move the window, use gdk_window_move_resize() to both move and resize simultaneously, for a nicer visual effect.

Parameters

window

a GdkWindow

 

width

new width of the window

 

height

new height of the window

 

gdk_window_move_resize ()

void
gdk_window_move_resize (GdkWindow *window,
                        gint x,
                        gint y,
                        gint width,
                        gint height);

Equivalent to calling gdk_window_move() and gdk_window_resize(), except that both operations are performed at once, avoiding strange visual effects. (i.e. the user may be able to see the window first move, then resize, if you don’t use gdk_window_move_resize().)

Parameters

window

a GdkWindow

 

x

new X position relative to window’s parent

 

y

new Y position relative to window’s parent

 

width

new width

 

height

new height

 

gdk_window_scroll ()

void
gdk_window_scroll (GdkWindow *window,
                   gint dx,
                   gint dy);

Scroll the contents of window , both pixels and children, by the given amount. window itself does not move. Portions of the window that the scroll operation brings in from offscreen areas are invalidated. The invalidated region may be bigger than what would strictly be necessary.

For X11, a minimum area will be invalidated if the window has no subwindows, or if the edges of the window’s parent do not extend beyond the edges of the window. In other cases, a multi-step process is used to scroll the window which may produce temporary visual artifacts and unnecessary invalidations.

Parameters

window

a GdkWindow

 

dx

Amount to scroll in the X direction

 

dy

Amount to scroll in the Y direction

 

gdk_window_move_region ()

void
gdk_window_move_region (GdkWindow *window,
                        const cairo_region_t *region,
                        gint dx,
                        gint dy);

Move the part of window indicated by region by dy pixels in the Y direction and dx pixels in the X direction. The portions of region that not covered by the new position of region are invalidated.

Child windows are not moved.

Parameters

window

a GdkWindow

 

region

The cairo_region_t to move

 

dx

Amount to move in the X direction

 

dy

Amount to move in the Y direction

 

Since 2.8


gdk_window_flush ()

void
gdk_window_flush (GdkWindow *window);

gdk_window_flush has been deprecated since version 3.14 and should not be used in newly-written code.

This function does nothing.

Parameters

window

a GdkWindow

 

Since 2.18


gdk_window_has_native ()

gboolean
gdk_window_has_native (GdkWindow *window);

Checks whether the window has a native window or not. Note that you can use gdk_window_ensure_native() if a native window is needed.

Parameters

window

a GdkWindow

 

Returns

TRUE if the window has a native window, FALSE otherwise.

Since 2.22


gdk_window_ensure_native ()

gboolean
gdk_window_ensure_native (GdkWindow *window);

Tries to ensure that there is a window-system native window for this GdkWindow. This may fail in some situations, returning FALSE.

Offscreen window and children of them can never have native windows.

Some backends may not support native child windows.

Parameters

window

a GdkWindow

 

Returns

TRUE if the window has a native window, FALSE otherwise

Since 2.18


gdk_window_reparent ()

void
gdk_window_reparent (GdkWindow *window,
                     GdkWindow *new_parent,
                     gint x,
                     gint y);

Reparents window into the given new_parent . The window being reparented will be unmapped as a side effect.

Parameters

window

a GdkWindow

 

new_parent

new parent to move window into

 

x

X location inside the new parent

 

y

Y location inside the new parent

 

gdk_window_raise ()

void
gdk_window_raise (GdkWindow *window);

Raises window to the top of the Z-order (stacking order), so that other windows with the same parent window appear below window . This is true whether or not the windows are visible.

If window is a toplevel, the window manager may choose to deny the request to move the window in the Z-order, gdk_window_raise() only requests the restack, does not guarantee it.

Parameters

window

a GdkWindow

 

gdk_window_lower ()

void
gdk_window_lower (GdkWindow *window);

Lowers window to the bottom of the Z-order (stacking order), so that other windows with the same parent window appear above window . This is true whether or not the other windows are visible.

If window is a toplevel, the window manager may choose to deny the request to move the window in the Z-order, gdk_window_lower() only requests the restack, does not guarantee it.

Note that gdk_window_show() raises the window again, so don’t call this function before gdk_window_show(). (Try gdk_window_show_unraised().)

Parameters

window

a GdkWindow

 

gdk_window_restack ()

void
gdk_window_restack (GdkWindow *window,
                    GdkWindow *sibling,
                    gboolean above);

Changes the position of window in the Z-order (stacking order), so that it is above sibling (if above is TRUE) or below sibling (if above is FALSE).

If sibling is NULL, then this either raises (if above is TRUE) or lowers the window.

If window is a toplevel, the window manager may choose to deny the request to move the window in the Z-order, gdk_window_restack() only requests the restack, does not guarantee it.

Parameters

window

a GdkWindow

 

sibling

a GdkWindow that is a sibling of window , or NULL.

[allow-none]

above

a boolean

 

Since 2.18


gdk_window_focus ()

void
gdk_window_focus (GdkWindow *window,
                  guint32 timestamp);

Sets keyboard focus to window . In most cases, gtk_window_present() should be used on a GtkWindow, rather than calling this function.

Parameters

window

a GdkWindow

 

timestamp

timestamp of the event triggering the window focus

 

gdk_window_register_dnd ()

void
gdk_window_register_dnd (GdkWindow *window);

Registers a window as a potential drop destination.

Parameters

window

a GdkWindow.

 

gdk_window_begin_resize_drag ()

void
gdk_window_begin_resize_drag (GdkWindow *window,
                              GdkWindowEdge edge,
                              gint button,
                              gint root_x,
                              gint root_y,
                              guint32 timestamp);

Begins a window resize operation (for a toplevel window).

This function assumes that the drag is controlled by the client pointer device, use gdk_window_begin_resize_drag_for_device() to begin a drag with a different device.

Parameters

window

a toplevel GdkWindow

 

edge

the edge or corner from which the drag is started

 

button

the button being used to drag, or 0 for a keyboard-initiated drag

 

root_x

root window X coordinate of mouse click that began the drag

 

root_y

root window Y coordinate of mouse click that began the drag

 

timestamp

timestamp of mouse click that began the drag (use gdk_event_get_time())

 

gdk_window_begin_resize_drag_for_device ()

void
gdk_window_begin_resize_drag_for_device
                               (GdkWindow *window,
                                GdkWindowEdge edge,
                                GdkDevice *device,
                                gint button,
                                gint root_x,
                                gint root_y,
                                guint32 timestamp);

Begins a window resize operation (for a toplevel window). You might use this function to implement a “window resize grip,” for example; in fact GtkStatusbar uses it. The function works best with window managers that support the Extended Window Manager Hints but has a fallback implementation for other window managers.

Parameters

window

a toplevel GdkWindow

 

edge

the edge or corner from which the drag is started

 

device

the device used for the operation

 

button

the button being used to drag, or 0 for a keyboard-initiated drag

 

root_x

root window X coordinate of mouse click that began the drag

 

root_y

root window Y coordinate of mouse click that began the drag

 

timestamp

timestamp of mouse click that began the drag (use gdk_event_get_time())

 

Since 3.4


gdk_window_begin_move_drag ()

void
gdk_window_begin_move_drag (GdkWindow *window,
                            gint button,
                            gint root_x,
                            gint root_y,
                            guint32 timestamp);

Begins a window move operation (for a toplevel window).

This function assumes that the drag is controlled by the client pointer device, use gdk_window_begin_move_drag_for_device() to begin a drag with a different device.

Parameters

window

a toplevel GdkWindow

 

button

the button being used to drag, or 0 for a keyboard-initiated drag

 

root_x

root window X coordinate of mouse click that began the drag

 

root_y

root window Y coordinate of mouse click that began the drag

 

timestamp

timestamp of mouse click that began the drag

 

gdk_window_begin_move_drag_for_device ()

void
gdk_window_begin_move_drag_for_device (GdkWindow *window,
                                       GdkDevice *device,
                                       gint button,
                                       gint root_x,
                                       gint root_y,
                                       guint32 timestamp);

Begins a window move operation (for a toplevel window). You might use this function to implement a “window move grip,” for example. The function works best with window managers that support the Extended Window Manager Hints but has a fallback implementation for other window managers.

Parameters

window

a toplevel GdkWindow

 

device

the device used for the operation

 

button

the button being used to drag, or 0 for a keyboard-initiated drag

 

root_x

root window X coordinate of mouse click that began the drag

 

root_y

root window Y coordinate of mouse click that began the drag

 

timestamp

timestamp of mouse click that began the drag

 

Since 3.4


gdk_window_show_window_menu ()

gboolean
gdk_window_show_window_menu (GdkWindow *window,
                             GdkEvent *event);

Asks the windowing system to show the window menu. The window menu is the menu shown when right-clicking the titlebar on traditional windows managed by the window manager. This is useful for windows using client-side decorations, activating it with a right-click on the window decorations.

Parameters

window

a GdkWindow

 

event

a GdkEvent to show the menu for

 

Returns

TRUE if the window menu was shown and FALSE otherwise.

Since 3.14


gdk_window_constrain_size ()

void
gdk_window_constrain_size (GdkGeometry *geometry,
                           GdkWindowHints flags,
                           gint width,
                           gint height,
                           gint *new_width,
                           gint *new_height);

Constrains a desired width and height according to a set of geometry hints (such as minimum and maximum size).

Parameters

geometry

a GdkGeometry structure

 

flags

a mask indicating what portions of geometry are set

 

width

desired width of window

 

height

desired height of the window

 

new_width

location to store resulting width.

[out]

new_height

location to store resulting height.

[out]

gdk_window_beep ()

void
gdk_window_beep (GdkWindow *window);

Emits a short beep associated to window in the appropriate display, if supported. Otherwise, emits a short beep on the display just as gdk_display_beep().

Parameters

window

a toplevel GdkWindow

 

Since 2.12


gdk_window_get_scale_factor ()

gint
gdk_window_get_scale_factor (GdkWindow *window);

Returns the internal scale factor that maps from window coordiantes to the actual device pixels. On traditional systems this is 1, but on very high density outputs this can be a higher value (often 2).

A higher value means that drawing is automatically scaled up to a higher resolution, so any code doing drawing will automatically look nicer. However, if you are supplying pixel-based data the scale value can be used to determine whether to use a pixel resource with higher resolution data.

The scale of a window may change during runtime, if this happens a configure event will be sent to the toplevel window.

Parameters

window

window to get scale factor for

 

Returns

the scale factor

Since 3.10


gdk_window_set_opaque_region ()

void
gdk_window_set_opaque_region (GdkWindow *window,
                              cairo_region_t *region);

For optimizization purposes, compositing window managers may like to not draw obscured regions of windows, or turn off blending during for these regions. With RGB windows with no transparency, this is just the shape of the window, but with ARGB32 windows, the compositor does not know what regions of the window are transparent or not.

This function only works for toplevel windows.

GTK+ will automatically update this property automatically if the window background is opaque, as we know where the opaque regions are. If your window background is not opaque, please update this property in your “style-updated” handler.

Parameters

window

a top-level or non-native GdkWindow

 

region

a region

 

Since 3.10


gdk_window_get_clip_region ()

cairo_region_t *
gdk_window_get_clip_region (GdkWindow *window);

Computes the region of a window that potentially can be written to by drawing primitives. This region may not take into account other factors such as if the window is obscured by other windows, but no area outside of this region will be affected by drawing primitives.

Parameters

window

a GdkWindow

 

Returns

a cairo_region_t. This must be freed with cairo_region_destroy() when you are done.


gdk_window_begin_paint_rect ()

void
gdk_window_begin_paint_rect (GdkWindow *window,
                             const GdkRectangle *rectangle);

A convenience wrapper around gdk_window_begin_paint_region() which creates a rectangular region for you. See gdk_window_begin_paint_region() for details.

Parameters

window

a GdkWindow

 

rectangle

rectangle you intend to draw to

 

gdk_window_begin_paint_region ()

void
gdk_window_begin_paint_region (GdkWindow *window,
                               const cairo_region_t *region);

Indicates that you are beginning the process of redrawing region . A backing store (offscreen buffer) large enough to contain region will be created. The backing store will be initialized with the background color or background surface for window . Then, all drawing operations performed on window will be diverted to the backing store. When you call gdk_window_end_paint(), the backing store will be copied to window , making it visible onscreen. Only the part of window contained in region will be modified; that is, drawing operations are clipped to region .

The net result of all this is to remove flicker, because the user sees the finished product appear all at once when you call gdk_window_end_paint(). If you draw to window directly without calling gdk_window_begin_paint_region(), the user may see flicker as individual drawing operations are performed in sequence. The clipping and background-initializing features of gdk_window_begin_paint_region() are conveniences for the programmer, so you can avoid doing that work yourself.

When using GTK+, the widget system automatically places calls to gdk_window_begin_paint_region() and gdk_window_end_paint() around emissions of the expose_event signal. That is, if you’re writing an expose event handler, you can assume that the exposed area in GdkEventExpose has already been cleared to the window background, is already set as the clip region, and already has a backing store. Therefore in most cases, application code need not call gdk_window_begin_paint_region(). (You can disable the automatic calls around expose events on a widget-by-widget basis by calling gtk_widget_set_double_buffered().)

If you call this function multiple times before calling the matching gdk_window_end_paint(), the backing stores are pushed onto a stack. gdk_window_end_paint() copies the topmost backing store onscreen, subtracts the topmost region from all other regions in the stack, and pops the stack. All drawing operations affect only the topmost backing store in the stack. One matching call to gdk_window_end_paint() is required for each call to gdk_window_begin_paint_region().

Parameters

window

a GdkWindow

 

region

region you intend to draw to

 

gdk_window_end_paint ()

void
gdk_window_end_paint (GdkWindow *window);

Indicates that the backing store created by the most recent call to gdk_window_begin_paint_region() should be copied onscreen and deleted, leaving the next-most-recent backing store or no backing store at all as the active paint region. See gdk_window_begin_paint_region() for full details. It is an error to call this function without a matching gdk_window_begin_paint_region() first.

Parameters

window

a GdkWindow

 

gdk_window_get_visible_region ()

cairo_region_t *
gdk_window_get_visible_region (GdkWindow *window);

Computes the region of the window that is potentially visible. This does not necessarily take into account if the window is obscured by other windows, but no area outside of this region is visible.

Parameters

window

a GdkWindow

 

Returns

a cairo_region_t. This must be freed with cairo_region_destroy() when you are done.


GdkWindowInvalidateHandlerFunc ()

void
(*GdkWindowInvalidateHandlerFunc) (GdkWindow *window,
                                   cairo_region_t *region);

Whenever some area of the window is invalidated (directly in the window or in a child window) this gets called with region in the coordinate space of window . You can use region to just keep track of the dirty region, or you can actually change region in case you are doing display tricks like showing a child in multiple places.

Parameters

window

a GdkWindow

 

region

a cairo_region_t

 

Since 3.10


gdk_window_set_invalidate_handler ()

void
gdk_window_set_invalidate_handler (GdkWindow *window,
                                   GdkWindowInvalidateHandlerFunc handler);

Registers an invalidate handler for a specific window. This will get called whenever a region in the window or its children is invalidated.

This can be used to record the invalidated region, which is useful if you are keeping an offscreen copy of some region and want to keep it up to date. You can also modify the invalidated region in case you’re doing some effect where e.g. a child widget appears in multiple places.

Parameters

window

a GdkWindow

 

handler

a GdkWindowInvalidateHandlerFunc callback function

 

Since 3.10


gdk_window_invalidate_rect ()

void
gdk_window_invalidate_rect (GdkWindow *window,
                            const GdkRectangle *rect,
                            gboolean invalidate_children);

A convenience wrapper around gdk_window_invalidate_region() which invalidates a rectangular region. See gdk_window_invalidate_region() for details.

Parameters

window

a GdkWindow

 

rect

rectangle to invalidate or NULL to invalidate the whole window.

[allow-none]

invalidate_children

whether to also invalidate child windows

 

gdk_window_invalidate_region ()

void
gdk_window_invalidate_region (GdkWindow *window,
                              const cairo_region_t *region,
                              gboolean invalidate_children);

Adds region to the update area for window . The update area is the region that needs to be redrawn, or “dirty region.” The call gdk_window_process_updates() sends one or more expose events to the window, which together cover the entire update area. An application would normally redraw the contents of window in response to those expose events.

GDK will call gdk_window_process_all_updates() on your behalf whenever your program returns to the main loop and becomes idle, so normally there’s no need to do that manually, you just need to invalidate regions that you know should be redrawn.

The invalidate_children parameter controls whether the region of each child window that intersects region will also be invalidated. If FALSE, then the update area for child windows will remain unaffected. See gdk_window_invalidate_maybe_recurse if you need fine grained control over which children are invalidated.

Parameters

window

a GdkWindow

 

region

a cairo_region_t

 

invalidate_children

TRUE to also invalidate child windows

 

GdkWindowChildFunc ()

gboolean
(*GdkWindowChildFunc) (GdkWindow *window,
                       gpointer user_data);

A function of this type is passed to gdk_window_invalidate_maybe_recurse(). It gets called for each child of the window to determine whether to recursively invalidate it or now.

Parameters

window

a GdkWindow

 

user_data

user data

 

Returns

TRUE to invalidate window recursively


gdk_window_invalidate_maybe_recurse ()

void
gdk_window_invalidate_maybe_recurse (GdkWindow *window,
                                     const cairo_region_t *region,
                                     GdkWindowChildFunc child_func,
                                     gpointer user_data);

Adds region to the update area for window . The update area is the region that needs to be redrawn, or “dirty region.” The call gdk_window_process_updates() sends one or more expose events to the window, which together cover the entire update area. An application would normally redraw the contents of window in response to those expose events.

GDK will call gdk_window_process_all_updates() on your behalf whenever your program returns to the main loop and becomes idle, so normally there’s no need to do that manually, you just need to invalidate regions that you know should be redrawn.

The child_func parameter controls whether the region of each child window that intersects region will also be invalidated. Only children for which child_func returns TRUE will have the area invalidated.

Parameters

window

a GdkWindow

 

region

a cairo_region_t

 

child_func

function to use to decide if to recurse to a child, NULL means never recurse.

[scope call][allow-none]

user_data

data passed to child_func

 

gdk_window_get_update_area ()

cairo_region_t *
gdk_window_get_update_area (GdkWindow *window);

Transfers ownership of the update area from window to the caller of the function. That is, after calling this function, window will no longer have an invalid/dirty region; the update area is removed from window and handed to you. If a window has no update area, gdk_window_get_update_area() returns NULL. You are responsible for calling cairo_region_destroy() on the returned region if it’s non-NULL.

Parameters

window

a GdkWindow

 

Returns

the update area for window


gdk_window_freeze_updates ()

void
gdk_window_freeze_updates (GdkWindow *window);

Temporarily freezes a window such that it won’t receive expose events. The window will begin receiving expose events again when gdk_window_thaw_updates() is called. If gdk_window_freeze_updates() has been called more than once, gdk_window_thaw_updates() must be called an equal number of times to begin processing exposes.

Parameters

window

a GdkWindow

 

gdk_window_thaw_updates ()

void
gdk_window_thaw_updates (GdkWindow *window);

Thaws a window frozen with gdk_window_freeze_updates().

Parameters

window

a GdkWindow

 

gdk_window_process_all_updates ()

void
gdk_window_process_all_updates (void);

Calls gdk_window_process_updates() for all windows (see GdkWindow) in the application.


gdk_window_process_updates ()

void
gdk_window_process_updates (GdkWindow *window,
                            gboolean update_children);

Sends one or more expose events to window . The areas in each expose event will cover the entire update area for the window (see gdk_window_invalidate_region() for details). Normally GDK calls gdk_window_process_all_updates() on your behalf, so there’s no need to call this function unless you want to force expose events to be delivered immediately and synchronously (vs. the usual case, where GDK delivers them in an idle handler). Occasionally this is useful to produce nicer scrolling behavior, for example.

Parameters

window

a GdkWindow

 

update_children

whether to also process updates for child windows

 

gdk_window_set_debug_updates ()

void
gdk_window_set_debug_updates (gboolean setting);

With update debugging enabled, calls to gdk_window_invalidate_region() clear the invalidated region of the screen to a noticeable color, and GDK pauses for a short time before sending exposes to windows during gdk_window_process_updates(). The net effect is that you can see the invalid region for each window and watch redraws as they occur. This allows you to diagnose inefficiencies in your application.

In essence, because the GDK rendering model prevents all flicker, if you are redrawing the same region 400 times you may never notice, aside from noticing a speed problem. Enabling update debugging causes GTK to flicker slowly and noticeably, so you can see exactly what’s being redrawn when, in what order.

The --gtk-debug=updates command line option passed to GTK+ programs enables this debug option at application startup time. That's usually more useful than calling gdk_window_set_debug_updates() yourself, though you might want to use this function to enable updates sometime after application startup time.

Parameters

setting

TRUE to turn on update debugging

 

gdk_window_enable_synchronized_configure ()

void
gdk_window_enable_synchronized_configure
                               (GdkWindow *window);

gdk_window_enable_synchronized_configure has been deprecated since version 3.8 and should not be used in newly-written code.

this function is no longer needed

Does nothing, present only for compatiblity.

Parameters

window

a toplevel GdkWindow

 

Since 2.6


gdk_window_configure_finished ()

void
gdk_window_configure_finished (GdkWindow *window);

gdk_window_configure_finished has been deprecated since version 3.8 and should not be used in newly-written code.

this function is no longer needed

Does nothing, present only for compatiblity.

Parameters

window

a toplevel GdkWindow

 

Since 2.6


gdk_window_get_frame_clock ()

GdkFrameClock *
gdk_window_get_frame_clock (GdkWindow *window);

Gets the frame clock for the window. The frame clock for a window never changes unless the window is reparented to a new toplevel window.

Parameters

window

window to get frame clock for

 

Returns

the frame clock.

[transfer none]

Since 3.8


gdk_window_set_user_data ()

void
gdk_window_set_user_data (GdkWindow *window,
                          gpointer user_data);

For most purposes this function is deprecated in favor of g_object_set_data(). However, for historical reasons GTK+ stores the GtkWidget that owns a GdkWindow as user data on the GdkWindow. So, custom widget implementations should use this function for that. If GTK+ receives an event for a GdkWindow, and the user data for the window is non-NULL, GTK+ will assume the user data is a GtkWidget, and forward the event to that widget.

Parameters

window

a GdkWindow

 

user_data

user data.

[allow-none][type GObject.Object]

gdk_window_set_override_redirect ()

void
gdk_window_set_override_redirect (GdkWindow *window,
                                  gboolean override_redirect);

An override redirect window is not under the control of the window manager. This means it won’t have a titlebar, won’t be minimizable, etc. - it will be entirely under the control of the application. The window manager can’t see the override redirect window at all.

Override redirect should only be used for short-lived temporary windows, such as popup menus. GtkMenu uses an override redirect window in its implementation, for example.

Parameters

window

a toplevel GdkWindow

 

override_redirect

TRUE if window should be override redirect

 

gdk_window_set_accept_focus ()

void
gdk_window_set_accept_focus (GdkWindow *window,
                             gboolean accept_focus);

Setting accept_focus to FALSE hints the desktop environment that the window doesn’t want to receive input focus.

On X, it is the responsibility of the window manager to interpret this hint. ICCCM-compliant window manager usually respect it.

Parameters

window

a toplevel GdkWindow

 

accept_focus

TRUE if the window should receive input focus

 

Since 2.4


gdk_window_get_accept_focus ()

gboolean
gdk_window_get_accept_focus (GdkWindow *window);

Determines whether or not the desktop environment shuld be hinted that the window does not want to receive input focus.

Parameters

window

a toplevel GdkWindow.

 

Returns

whether or not the window should receive input focus.

Since 2.22


gdk_window_set_focus_on_map ()

void
gdk_window_set_focus_on_map (GdkWindow *window,
                             gboolean focus_on_map);

Setting focus_on_map to FALSE hints the desktop environment that the window doesn’t want to receive input focus when it is mapped. focus_on_map should be turned off for windows that aren’t triggered interactively (such as popups from network activity).

On X, it is the responsibility of the window manager to interpret this hint. Window managers following the freedesktop.org window manager extension specification should respect it.

Parameters

window

a toplevel GdkWindow

 

focus_on_map

TRUE if the window should receive input focus when mapped

 

Since 2.6


gdk_window_get_focus_on_map ()

gboolean
gdk_window_get_focus_on_map (GdkWindow *window);

Determines whether or not the desktop environment should be hinted that the window does not want to receive input focus when it is mapped.

Parameters

window

a toplevel GdkWindow.

 

Returns

whether or not the window wants to receive input focus when it is mapped.

Since 2.22


gdk_window_add_filter ()

void
gdk_window_add_filter (GdkWindow *window,
                       GdkFilterFunc function,
                       gpointer data);

Adds an event filter to window , allowing you to intercept events before they reach GDK. This is a low-level operation and makes it easy to break GDK and/or GTK+, so you have to know what you're doing. Pass NULL for window to get all events for all windows, instead of events for a specific window.

If you are interested in X GenericEvents, bear in mind that XGetEventData() has been already called on the event, and XFreeEventData() must not be called within function .

Parameters

window

a GdkWindow.

[allow-none]

function

filter callback

 

data

data to pass to filter callback

 

gdk_window_remove_filter ()

void
gdk_window_remove_filter (GdkWindow *window,
                          GdkFilterFunc function,
                          gpointer data);

Remove a filter previously added with gdk_window_add_filter().

Parameters

window

a GdkWindow

 

function

previously-added filter function

 

data

user data for previously-added filter function

 

GdkFilterFunc ()

GdkFilterReturn
(*GdkFilterFunc) (GdkXEvent *xevent,
                  GdkEvent *event,
                  gpointer data);

Specifies the type of function used to filter native events before they are converted to GDK events.

When a filter is called, event is unpopulated, except for event->window. The filter may translate the native event to a GDK event and store the result in event , or handle it without translation. If the filter translates the event and processing should continue, it should return GDK_FILTER_TRANSLATE.

Parameters

xevent

the native event to filter.

 

event

the GDK event to which the X event will be translated.

 

data

user data set when the filter was installed.

[closure]

Returns

a GdkFilterReturn value.


gdk_window_shape_combine_region ()

void
gdk_window_shape_combine_region (GdkWindow *window,
                                 const cairo_region_t *shape_region,
                                 gint offset_x,
                                 gint offset_y);

Makes pixels in window outside shape_region be transparent, so that the window may be nonrectangular.

If shape_region is NULL, the shape will be unset, so the whole window will be opaque again. offset_x and offset_y are ignored if shape_region is NULL.

On the X11 platform, this uses an X server extension which is widely available on most common platforms, but not available on very old X servers, and occasionally the implementation will be buggy. On servers without the shape extension, this function will do nothing.

This function works on both toplevel and child windows.

Parameters

window

a GdkWindow

 

shape_region

region of window to be non-transparent.

[allow-none]

offset_x

X position of shape_region in window coordinates

 

offset_y

Y position of shape_region in window coordinates

 

gdk_window_set_child_shapes ()

void
gdk_window_set_child_shapes (GdkWindow *window);

Sets the shape mask of window to the union of shape masks for all children of window , ignoring the shape mask of window itself. Contrast with gdk_window_merge_child_shapes() which includes the shape mask of window in the masks to be merged.

Parameters

window

a GdkWindow

 

gdk_window_merge_child_shapes ()

void
gdk_window_merge_child_shapes (GdkWindow *window);

Merges the shape masks for any child windows into the shape mask for window . i.e. the union of all masks for window and its children will become the new mask for window . See gdk_window_shape_combine_region().

This function is distinct from gdk_window_set_child_shapes() because it includes window ’s shape mask in the set of shapes to be merged.

Parameters

window

a GdkWindow

 

gdk_window_input_shape_combine_region ()

void
gdk_window_input_shape_combine_region (GdkWindow *window,
                                       const cairo_region_t *shape_region,
                                       gint offset_x,
                                       gint offset_y);

Like gdk_window_shape_combine_region(), but the shape applies only to event handling. Mouse events which happen while the pointer position corresponds to an unset bit in the mask will be passed on the window below window .

An input shape is typically used with RGBA windows. The alpha channel of the window defines which pixels are invisible and allows for nicely antialiased borders, and the input shape controls where the window is “clickable”.

On the X11 platform, this requires version 1.1 of the shape extension.

On the Win32 platform, this functionality is not present and the function does nothing.

Parameters

window

a GdkWindow

 

shape_region

region of window to be non-transparent

 

offset_x

X position of shape_region in window coordinates

 

offset_y

Y position of shape_region in window coordinates

 

Since 2.10


gdk_window_set_child_input_shapes ()

void
gdk_window_set_child_input_shapes (GdkWindow *window);

Sets the input shape mask of window to the union of input shape masks for all children of window , ignoring the input shape mask of window itself. Contrast with gdk_window_merge_child_input_shapes() which includes the input shape mask of window in the masks to be merged.

Parameters

window

a GdkWindow

 

Since 2.10


gdk_window_merge_child_input_shapes ()

void
gdk_window_merge_child_input_shapes (GdkWindow *window);

Merges the input shape masks for any child windows into the input shape mask for window . i.e. the union of all input masks for window and its children will become the new input mask for window . See gdk_window_input_shape_combine_region().

This function is distinct from gdk_window_set_child_input_shapes() because it includes window ’s input shape mask in the set of shapes to be merged.

Parameters

window

a GdkWindow

 

Since 2.10


gdk_window_set_static_gravities ()

gboolean
gdk_window_set_static_gravities (GdkWindow *window,
                                 gboolean use_static);

Set the bit gravity of the given window to static, and flag it so all children get static subwindow gravity. This is used if you are implementing scary features that involve deep knowledge of the windowing system. Don’t worry about it unless you have to.

Parameters

window

a GdkWindow

 

use_static

TRUE to turn on static gravity

 

Returns

TRUE if the server supports static gravity


gdk_window_set_title ()

void
gdk_window_set_title (GdkWindow *window,
                      const gchar *title);

Sets the title of a toplevel window, to be displayed in the titlebar. If you haven’t explicitly set the icon name for the window (using gdk_window_set_icon_name()), the icon name will be set to title as well. title must be in UTF-8 encoding (as with all user-readable strings in GDK/GTK+). title may not be NULL.

Parameters

window

a toplevel GdkWindow

 

title

title of window

 

gdk_window_set_background ()

void
gdk_window_set_background (GdkWindow *window,
                           const GdkColor *color);

gdk_window_set_background has been deprecated since version 3.4 and should not be used in newly-written code.

Use gdk_window_set_background_rgba() instead.

Sets the background color of window . (However, when using GTK+, set the background of a widget with gtk_widget_modify_bg() - if you’re an application - or gtk_style_set_background() - if you're implementing a custom widget.)

See also gdk_window_set_background_pattern().

Parameters

window

a GdkWindow

 

color

a GdkColor

 

gdk_window_set_background_rgba ()

void
gdk_window_set_background_rgba (GdkWindow *window,
                                const GdkRGBA *rgba);

Sets the background color of window .

See also gdk_window_set_background_pattern().

Parameters

window

a GdkWindow

 

rgba

a GdkRGBA color

 

gdk_window_set_background_pattern ()

void
gdk_window_set_background_pattern (GdkWindow *window,
                                   cairo_pattern_t *pattern);

Sets the background of window .

A background of NULL means that the window will inherit its background from its parent window.

The windowing system will normally fill a window with its background when the window is obscured then exposed.

Parameters

window

a GdkWindow

 

pattern

a pattern to use, or NULL.

[allow-none]

gdk_window_get_background_pattern ()

cairo_pattern_t *
gdk_window_get_background_pattern (GdkWindow *window);

Gets the pattern used to clear the background on window . If window does not have its own background and reuses the parent's, NULL is returned and you’ll have to query it yourself.

Parameters

window

a window

 

Returns

The pattern to use for the background or NULL to use the parent’s background.

[nullable][transfer none]

Since 2.22


gdk_window_set_cursor ()

void
gdk_window_set_cursor (GdkWindow *window,
                       GdkCursor *cursor);

Sets the default mouse pointer for a GdkWindow. Use gdk_cursor_new_for_display() or gdk_cursor_new_from_pixbuf() to create the cursor. To make the cursor invisible, use GDK_BLANK_CURSOR. Passing NULL for the cursor argument to gdk_window_set_cursor() means that window will use the cursor of its parent window. Most windows should use this default.

Parameters

window

a GdkWindow

 

cursor

a cursor.

[allow-none]

gdk_window_get_cursor ()

GdkCursor *
gdk_window_get_cursor (GdkWindow *window);

Retrieves a GdkCursor pointer for the cursor currently set on the specified GdkWindow, or NULL. If the return value is NULL then there is no custom cursor set on the specified window, and it is using the cursor for its parent window.

Parameters

window

a GdkWindow

 

Returns

a GdkCursor, or NULL. The returned object is owned by the GdkWindow and should not be unreferenced directly. Use gdk_window_set_cursor() to unset the cursor of the window.

[nullable][transfer none]

Since 2.18


gdk_window_get_user_data ()

void
gdk_window_get_user_data (GdkWindow *window,
                          gpointer *data);

Retrieves the user data for window , which is normally the widget that window belongs to. See gdk_window_set_user_data().

Parameters

window

a GdkWindow

 

data

return location for user data.

[out]

gdk_window_get_geometry ()

void
gdk_window_get_geometry (GdkWindow *window,
                         gint *x,
                         gint *y,
                         gint *width,
                         gint *height);

Any of the return location arguments to this function may be NULL, if you aren’t interested in getting the value of that field.

The X and Y coordinates returned are relative to the parent window of window , which for toplevels usually means relative to the window decorations (titlebar, etc.) rather than relative to the root window (screen-size background window).

On the X11 platform, the geometry is obtained from the X server, so reflects the latest position of window ; this may be out-of-sync with the position of window delivered in the most-recently-processed GdkEventConfigure. gdk_window_get_position() in contrast gets the position from the most recent configure event.

Note: If window is not a toplevel, it is much better to call gdk_window_get_position(), gdk_window_get_width() and gdk_window_get_height() instead, because it avoids the roundtrip to the X server and because these functions support the full 32-bit coordinate space, whereas gdk_window_get_geometry() is restricted to the 16-bit coordinates of X11.

Parameters

window

a GdkWindow

 

x

return location for X coordinate of window (relative to its parent).

[out][allow-none]

y

return location for Y coordinate of window (relative to its parent).

[out][allow-none]

width

return location for width of window.

[out][allow-none]

height

return location for height of window.

[out][allow-none]

gdk_window_set_geometry_hints ()

void
gdk_window_set_geometry_hints (GdkWindow *window,
                               const GdkGeometry *geometry,
                               GdkWindowHints geom_mask);

Sets the geometry hints for window . Hints flagged in geom_mask are set, hints not flagged in geom_mask are unset. To unset all hints, use a geom_mask of 0 and a geometry of NULL.

This function provides hints to the windowing system about acceptable sizes for a toplevel window. The purpose of this is to constrain user resizing, but the windowing system will typically (but is not required to) also constrain the current size of the window to the provided values and constrain programatic resizing via gdk_window_resize() or gdk_window_move_resize().

Note that on X11, this effect has no effect on windows of type GDK_WINDOW_TEMP or windows where override redirect has been turned on via gdk_window_set_override_redirect() since these windows are not resizable by the user.

Since you can’t count on the windowing system doing the constraints for programmatic resizes, you should generally call gdk_window_constrain_size() yourself to determine appropriate sizes.

Parameters

window

a toplevel GdkWindow

 

geometry

geometry hints

 

geom_mask

bitmask indicating fields of geometry to pay attention to

 

gdk_window_get_width ()

int
gdk_window_get_width (GdkWindow *window);

Returns the width of the given window