Windows

Windows — Onscreen display areas in the target window system

Functions

CdkWindow * cdk_window_new ()
void cdk_window_destroy ()
CdkWindowType cdk_window_get_window_type ()
CdkDisplay * cdk_window_get_display ()
CdkScreen * cdk_window_get_screen ()
CdkVisual * cdk_window_get_visual ()
CdkWindow * cdk_window_at_pointer ()
void cdk_window_show ()
void cdk_window_show_unraised ()
void cdk_window_hide ()
gboolean cdk_window_is_destroyed ()
gboolean cdk_window_is_visible ()
gboolean cdk_window_is_viewable ()
gboolean cdk_window_is_input_only ()
gboolean cdk_window_is_shaped ()
CdkWindowState cdk_window_get_state ()
void cdk_window_withdraw ()
void cdk_window_iconify ()
void cdk_window_deiconify ()
void cdk_window_stick ()
void cdk_window_unstick ()
void cdk_window_maximize ()
void cdk_window_unmaximize ()
void cdk_window_fullscreen ()
void cdk_window_fullscreen_on_monitor ()
void cdk_window_unfullscreen ()
CdkFullscreenMode cdk_window_get_fullscreen_mode ()
void cdk_window_set_fullscreen_mode ()
void cdk_window_set_keep_above ()
void cdk_window_set_keep_below ()
void cdk_window_set_opacity ()
void cdk_window_set_composited ()
gboolean cdk_window_get_composited ()
void cdk_window_set_pass_through ()
gboolean cdk_window_get_pass_through ()
void cdk_window_move ()
void cdk_window_resize ()
void cdk_window_move_resize ()
void cdk_window_scroll ()
void cdk_window_move_to_rect ()
void cdk_window_move_region ()
void cdk_window_flush ()
gboolean cdk_window_has_native ()
gboolean cdk_window_ensure_native ()
void cdk_window_reparent ()
void cdk_window_raise ()
void cdk_window_lower ()
void cdk_window_restack ()
void cdk_window_focus ()
void cdk_window_register_dnd ()
void cdk_window_begin_resize_drag ()
void cdk_window_begin_resize_drag_for_device ()
void cdk_window_begin_move_drag ()
void cdk_window_begin_move_drag_for_device ()
gboolean cdk_window_show_window_menu ()
void cdk_window_constrain_size ()
void cdk_window_beep ()
gint cdk_window_get_scale_factor ()
void cdk_window_set_opaque_region ()
CdkGLContext * cdk_window_create_gl_context ()
void cdk_window_mark_paint_from_clip ()
cairo_region_t * cdk_window_get_clip_region ()
void cdk_window_begin_paint_rect ()
void cdk_window_begin_paint_region ()
void cdk_window_end_paint ()
CdkDrawingContext * cdk_window_begin_draw_frame ()
void cdk_window_end_draw_frame ()
cairo_region_t * cdk_window_get_visible_region ()
void (*CdkWindowInvalidateHandlerFunc) ()
void cdk_window_set_invalidate_handler ()
void cdk_window_invalidate_rect ()
void cdk_window_invalidate_region ()
gboolean (*CdkWindowChildFunc) ()
void cdk_window_invalidate_maybe_recurse ()
cairo_region_t * cdk_window_get_update_area ()
void cdk_window_freeze_updates ()
void cdk_window_thaw_updates ()
void cdk_window_process_all_updates ()
void cdk_window_process_updates ()
void cdk_window_set_debug_updates ()
void cdk_window_enable_synchronized_configure ()
void cdk_window_configure_finished ()
CdkFrameClock * cdk_window_get_frame_clock ()
void cdk_window_set_user_data ()
void cdk_window_set_override_redirect ()
void cdk_window_set_accept_focus ()
gboolean cdk_window_get_accept_focus ()
void cdk_window_set_focus_on_map ()
gboolean cdk_window_get_focus_on_map ()
void cdk_window_add_filter ()
void cdk_window_remove_filter ()
CdkFilterReturn (*CdkFilterFunc) ()
void cdk_window_shape_combine_region ()
void cdk_window_set_child_shapes ()
void cdk_window_merge_child_shapes ()
void cdk_window_input_shape_combine_region ()
void cdk_window_set_child_input_shapes ()
void cdk_window_merge_child_input_shapes ()
gboolean cdk_window_set_static_gravities ()
void cdk_window_set_title ()
void cdk_window_set_background ()
void cdk_window_set_background_rgba ()
void cdk_window_set_background_pattern ()
cairo_pattern_t * cdk_window_get_background_pattern ()
void cdk_window_set_cursor ()
CdkCursor * cdk_window_get_cursor ()
void cdk_window_get_user_data ()
void cdk_window_get_geometry ()
void cdk_window_set_geometry_hints ()
int cdk_window_get_width ()
int cdk_window_get_height ()
void cdk_window_set_icon_list ()
void cdk_window_set_modal_hint ()
gboolean cdk_window_get_modal_hint ()
void cdk_window_set_type_hint ()
CdkWindowTypeHint cdk_window_get_type_hint ()
void cdk_window_set_shadow_width ()
void cdk_window_set_skip_taskbar_hint ()
void cdk_window_set_skip_pager_hint ()
void cdk_window_set_urgency_hint ()
void cdk_window_get_position ()
void cdk_window_get_root_origin ()
void cdk_window_get_frame_extents ()
gint cdk_window_get_origin ()
void cdk_window_get_root_coords ()
CdkWindow * cdk_window_get_pointer ()
CdkWindow * cdk_window_get_device_position ()
CdkWindow * cdk_window_get_device_position_double ()
CdkWindow * cdk_window_get_parent ()
CdkWindow * cdk_window_get_toplevel ()
GList * cdk_window_get_children ()
GList * cdk_window_get_children_with_user_data ()
GList * cdk_window_peek_children ()
CdkEventMask cdk_window_get_events ()
void cdk_window_set_events ()
void cdk_window_set_icon_name ()
void cdk_window_set_transient_for ()
void cdk_window_set_role ()
void cdk_window_set_startup_id ()
void cdk_window_set_group ()
CdkWindow * cdk_window_get_group ()
void cdk_window_set_decorations ()
gboolean cdk_window_get_decorations ()
void cdk_window_set_functions ()
CdkWindow * cdk_get_default_root_window ()
gboolean cdk_window_get_support_multidevice ()
void cdk_window_set_support_multidevice ()
CdkCursor * cdk_window_get_device_cursor ()
void cdk_window_set_device_cursor ()
CdkEventMask cdk_window_get_device_events ()
void cdk_window_set_device_events ()
CdkEventMask cdk_window_get_source_events ()
void cdk_window_set_source_events ()
gboolean cdk_window_get_event_compression ()
void cdk_window_set_event_compression ()
cairo_surface_t * cdk_offscreen_window_get_surface ()
void cdk_offscreen_window_set_embedder ()
CdkWindow * cdk_offscreen_window_get_embedder ()
void cdk_window_geometry_changed ()
void cdk_window_coords_from_parent ()
void cdk_window_coords_to_parent ()
CdkWindow * cdk_window_get_effective_parent ()
CdkWindow * cdk_window_get_effective_toplevel ()

Properties

CdkCursor * cursor Read / Write

Signals

CairoSurface* create-surface Run Last
void from-embedder Run Last
void moved-to-rect Run First
CdkWindow* pick-embedded-child Run Last
void to-embedder Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── CdkWindow

Includes

#include <cdk/cdk.h>

Description

A CdkWindow is a (usually) rectangular region on the screen. It’s a low-level object, used to implement high-level objects such as CtkWidget and CtkWindow on the CTK+ level. A CtkWindow is a toplevel window, the thing a user might think of as a “window” with a titlebar and so on; a CtkWindow may contain many CdkWindows. For example, each CtkButton has a CdkWindow 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 cdk_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 cdk_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 cdk_offscreen_window_get_surface().

Functions

cdk_window_new ()

CdkWindow *
cdk_window_new (CdkWindow *parent,
                CdkWindowAttr *attributes,
                gint attributes_mask);

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

[constructor]

Parameters

parent

a CdkWindow, 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 CdkWindowAttributesType]

Returns

the new CdkWindow.

[transfer full]


cdk_window_destroy ()

void
cdk_window_destroy (CdkWindow *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 CdkWindow

 

cdk_window_get_window_type ()

CdkWindowType
cdk_window_get_window_type (CdkWindow *window);

Gets the type of the window. See CdkWindowType.

Parameters

window

a CdkWindow

 

Returns

type of window


cdk_window_get_display ()

CdkDisplay *
cdk_window_get_display (CdkWindow *window);

Gets the CdkDisplay associated with a CdkWindow.

Parameters

window

a CdkWindow

 

Returns

the CdkDisplay associated with window .

[transfer none]

Since: 2.24


cdk_window_get_screen ()

CdkScreen *
cdk_window_get_screen (CdkWindow *window);

Gets the CdkScreen associated with a CdkWindow.

Parameters

window

a CdkWindow

 

Returns

the CdkScreen associated with window .

[transfer none]

Since: 2.24


cdk_window_get_visual ()

CdkVisual *
cdk_window_get_visual (CdkWindow *window);

Gets the CdkVisual describing the pixel format of window .

Parameters

window

a CdkWindow

 

Returns

a CdkVisual.

[transfer none]

Since: 2.24


cdk_window_at_pointer ()

CdkWindow *
cdk_window_at_pointer (gint *win_x,
                       gint *win_y);

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 CDK (if the window belongs to another application and a CdkWindow hasn’t been created for it with cdk_window_foreign_new())

NOTE: For multihead-aware widgets or applications use cdk_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]


cdk_window_show ()

void
cdk_window_show (CdkWindow *window);

Like cdk_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 cdk_window_hide().

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

Parameters

window

a CdkWindow

 

cdk_window_show_unraised ()

void
cdk_window_show_unraised (CdkWindow *window);

Shows a CdkWindow onscreen, but does not modify its stacking order. In contrast, cdk_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 CDK state, which means that you can’t really use XMapWindow() directly on a CDK window).

Parameters

window

a CdkWindow

 

cdk_window_hide ()

void
cdk_window_hide (CdkWindow *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 ctk_widget_hide().

Parameters

window

a CdkWindow

 

cdk_window_is_destroyed ()

gboolean
cdk_window_is_destroyed (CdkWindow *window);

Check to see if a window is destroyed..

Parameters

window

a CdkWindow

 

Returns

TRUE if the window is destroyed

Since: 2.18


cdk_window_is_visible ()

gboolean
cdk_window_is_visible (CdkWindow *window);

Checks whether the window has been mapped (with cdk_window_show() or cdk_window_show_unraised()).

Parameters

window

a CdkWindow

 

Returns

TRUE if the window is mapped


cdk_window_is_viewable ()

gboolean
cdk_window_is_viewable (CdkWindow *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 CDK window parents, not to the root window.)

Parameters

window

a CdkWindow

 

Returns

TRUE if the window is viewable


cdk_window_is_input_only ()

gboolean
cdk_window_is_input_only (CdkWindow *window);

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

Parameters

window

a toplevel CdkWindow

 

Returns

TRUE if window is input only

Since: 2.22


cdk_window_is_shaped ()

gboolean
cdk_window_is_shaped (CdkWindow *window);

Determines whether or not the window is shaped.

Parameters

window

a toplevel CdkWindow

 

Returns

TRUE if window is shaped

Since: 2.22


cdk_window_get_state ()

CdkWindowState
cdk_window_get_state (CdkWindow *window);

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

Parameters

window

a CdkWindow

 

Returns

window state bitfield


cdk_window_withdraw ()

void
cdk_window_withdraw (CdkWindow *window);

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

Parameters

window

a toplevel CdkWindow

 

cdk_window_iconify ()

void
cdk_window_iconify (CdkWindow *window);

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

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

Parameters

window

a toplevel CdkWindow

 

cdk_window_deiconify ()

void
cdk_window_deiconify (CdkWindow *window);

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

Parameters

window

a toplevel CdkWindow

 

cdk_window_stick ()

void
cdk_window_stick (CdkWindow *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 CtkWindow, ctk_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, CDK 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 CdkWindow

 

cdk_window_unstick ()

void
cdk_window_unstick (CdkWindow *window);

Reverse operation for cdk_window_stick(); see cdk_window_stick(), and ctk_window_unstick().

Parameters

window

a toplevel CdkWindow

 

cdk_window_maximize ()

void
cdk_window_maximize (CdkWindow *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 CDK makes a best effort to get it to happen.

On Windows, reliably maximizes the window.

Parameters

window

a toplevel CdkWindow

 

cdk_window_unmaximize ()

void
cdk_window_unmaximize (CdkWindow *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 CDK makes a best effort to get it to happen.

On Windows, reliably unmaximizes the window.

Parameters

window

a toplevel CdkWindow

 

cdk_window_fullscreen ()

void
cdk_window_fullscreen (CdkWindow *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 CDK makes a best effort to get it to happen.

Parameters

window

a toplevel CdkWindow

 

Since: 2.2


cdk_window_fullscreen_on_monitor ()

void
cdk_window_fullscreen_on_monitor (CdkWindow *window,
                                  gint monitor);

Moves the window into fullscreen mode on the given monitor. 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.

Parameters

window

a toplevel CdkWindow

 

monitor

Which monitor to display fullscreen on.

 

Since: UNRELEASED


cdk_window_unfullscreen ()

void
cdk_window_unfullscreen (CdkWindow *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 CDK makes a best effort to get it to happen.

Parameters

window

a toplevel CdkWindow

 

Since: 2.2


cdk_window_get_fullscreen_mode ()

CdkFullscreenMode
cdk_window_get_fullscreen_mode (CdkWindow *window);

Obtains the CdkFullscreenMode of the window .

Parameters

window

a toplevel CdkWindow

 

Returns

The CdkFullscreenMode applied to the window when fullscreen.

Since: 3.8


cdk_window_set_fullscreen_mode ()

void
cdk_window_set_fullscreen_mode (CdkWindow *window,
                                CdkFullscreenMode 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 CdkFullscreenMode enumeration. If CDK_FULLSCREEN_ON_ALL_MONITORS is specified, the fullscreen window will span over all monitors from the CdkScreen.

On X11, searches through the list of monitors from the CdkScreen the ones which delimit the 4 edges of the entire CdkScreen 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 CDK_FULLSCREEN_ON_ALL_MONITORS is specified.

Parameters

window

a toplevel CdkWindow

 

mode

fullscreen mode

 

Since: 3.8


cdk_window_set_keep_above ()

void
cdk_window_set_keep_above (CdkWindow *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 CDK makes a best effort to get it to happen.

Parameters

window

a toplevel CdkWindow

 

setting

whether to keep window above other windows

 

Since: 2.4


cdk_window_set_keep_below ()

void
cdk_window_set_keep_below (CdkWindow *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 CDK makes a best effort to get it to happen.

Parameters

window

a toplevel CdkWindow

 

setting

whether to keep window below other windows

 

Since: 2.4


cdk_window_set_opacity ()

void
cdk_window_set_opacity (CdkWindow *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. On Wayland, there is no per-window opacity value that the compositor would apply. Instead, use cdk_window_set_opaque_region (window, NULL) to tell the compositor that the entire window is (potentially) non-opaque, and draw your content with alpha, or use ctk_widget_set_opacity() to set an overall opacity for your widgets.

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

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

Support for non-toplevel windows was added in 3.8.

Parameters

window

a top-level or non-native CdkWindow

 

opacity

opacity

 

Since: 2.12


cdk_window_set_composited ()

void
cdk_window_set_composited (CdkWindow *window,
                           gboolean composited);

Sets a CdkWindow 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 cdk_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 cdk_display_supports_composite() to check if setting a window as composited is supported before attempting to do so.

Parameters

window

a CdkWindow

 

composited

TRUE to set the window as composited

 

Since: 2.12


cdk_window_get_composited ()

gboolean
cdk_window_get_composited (CdkWindow *window);

Determines whether window is composited.

See cdk_window_set_composited().

Parameters

window

a CdkWindow

 

Returns

TRUE if the window is composited.

Since: 2.22


cdk_window_set_pass_through ()

void
cdk_window_set_pass_through (CdkWindow *window,
                             gboolean pass_through);

Sets whether input to the window is passed through to the window below.

The default value of this is FALSE, which means that pointer events that happen inside the window are send first to the window, but if the event is not selected by the event mask then the event is sent to the parent window, and so on up the hierarchy.

If pass_through is TRUE then such pointer events happen as if the window wasn't there at all, and thus will be sent first to any windows below window . This is useful if the window is used in a transparent fashion. In the terminology of the web this would be called "pointer-events: none".

Note that a window with pass_through TRUE can still have a subwindow without pass through, so you can get events on a subset of a window. And in that cases you would get the in-between related events such as the pointer enter/leave events on its way to the destination window.

Parameters

window

a CdkWindow

 

pass_through

a boolean

 

Since: 3.18


cdk_window_get_pass_through ()

gboolean
cdk_window_get_pass_through (CdkWindow *window);

Returns whether input to the window is passed through to the window below.

See cdk_window_set_pass_through() for details

Parameters

window

a CdkWindow

 

Since: 3.18


cdk_window_move ()

void
cdk_window_move (CdkWindow *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 ctk_window_move() on a CtkWindow widget anyway, instead of using CDK functions. For child windows, the move will reliably succeed.

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

Parameters

window

a CdkWindow

 

x

X coordinate relative to window’s parent

 

y

Y coordinate relative to window’s parent

 

cdk_window_resize ()

void
cdk_window_resize (CdkWindow *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 CTK+, use ctk_window_resize() instead of this low-level CDK function.

Windows may not be resized below 1x1.

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

Parameters

window

a CdkWindow

 

width

new width of the window

 

height

new height of the window

 

cdk_window_move_resize ()

void
cdk_window_move_resize (CdkWindow *window,
                        gint x,
                        gint y,
                        gint width,
                        gint height);

Equivalent to calling cdk_window_move() and cdk_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 cdk_window_move_resize().)

Parameters

window

a CdkWindow

 

x

new X position relative to window’s parent

 

y

new Y position relative to window’s parent

 

width

new width

 

height

new height

 

cdk_window_scroll ()

void
cdk_window_scroll (CdkWindow *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 CdkWindow

 

dx

Amount to scroll in the X direction

 

dy

Amount to scroll in the Y direction

 

cdk_window_move_to_rect ()

void
cdk_window_move_to_rect (CdkWindow *window,
                         const CdkRectangle *rect,
                         CdkGravity rect_anchor,
                         CdkGravity window_anchor,
                         CdkAnchorHints anchor_hints,
                         gint rect_anchor_dx,
                         gint rect_anchor_dy);

Moves window to rect , aligning their anchor points.

rect is relative to the top-left corner of the window that window is transient for. rect_anchor and window_anchor determine anchor points on rect and window to pin together. rect 's anchor point can optionally be offset by rect_anchor_dx and rect_anchor_dy , which is equivalent to offsetting the position of window .

anchor_hints determines how window will be moved if the anchor points cause it to move off-screen. For example, CDK_ANCHOR_FLIP_X will replace CDK_GRAVITY_NORTH_WEST with CDK_GRAVITY_NORTH_EAST and vice versa if window extends beyond the left or right edges of the monitor.

Connect to the “moved-to-rect” signal to find out how it was actually positioned.

Parameters

window

the CdkWindow to move

 

rect

the destination CdkRectangle to align window with.

[not nullable]

rect_anchor

the point on rect to align with window 's anchor point

 

window_anchor

the point on window to align with rect 's anchor point

 

anchor_hints

positioning hints to use when limited on space

 

rect_anchor_dx

horizontal offset to shift window , i.e. rect 's anchor point

 

rect_anchor_dy

vertical offset to shift window , i.e. rect 's anchor point

 

Since: 3.24


cdk_window_move_region ()

void
cdk_window_move_region (CdkWindow *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 CdkWindow

 

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


cdk_window_flush ()

void
cdk_window_flush (CdkWindow *window);

cdk_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 CdkWindow

 

Since: 2.18


cdk_window_has_native ()

gboolean
cdk_window_has_native (CdkWindow *window);

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

Parameters

window

a CdkWindow

 

Returns

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

Since: 2.22


cdk_window_ensure_native ()

gboolean
cdk_window_ensure_native (CdkWindow *window);

Tries to ensure that there is a window-system native window for this CdkWindow. 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 CdkWindow

 

Returns

TRUE if the window has a native window, FALSE otherwise

Since: 2.18


cdk_window_reparent ()

void
cdk_window_reparent (CdkWindow *window,
                     CdkWindow *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 CdkWindow

 

new_parent

new parent to move window into

 

x

X location inside the new parent

 

y

Y location inside the new parent

 

cdk_window_raise ()

void
cdk_window_raise (CdkWindow *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, cdk_window_raise() only requests the restack, does not guarantee it.

Parameters

window

a CdkWindow

 

cdk_window_lower ()

void
cdk_window_lower (CdkWindow *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, cdk_window_lower() only requests the restack, does not guarantee it.

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

Parameters

window

a CdkWindow

 

cdk_window_restack ()

void
cdk_window_restack (CdkWindow *window,
                    CdkWindow *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, cdk_window_restack() only requests the restack, does not guarantee it.

Parameters

window

a CdkWindow

 

sibling

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

[allow-none]

above

a boolean

 

Since: 2.18


cdk_window_focus ()

void
cdk_window_focus (CdkWindow *window,
                  guint32 timestamp);

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

Parameters

window

a CdkWindow

 

timestamp

timestamp of the event triggering the window focus

 

cdk_window_register_dnd ()

void
cdk_window_register_dnd (CdkWindow *window);

Registers a window as a potential drop destination.

Parameters

window

a CdkWindow.

 

cdk_window_begin_resize_drag ()

void
cdk_window_begin_resize_drag (CdkWindow *window,
                              CdkWindowEdge 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 cdk_window_begin_resize_drag_for_device() to begin a drag with a different device.

Parameters

window

a toplevel CdkWindow

 

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 cdk_event_get_time())

 

cdk_window_begin_resize_drag_for_device ()

void
cdk_window_begin_resize_drag_for_device
                               (CdkWindow *window,
                                CdkWindowEdge edge,
                                CdkDevice *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 CtkStatusbar 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 CdkWindow

 

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 cdk_event_get_time())

 

Since: 3.4


cdk_window_begin_move_drag ()

void
cdk_window_begin_move_drag (CdkWindow *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 cdk_window_begin_move_drag_for_device() to begin a drag with a different device.

Parameters

window

a toplevel CdkWindow

 

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

 

cdk_window_begin_move_drag_for_device ()

void
cdk_window_begin_move_drag_for_device (CdkWindow *window,
                                       CdkDevice *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 CdkWindow

 

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


cdk_window_show_window_menu ()

gboolean
cdk_window_show_window_menu (CdkWindow *window,
                             CdkEvent *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 CdkWindow

 

event

a CdkEvent to show the menu for

 

Returns

TRUE if the window menu was shown and FALSE otherwise.

Since: 3.14


cdk_window_constrain_size ()

void
cdk_window_constrain_size (CdkGeometry *geometry,
                           CdkWindowHints 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 CdkGeometry 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]

cdk_window_beep ()

void
cdk_window_beep (CdkWindow *window);

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

Parameters

window

a toplevel CdkWindow

 

Since: 2.12


cdk_window_get_scale_factor ()

gint
cdk_window_get_scale_factor (CdkWindow *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


cdk_window_set_opaque_region ()

void
cdk_window_set_opaque_region (CdkWindow *window,
                              cairo_region_t *region);

For optimisation 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.

CTK+ will 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 CdkWindow

 

region

a region, or NULL.

[allow-none]

Since: 3.10


cdk_window_create_gl_context ()

CdkGLContext *
cdk_window_create_gl_context (CdkWindow *window,
                              GError **error);

Creates a new CdkGLContext matching the framebuffer format to the visual of the CdkWindow. The context is disconnected from any particular window or surface.

If the creation of the CdkGLContext failed, error will be set.

Before using the returned CdkGLContext, you will need to call cdk_gl_context_make_current() or cdk_gl_context_realize().

Parameters

window

a CdkWindow

 

error

return location for an error

 

Returns

the newly created CdkGLContext, or NULL on error.

[transfer full]

Since: 3.16


cdk_window_mark_paint_from_clip ()

void
cdk_window_mark_paint_from_clip (CdkWindow *window,
                                 cairo_t *cr);

If you call this during a paint (e.g. between cdk_window_begin_paint_region() and cdk_window_end_paint() then CDK will mark the current clip region of the window as being drawn. This is required when mixing GL rendering via cdk_cairo_draw_from_gl() and cairo rendering, as otherwise CDK has no way of knowing when something paints over the GL-drawn regions.

This is typically called automatically by CTK+ and you don't need to care about this.

Parameters

window

a CdkWindow

 

cr

a cairo_t

 

Since: 3.16


cdk_window_get_clip_region ()

cairo_region_t *
cdk_window_get_clip_region (CdkWindow *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 CdkWindow

 

Returns

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


cdk_window_begin_paint_rect ()

void
cdk_window_begin_paint_rect (CdkWindow *window,
                             const CdkRectangle *rectangle);

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

Use cdk_window_begin_draw_frame() instead

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

Parameters

window

a CdkWindow

 

rectangle

rectangle you intend to draw to

 

cdk_window_begin_paint_region ()

void
cdk_window_begin_paint_region (CdkWindow *window,
                               const cairo_region_t *region);

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

Use cdk_window_begin_draw_frame() instead

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 cdk_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 cdk_window_end_paint(). If you draw to window directly without calling cdk_window_begin_paint_region(), the user may see flicker as individual drawing operations are performed in sequence. The clipping and background-initializing features of cdk_window_begin_paint_region() are conveniences for the programmer, so you can avoid doing that work yourself.

When using CTK+, the widget system automatically places calls to cdk_window_begin_paint_region() and cdk_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 CdkEventExpose 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 cdk_window_begin_paint_region(). (You can disable the automatic calls around expose events on a widget-by-widget basis by calling ctk_widget_set_double_buffered().)

If you call this function multiple times before calling the matching cdk_window_end_paint(), the backing stores are pushed onto a stack. cdk_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 cdk_window_end_paint() is required for each call to cdk_window_begin_paint_region().

Parameters

window

a CdkWindow

 

region

region you intend to draw to

 

cdk_window_end_paint ()

void
cdk_window_end_paint (CdkWindow *window);

cdk_window_end_paint is deprecated and should not be used in newly-written code.

Indicates that the backing store created by the most recent call to cdk_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 cdk_window_begin_paint_region() for full details.

It is an error to call this function without a matching cdk_window_begin_paint_region() first.

Parameters

window

a CdkWindow

 

cdk_window_begin_draw_frame ()

CdkDrawingContext *
cdk_window_begin_draw_frame (CdkWindow *window,
                             const cairo_region_t *region);

Indicates that you are beginning the process of redrawing region on window , and provides you with a CdkDrawingContext.

If window is a top level CdkWindow, backed by a native window implementation, 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 cdk_window_end_frame(), the contents of the backing store will be copied to window , making it visible on screen. 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 cdk_window_end_draw_frame(). If you draw to window directly without calling cdk_window_begin_draw_frame(), the user may see flicker as individual drawing operations are performed in sequence.

When using CTK+, the widget system automatically places calls to cdk_window_begin_draw_frame() and cdk_window_end_draw_frame() around emissions of the CtkWidget::draw signal. That is, if you’re drawing the contents of the widget yourself, you can assume that the widget has a cleared background, is already set as the clip region, and already has a backing store. Therefore in most cases, application code in CTK does not need to call cdk_window_begin_draw_frame() explicitly.

Parameters

window

a CdkWindow

 

region

a Cairo region

 

Returns

a CdkDrawingContext context that should be used to draw the contents of the window; the returned context is owned by CDK.

[transfer none]

Since: 3.22


cdk_window_end_draw_frame ()

void
cdk_window_end_draw_frame (CdkWindow *window,
                           CdkDrawingContext *context);

Indicates that the drawing of the contents of window started with cdk_window_begin_frame() has been completed.

This function will take care of destroying the CdkDrawingContext.

It is an error to call this function without a matching cdk_window_begin_frame() first.

Parameters

window

a CdkWindow

 

context

the CdkDrawingContext created by cdk_window_begin_draw_frame()

 

Since: 3.22


cdk_window_get_visible_region ()

cairo_region_t *
cdk_window_get_visible_region (CdkWindow *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 CdkWindow

 

Returns

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


CdkWindowInvalidateHandlerFunc ()

void
(*CdkWindowInvalidateHandlerFunc) (CdkWindow *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 CdkWindow

 

region

a cairo_region_t

 

Since: 3.10


cdk_window_set_invalidate_handler ()

void
cdk_window_set_invalidate_handler (CdkWindow *window,
                                   CdkWindowInvalidateHandlerFunc 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.

[skip]

Parameters

window

a CdkWindow

 

handler

a CdkWindowInvalidateHandlerFunc callback function

 

Since: 3.10


cdk_window_invalidate_rect ()

void
cdk_window_invalidate_rect (CdkWindow *window,
                            const CdkRectangle *rect,
                            gboolean invalidate_children);

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

Parameters

window

a CdkWindow

 

rect

rectangle to invalidate or NULL to invalidate the whole window.

[allow-none]

invalidate_children

whether to also invalidate child windows

 

cdk_window_invalidate_region ()

void
cdk_window_invalidate_region (CdkWindow *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 cdk_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.

CDK will call cdk_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 cdk_window_invalidate_maybe_recurse if you need fine grained control over which children are invalidated.

Parameters

window

a CdkWindow

 

region

a cairo_region_t

 

invalidate_children

TRUE to also invalidate child windows

 

CdkWindowChildFunc ()

gboolean
(*CdkWindowChildFunc) (CdkWindow *window,
                       gpointer user_data);

A function of this type is passed to cdk_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 CdkWindow

 

user_data

user data

 

Returns

TRUE to invalidate window recursively


cdk_window_invalidate_maybe_recurse ()

void
cdk_window_invalidate_maybe_recurse (CdkWindow *window,
                                     const cairo_region_t *region,
                                     CdkWindowChildFunc 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 cdk_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.

CDK will call cdk_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 CdkWindow

 

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

 

cdk_window_get_update_area ()

cairo_region_t *
cdk_window_get_update_area (CdkWindow *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, cdk_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 CdkWindow

 

Returns

the update area for window


cdk_window_freeze_updates ()

void
cdk_window_freeze_updates (CdkWindow *window);

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

Parameters

window

a CdkWindow

 

cdk_window_thaw_updates ()

void
cdk_window_thaw_updates (CdkWindow *window);

Thaws a window frozen with cdk_window_freeze_updates().

Parameters

window

a CdkWindow

 

cdk_window_process_all_updates ()

void
cdk_window_process_all_updates (void);

Calls cdk_window_process_updates() for all windows (see CdkWindow) in the application.


cdk_window_process_updates ()

void
cdk_window_process_updates (CdkWindow *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 cdk_window_invalidate_region() for details). Normally CDK calls cdk_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 CDK delivers them in an idle handler). Occasionally this is useful to produce nicer scrolling behavior, for example.

Parameters

window

a CdkWindow

 

update_children

whether to also process updates for child windows

 

cdk_window_set_debug_updates ()

void
cdk_window_set_debug_updates (gboolean setting);

With update debugging enabled, calls to cdk_window_invalidate_region() clear the invalidated region of the screen to a noticeable color, and CDK pauses for a short time before sending exposes to windows during cdk_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 CDK 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 CTK to flicker slowly and noticeably, so you can see exactly what’s being redrawn when, in what order.

The --ctk-debug=updates command line option passed to CTK+ programs enables this debug option at application startup time. That's usually more useful than calling cdk_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

 

cdk_window_enable_synchronized_configure ()

void
cdk_window_enable_synchronized_configure
                               (CdkWindow *window);

cdk_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 CdkWindow

 

Since: 2.6


cdk_window_configure_finished ()

void
cdk_window_configure_finished (CdkWindow *window);

cdk_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 CdkWindow

 

Since: 2.6


cdk_window_get_frame_clock ()

CdkFrameClock *
cdk_window_get_frame_clock (CdkWindow *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


cdk_window_set_user_data ()

void
cdk_window_set_user_data (CdkWindow *window,
                          gpointer user_data);

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

Parameters

window

a CdkWindow

 

user_data

user data.

[allow-none][type GObject.Object]

cdk_window_set_override_redirect ()

void
cdk_window_set_override_redirect (CdkWindow *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. CtkMenu uses an override redirect window in its implementation, for example.

Parameters

window

a toplevel CdkWindow

 

override_redirect

TRUE if window should be override redirect

 

cdk_window_set_accept_focus ()

void
cdk_window_set_accept_focus (CdkWindow *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 CdkWindow

 

accept_focus

TRUE if the window should receive input focus

 

Since: 2.4


cdk_window_get_accept_focus ()

gboolean
cdk_window_get_accept_focus (CdkWindow *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 CdkWindow.

 

Returns

whether or not the window should receive input focus.

Since: 2.22


cdk_window_set_focus_on_map ()

void
cdk_window_set_focus_on_map (CdkWindow *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 CdkWindow

 

focus_on_map

TRUE if the window should receive input focus when mapped

 

Since: 2.6


cdk_window_get_focus_on_map ()

gboolean
cdk_window_get_focus_on_map (CdkWindow *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 CdkWindow.

 

Returns

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

Since: 2.22


cdk_window_add_filter ()

void
cdk_window_add_filter (CdkWindow *window,
                       CdkFilterFunc function,
                       gpointer data);

Adds an event filter to window , allowing you to intercept events before they reach CDK. This is a low-level operation and makes it easy to break CDK and/or CTK+, 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 .

[skip]

Parameters

window

a CdkWindow.

[allow-none]

function

filter callback

 

data

data to pass to filter callback

 

cdk_window_remove_filter ()

void
cdk_window_remove_filter (CdkWindow *window,
                          CdkFilterFunc function,
                          gpointer data);

Remove a filter previously added with cdk_window_add_filter().

[skip]

Parameters

window

a CdkWindow

 

function

previously-added filter function

 

data

user data for previously-added filter function

 

CdkFilterFunc ()

CdkFilterReturn
(*CdkFilterFunc) (CdkXEvent *xevent,
                  CdkEvent *event,
                  gpointer data);

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

When a filter is called, event is unpopulated, except for event->window. The filter may translate the native event to a CDK 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 CDK_FILTER_TRANSLATE.

Parameters

xevent

the native event to filter.

 

event

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

 

data

user data set when the filter was installed.

[closure]

Returns

a CdkFilterReturn value.


cdk_window_shape_combine_region ()

void
cdk_window_shape_combine_region (CdkWindow *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 CdkWindow

 

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

 

cdk_window_set_child_shapes ()

void
cdk_window_set_child_shapes (CdkWindow *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 cdk_window_merge_child_shapes() which includes the shape mask of window in the masks to be merged.

Parameters

window

a CdkWindow

 

cdk_window_merge_child_shapes ()

void
cdk_window_merge_child_shapes (CdkWindow *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 cdk_window_shape_combine_region().

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

Parameters

window

a CdkWindow

 

cdk_window_input_shape_combine_region ()

void
cdk_window_input_shape_combine_region (CdkWindow *window,
                                       const cairo_region_t *shape_region,
                                       gint offset_x,
                                       gint offset_y);

Like cdk_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 CdkWindow

 

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


cdk_window_set_child_input_shapes ()

void
cdk_window_set_child_input_shapes (CdkWindow *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 cdk_window_merge_child_input_shapes() which includes the input shape mask of window in the masks to be merged.

Parameters

window

a CdkWindow

 

Since: 2.10


cdk_window_merge_child_input_shapes ()

void
cdk_window_merge_child_input_shapes (CdkWindow *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 cdk_window_input_shape_combine_region().

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

Parameters

window

a CdkWindow

 

Since: 2.10


cdk_window_set_static_gravities ()

gboolean
cdk_window_set_static_gravities (CdkWindow *window,
                                 gboolean use_static);

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

static gravities haven't worked on anything but X11 for a long time.

Used to 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.

Parameters

window

a CdkWindow

 

use_static

TRUE to turn on static gravity

 

Returns

FALSE


cdk_window_set_title ()

void
cdk_window_set_title (CdkWindow *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 cdk_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 CDK/CTK+). title may not be NULL.

Parameters

window

a toplevel CdkWindow

 

title

title of window

 

cdk_window_set_background ()

void
cdk_window_set_background (CdkWindow *window,
                           const CdkColor *color);

Sets the background color of window .

However, when using CTK+, influence the background of a widget using a style class or CSS — if you’re an application — or with ctk_style_context_set_background() — if you're implementing a custom widget.

Parameters

window

a CdkWindow

 

color

a CdkColor

 

cdk_window_set_background_rgba ()

void
cdk_window_set_background_rgba (CdkWindow *window,
                                const CdkRGBA *rgba);

Sets the background color of window .

See also cdk_window_set_background_pattern().

Parameters

window

a CdkWindow

 

rgba

a CdkRGBA color

 

cdk_window_set_background_pattern ()

void
cdk_window_set_background_pattern (CdkWindow *window,
                                   cairo_pattern_t *pattern);

Sets the background of window .

A background of NULL means that the window won't have any background. On the X11 backend it's also possible to inherit the background from the parent window using cdk_x11_get_parent_relative_pattern().

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

Parameters

window

a CdkWindow

 

pattern

a pattern to use, or NULL.

[allow-none]

cdk_window_get_background_pattern ()

cairo_pattern_t *
cdk_window_get_background_pattern (CdkWindow *window);

Gets the pattern used to clear the background on window .

Parameters

window

a window

 

Returns

The pattern to use for the background or NULL if there is no background.

[nullable][transfer none]

Since: 2.22


cdk_window_set_cursor ()

void
cdk_window_set_cursor (CdkWindow *window,
                       CdkCursor *cursor);

Sets the default mouse pointer for a CdkWindow.

Note that cursor must be for the same display as window .

Use cdk_cursor_new_for_display() or cdk_cursor_new_from_pixbuf() to create the cursor. To make the cursor invisible, use CDK_BLANK_CURSOR. Passing NULL for the cursor argument to cdk_window_set_cursor() means that window will use the cursor of its parent window. Most windows should use this default.

Parameters

window

a CdkWindow

 

cursor

a cursor.

[allow-none]

cdk_window_get_cursor ()

CdkCursor *
cdk_window_get_cursor (CdkWindow *window);

Retrieves a CdkCursor pointer for the cursor currently set on the specified CdkWindow, 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 CdkWindow

 

Returns

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

[nullable][transfer none]

Since: 2.18


cdk_window_get_user_data ()

void
cdk_window_get_user_data (CdkWindow *window,
                          gpointer *data);

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

Parameters

window

a CdkWindow

 

data

return location for user data.

[out]

cdk_window_get_geometry ()

void
cdk_window_get_geometry (CdkWindow *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 CdkEventConfigure. cdk_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 cdk_window_get_position(), cdk_window_get_width() and cdk_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 cdk_window_get_geometry() is restricted to the 16-bit coordinates of X11.

Parameters

window

a CdkWindow

 

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]

cdk_window_set_geometry_hints ()

void
cdk_window_set_geometry_hints (CdkWindow *window,
                               const CdkGeometry *geometry,
                               CdkWindowHints 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 cdk_window_resize() or cdk_window_move_resize().

Note that on X11, this effect has no effect on windows of type CDK_WINDOW_TEMP or windows where override redirect has been turned on via cdk_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 cdk_window_constrain_size() yourself to determine appropriate sizes.

Parameters

window

a toplevel CdkWindow

 

geometry

geometry hints

 

geom_mask

bitmask indicating fields of geometry to pay attention to

 

cdk_window_get_width ()

int
cdk_window_get_width (CdkWindow *window);

Returns the width of the given window .

On the X11 platform the returned size is the size reported in the most-recently-processed configure event, rather than the current size on the X server.

Parameters

window

a CdkWindow

 

Returns

The width of window

Since: 2.24


cdk_window_get_height ()

int
cdk_window_get_height (CdkWindow *window);

Returns the height of the given window .

On the X11 platform the returned size is the size reported in the most-recently-processed configure event, rather than the current size on the X server.

Parameters

window

a CdkWindow

 

Returns

The height of window

Since: 2.24


cdk_window_set_icon_list ()

void
cdk_window_set_icon_list (CdkWindow *window,
                          GList *pixbufs);

Sets a list of icons for the window. One of these will be used to represent the window when it has been iconified. The icon is usually shown in an icon box or some sort of task bar. Which icon size is shown depends on the window manager. The window manager can scale the icon but setting several size icons can give better image quality since the window manager may only need to scale the icon by a small amount or not at all.

Note that some platforms don't support window icons.

Parameters

window

The CdkWindow toplevel window to set the icon of.

 

pixbufs

A list of pixbufs, of different sizes.

[transfer none][element-type GdkPixbuf]

cdk_window_set_modal_hint ()

void
cdk_window_set_modal_hint (CdkWindow *window,
                           gboolean modal);

The application can use this hint to tell the window manager that a certain window has modal behaviour. The window manager can use this information to handle modal windows in a special way.

You should only use this on windows for which you have previously called cdk_window_set_transient_for()

Parameters

window

A toplevel CdkWindow

 

modal

TRUE if the window is modal, FALSE otherwise.

 

cdk_window_get_modal_hint ()

gboolean
cdk_window_get_modal_hint (CdkWindow *window);

Determines whether or not the window manager is hinted that window has modal behaviour.

Parameters

window

A toplevel CdkWindow.

 

Returns

whether or not the window has the modal hint set.

Since: 2.22


cdk_window_set_type_hint ()

void
cdk_window_set_type_hint (CdkWindow *window,
                          CdkWindowTypeHint hint);

The application can use this call to provide a hint to the window manager about the functionality of a window. The window manager can use this information when determining the decoration and behaviour of the window.

The hint must be set before the window is mapped.

Parameters

window

A toplevel CdkWindow

 

hint

A hint of the function this window will have

 

cdk_window_get_type_hint ()

CdkWindowTypeHint
cdk_window_get_type_hint (CdkWindow *window);

This function returns the type hint set for a window.

Parameters

window

A toplevel CdkWindow

 

Returns

The type hint set for window

Since: 2.10


cdk_window_set_shadow_width ()

void
cdk_window_set_shadow_width (CdkWindow *window,
                             gint left,
                             gint right,
                             gint top,
                             gint bottom);

Newer CTK+ windows using client-side decorations use extra geometry around their frames for effects like shadows and invisible borders. Window managers that want to maximize windows or snap to edges need to know where the extents of the actual frame lie, so that users don’t feel like windows are snapping against random invisible edges.

Note that this property is automatically updated by CTK+, so this function should only be used by applications which do not use CTK+ to create toplevel windows.

Parameters

window

a CdkWindow

 

left

The left extent

 

right

The right extent

 

top

The top extent

 

bottom

The bottom extent

 

Since: 3.12


cdk_window_set_skip_taskbar_hint ()

void
cdk_window_set_skip_taskbar_hint (CdkWindow *window,
                                  gboolean skips_taskbar);

Toggles whether a window should appear in a task list or window list. If a window’s semantic type as specified with cdk_window_set_type_hint() already fully describes the window, this function should not be called in addition, instead you should allow the window to be treated according to standard policy for its semantic type.

Parameters

window

a toplevel CdkWindow

 

skips_taskbar

TRUE to skip the taskbar

 

Since: 2.2


cdk_window_set_skip_pager_hint ()

void
cdk_window_set_skip_pager_hint (CdkWindow *window,
                                gboolean skips_pager);

Toggles whether a window should appear in a pager (workspace switcher, or other desktop utility program that displays a small thumbnail representation of the windows on the desktop). If a window’s semantic type as specified with cdk_window_set_type_hint() already fully describes the window, this function should not be called in addition, instead you should allow the window to be treated according to standard policy for its semantic type.

Parameters

window

a toplevel CdkWindow

 

skips_pager

TRUE to skip the pager

 

Since: 2.2


cdk_window_set_urgency_hint ()

void
cdk_window_set_urgency_hint (CdkWindow *window,
                             gboolean urgent);

Toggles whether a window needs the user's urgent attention.

Parameters

window

a toplevel CdkWindow

 

urgent

TRUE if the window is urgent

 

Since: 2.8


cdk_window_get_position ()

void
cdk_window_get_position (CdkWindow *window,
                         gint *x,
                         gint *y);

Obtains the position of the window as reported in the most-recently-processed CdkEventConfigure. Contrast with cdk_window_get_geometry() which queries the X server for the current window position, regardless of which events have been received or processed.

The position coordinates are relative to the window’s parent window.

Parameters

window

a CdkWindow

 

x

X coordinate of window.

[out][allow-none]

y

Y coordinate of window.

[out][allow-none]

cdk_window_get_root_origin ()

void
cdk_window_get_root_origin (CdkWindow *window,
                            gint *x,
                            gint *y);

Obtains the top-left corner of the window manager frame in root window coordinates.

Parameters

window

a toplevel CdkWindow

 

x

return location for X position of window frame.

[out]

y

return location for Y position of window frame.

[out]

cdk_window_get_frame_extents ()

void
cdk_window_get_frame_extents (CdkWindow *window,
                              CdkRectangle *rect);

Obtains the bounding box of the window, including window manager titlebar/borders if any. The frame position is given in root window coordinates. To get the position of the window itself (rather than the frame) in root window coordinates, use cdk_window_get_origin().

Parameters

window

a toplevel CdkWindow

 

rect

rectangle to fill with bounding box of the window frame.

[out]

cdk_window_get_origin ()

gint
cdk_window_get_origin (CdkWindow *window,
                       gint *x,
                       gint *y);

Obtains the position of a window in root window coordinates. (Compare with cdk_window_get_position() and cdk_window_get_geometry() which return the position of a window relative to its parent window.)

Parameters

window

a CdkWindow

 

x

return location for X coordinate.

[out][allow-none]

y

return location for Y coordinate.

[out][allow-none]

Returns

not meaningful, ignore


cdk_window_get_root_coords ()

void
cdk_window_get_root_coords (CdkWindow *window,
                            gint x,
                            gint y,
                            gint *root_x,
                            gint *root_y);

Obtains the position of a window position in root window coordinates. This is similar to cdk_window_get_origin() but allows you to pass in any position in the window, not just the origin.

Parameters

window

a CdkWindow

 

x

X coordinate in window

 

y

Y coordinate in window

 

root_x

return location for X coordinate.

[out]

root_y

return location for Y coordinate.

[out]

Since: 2.18


cdk_window_get_pointer ()

CdkWindow *
cdk_window_get_pointer (CdkWindow *window,
                        gint *x,
                        gint *y,
                        CdkModifierType *mask);

Obtains the current pointer position and modifier state. The position is given in coordinates relative to the upper left corner of window .

Parameters

window

a CdkWindow

 

x

return location for X coordinate of pointer or NULL to not return the X coordinate.

[out][allow-none]

y

return location for Y coordinate of pointer or NULL to not return the Y coordinate.

[out][allow-none]

mask

return location for modifier mask or NULL to not return the modifier mask.

[out][allow-none]

Returns

the window containing the pointer (as with cdk_window_at_pointer()), or NULL if the window containing the pointer isn’t known to CDK.

[nullable][transfer none]


cdk_window_get_device_position ()

CdkWindow *
cdk_window_get_device_position (CdkWindow *window,
                                CdkDevice *device,
                                gint *x,
                                gint *y,
                                CdkModifierType *mask);

Obtains the current device position and modifier state. The position is given in coordinates relative to the upper left corner of window .

Use cdk_window_get_device_position_double() if you need subpixel precision.

Parameters

window

a CdkWindow.

 

device

pointer CdkDevice to query to.

 

x

return location for the X coordinate of device , or NULL.

[out][allow-none]

y

return location for the Y coordinate of device , or NULL.

[out][allow-none]

mask

return location for the modifier mask, or NULL.

[out][allow-none]

Returns

The window underneath device (as with cdk_device_get_window_at_position()), or NULL if the window is not known to CDK.

[nullable][transfer none]

Since: 3.0


cdk_window_get_device_position_double ()

CdkWindow *
cdk_window_get_device_position_double (CdkWindow *window,
                                       CdkDevice *device,
                                       gdouble *x,
                                       gdouble *y,
                                       CdkModifierType *mask);

Obtains the current device position in doubles and modifier state. The position is given in coordinates relative to the upper left corner of window .

Parameters

window

a CdkWindow.

 

device

pointer CdkDevice to query to.

 

x

return location for the X coordinate of device , or NULL.

[out][allow-none]

y

return location for the Y coordinate of device , or NULL.

[out][allow-none]

mask

return location for the modifier mask, or NULL.

[out][allow-none]

Returns

The window underneath device (as with cdk_device_get_window_at_position()), or NULL if the window is not known to CDK.

[nullable][transfer none]

Since: 3.10


cdk_window_get_parent ()

CdkWindow *
cdk_window_get_parent (CdkWindow *window);

Obtains the parent of window , as known to CDK. Does not query the X server; thus this returns the parent as passed to cdk_window_new(), not the actual parent. This should never matter unless you’re using Xlib calls mixed with CDK calls on the X11 platform. It may also matter for toplevel windows, because the window manager may choose to reparent them.

Note that you should use cdk_window_get_effective_parent() when writing generic code that walks up a window hierarchy, because cdk_window_get_parent() will most likely not do what you expect if there are offscreen windows in the hierarchy.

Parameters

window

a CdkWindow

 

Returns

parent of window .

[transfer none]


cdk_window_get_toplevel ()

CdkWindow *
cdk_window_get_toplevel (CdkWindow *window);

Gets the toplevel window that’s an ancestor of window .

Any window type but CDK_WINDOW_CHILD is considered a toplevel window, as is a CDK_WINDOW_CHILD window that has a root window as parent.

Note that you should use cdk_window_get_effective_toplevel() when you want to get to a window’s toplevel as seen on screen, because cdk_window_get_toplevel() will most likely not do what you expect if there are offscreen windows in the hierarchy.

Parameters

window

a CdkWindow

 

Returns

the toplevel window containing window .

[transfer none]


cdk_window_get_children ()

GList *
cdk_window_get_children (CdkWindow *window);

Gets the list of children of window known to CDK. This function only returns children created via CDK, so for example it’s useless when used with the root window; it only returns windows an application created itself.

The returned list must be freed, but the elements in the list need not be.

Parameters

window

a CdkWindow

 

Returns

list of child windows inside window .

[transfer container][element-type CdkWindow]


cdk_window_get_children_with_user_data ()

GList *
cdk_window_get_children_with_user_data
                               (CdkWindow *window,
                                gpointer user_data);

Gets the list of children of window known to CDK with a particular user_data set on it.

The returned list must be freed, but the elements in the list need not be.

The list is returned in (relative) stacking order, i.e. the lowest window is first.

Parameters

window

a CdkWindow

 

user_data

user data to look for

 

Returns

list of child windows inside window .

[transfer container][element-type CdkWindow]

Since: 3.10


cdk_window_peek_children ()

GList *
cdk_window_peek_children (CdkWindow *window);

Like cdk_window_get_children(), but does not copy the list of children, so the list does not need to be freed.

Parameters

window

a CdkWindow

 

Returns

a reference to the list of child windows in window .

[transfer none][element-type CdkWindow]


cdk_window_get_events ()

CdkEventMask
cdk_window_get_events (CdkWindow *window);

Gets the event mask for window for all master input devices. See cdk_window_set_events().

Parameters

window

a CdkWindow

 

Returns

event mask for window


cdk_window_set_events ()

void
cdk_window_set_events (CdkWindow *window,
                       CdkEventMask event_mask);

The event mask for a window determines which events will be reported for that window from all master input devices. For example, an event mask including CDK_BUTTON_PRESS_MASK means the window should report button press events. The event mask is the bitwise OR of values from the CdkEventMask enumeration.

See the input handling overview for details.

Parameters

window

a CdkWindow

 

event_mask

event mask for window

 

cdk_window_set_icon_name ()

void
cdk_window_set_icon_name (CdkWindow *window,
                          const gchar *name);

Windows may have a name used while minimized, distinct from the name they display in their titlebar. Most of the time this is a bad idea from a user interface standpoint. But you can set such a name with this function, if you like.

After calling this with a non-NULL name , calls to cdk_window_set_title() will not update the icon title.

Using NULL for name unsets the icon title; further calls to cdk_window_set_title() will again update the icon title as well.

Note that some platforms don't support window icons.

Parameters

window

a toplevel CdkWindow

 

name

name of window while iconified (minimized).

[allow-none]

cdk_window_set_transient_for ()

void
cdk_window_set_transient_for (CdkWindow *window,
                              CdkWindow *parent);

Indicates to the window manager that window is a transient dialog associated with the application window parent . This allows the window manager to do things like center window on parent and keep window above parent .

See ctk_window_set_transient_for() if you’re using CtkWindow or CtkDialog.

Parameters

window

a toplevel CdkWindow

 

parent

another toplevel CdkWindow

 

cdk_window_set_role ()

void
cdk_window_set_role (CdkWindow *window,
                     const gchar *role);

When using CTK+, typically you should use ctk_window_set_role() instead of this low-level function.

The window manager and session manager use a window’s role to distinguish it from other kinds of window in the same application. When an application is restarted after being saved in a previous session, all windows with the same title and role are treated as interchangeable. So if you have two windows with the same title that should be distinguished for session management purposes, you should set the role on those windows. It doesn’t matter what string you use for the role, as long as you have a different role for each non-interchangeable kind of window.

Parameters

window

a toplevel CdkWindow

 

role

a string indicating its role

 

cdk_window_set_startup_id ()

void
cdk_window_set_startup_id (CdkWindow *window,
                           const gchar *startup_id);

When using CTK+, typically you should use ctk_window_set_startup_id() instead of this low-level function.

Parameters

window

a toplevel CdkWindow

 

startup_id

a string with startup-notification identifier

 

Since: 2.12


cdk_window_set_group ()

void
cdk_window_set_group (CdkWindow *window,
                      CdkWindow *leader);

Sets the group leader window for window . By default, CDK sets the group leader for all toplevel windows to a global window implicitly created by CDK. With this function you can override this default.

The group leader window allows the window manager to distinguish all windows that belong to a single application. It may for example allow users to minimize/unminimize all windows belonging to an application at once. You should only set a non-default group window if your application pretends to be multiple applications.

Parameters

window

a toplevel CdkWindow

 

leader

group leader window, or NULL to restore the default group leader window.

[allow-none]

cdk_window_get_group ()

CdkWindow *
cdk_window_get_group (CdkWindow *window);

Returns the group leader window for window . See cdk_window_set_group().

Parameters

window

a toplevel CdkWindow

 

Returns

the group leader window for window .

[transfer none]

Since: 2.4


cdk_window_set_decorations ()

void
cdk_window_set_decorations (CdkWindow *window,
                            CdkWMDecoration decorations);

“Decorations” are the features the window manager adds to a toplevel CdkWindow. This function sets the traditional Motif window manager hints that tell the window manager which decorations you would like your window to have. Usually you should use ctk_window_set_decorated() on a CtkWindow instead of using the CDK function directly.

The decorations argument is the logical OR of the fields in the CdkWMDecoration enumeration. If CDK_DECOR_ALL is included in the mask, the other bits indicate which decorations should be turned off. If CDK_DECOR_ALL is not included, then the other bits indicate which decorations should be turned on.

Most window managers honor a decorations hint of 0 to disable all decorations, but very few honor all possible combinations of bits.

Parameters

window

a toplevel CdkWindow

 

decorations

decoration hint mask

 

cdk_window_get_decorations ()

gboolean
cdk_window_get_decorations (CdkWindow *window,
                            CdkWMDecoration *decorations);

Returns the decorations set on the CdkWindow with cdk_window_set_decorations().

Parameters

window

The toplevel CdkWindow to get the decorations from

 

decorations

The window decorations will be written here.

[out]

Returns

TRUE if the window has decorations set, FALSE otherwise.


cdk_window_set_functions ()

void
cdk_window_set_functions (CdkWindow *window,
                          CdkWMFunction functions);

Sets hints about the window management functions to make available via buttons on the window frame.

On the X backend, this function sets the traditional Motif window manager hint for this purpose. However, few window managers do anything reliable or interesting with this hint. Many ignore it entirely.

The functions argument is the logical OR of values from the CdkWMFunction enumeration. If the bitmask includes CDK_FUNC_ALL, then the other bits indicate which functions to disable; if it doesn’t include CDK_FUNC_ALL, it indicates which functions to enable.

Parameters

window

a toplevel CdkWindow

 

functions

bitmask of operations to allow on window

 

cdk_get_default_root_window ()

CdkWindow *
cdk_get_default_root_window (void);

Obtains the root window (parent all other windows are inside) for the default display and screen.

Returns

the default root window.

[transfer none]


cdk_window_get_support_multidevice ()

gboolean
cdk_window_get_support_multidevice (CdkWindow *window);

Returns TRUE if the window is aware of the existence of multiple devices.

Parameters

window

a CdkWindow.

 

Returns

TRUE if the window handles multidevice features.

Since: 3.0


cdk_window_set_support_multidevice ()

void
cdk_window_set_support_multidevice (CdkWindow *window,
                                    gboolean support_multidevice);

This function will enable multidevice features in window .

Multidevice aware windows will need to handle properly multiple, per device enter/leave events, device grabs and grab ownerships.

Parameters

window

a CdkWindow.

 

support_multidevice

TRUE to enable multidevice support in window .

 

Since: 3.0


cdk_window_get_device_cursor ()

CdkCursor *
cdk_window_get_device_cursor (CdkWindow *window,
                              CdkDevice *device);

Retrieves a CdkCursor pointer for the device currently set on the specified CdkWindow, 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 CdkWindow.

 

device

a master, pointer CdkDevice.

 

Returns

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

[nullable][transfer none]

Since: 3.0


cdk_window_set_device_cursor ()

void
cdk_window_set_device_cursor (CdkWindow *window,
                              CdkDevice *device,
                              CdkCursor *cursor);

Sets a specific CdkCursor for a given device when it gets inside window . Use cdk_cursor_new_for_display() or cdk_cursor_new_from_pixbuf() to create the cursor. To make the cursor invisible, use CDK_BLANK_CURSOR. Passing NULL for the cursor argument to cdk_window_set_cursor() means that window will use the cursor of its parent window. Most windows should use this default.

Parameters

window

a CdkWindow

 

device

a master, pointer CdkDevice

 

cursor

a CdkCursor

 

Since: 3.0


cdk_window_get_device_events ()

CdkEventMask
cdk_window_get_device_events (CdkWindow *window,
                              CdkDevice *device);

Returns the event mask for window corresponding to an specific device.

Parameters

window

a CdkWindow.

 

device

a CdkDevice.

 

Returns

device event mask for window

Since: 3.0


cdk_window_set_device_events ()

void
cdk_window_set_device_events (CdkWindow *window,
                              CdkDevice *device,
                              CdkEventMask event_mask);

Sets the event mask for a given device (Normally a floating device, not attached to any visible pointer) to window . For example, an event mask including CDK_BUTTON_PRESS_MASK means the window should report button press events. The event mask is the bitwise OR of values from the CdkEventMask enumeration.

See the input handling overview for details.

Parameters

window

a CdkWindow

 

device

CdkDevice to enable events for.

 

event_mask

event mask for window

 

Since: 3.0


cdk_window_get_source_events ()

CdkEventMask
cdk_window_get_source_events (CdkWindow *window,
                              CdkInputSource source);

Returns the event mask for window corresponding to the device class specified by source .

Parameters

window

a CdkWindow

 

source

a CdkInputSource to define the source class.

 

Returns

source event mask for window


cdk_window_set_source_events ()

void
cdk_window_set_source_events (CdkWindow *window,
                              CdkInputSource source,
                              CdkEventMask event_mask);

Sets the event mask for any floating device (i.e. not attached to any visible pointer) that has the source defined as source . This event mask will be applied both to currently existing, newly added devices after this call, and devices being attached/detached.

Parameters

window

a CdkWindow

 

source

a CdkInputSource to define the source class.

 

event_mask

event mask for window

 

Since: 3.0


cdk_window_get_event_compression ()

gboolean
cdk_window_get_event_compression (CdkWindow *window);

Get the current event compression setting for this window.

Parameters

window

a CdkWindow

 

Returns

TRUE if motion events will be compressed

Since: 3.12


cdk_window_set_event_compression ()

void
cdk_window_set_event_compression (CdkWindow *window,
                                  gboolean event_compression);

Determines whether or not extra unprocessed motion events in the event queue can be discarded. If TRUE only the most recent event will be delivered.

Some types of applications, e.g. paint programs, need to see all motion events and will benefit from turning off event compression.

By default, event compression is enabled.

Parameters

window

a CdkWindow

 

event_compression

TRUE if motion events should be compressed

 

Since: 3.12


cdk_offscreen_window_get_surface ()

cairo_surface_t *
cdk_offscreen_window_get_surface (CdkWindow *window);

Gets the offscreen surface that an offscreen window renders into. If you need to keep this around over window resizes, you need to add a reference to it.

Parameters

window

a CdkWindow

 

Returns

The offscreen surface, or NULL if not offscreen.

[nullable][transfer none]


cdk_offscreen_window_set_embedder ()

void
cdk_offscreen_window_set_embedder (CdkWindow *window,
                                   CdkWindow *embedder);

Sets window to be embedded in embedder .

To fully embed an offscreen window, in addition to calling this function, it is also necessary to handle the “pick-embedded-child” signal on the embedder and the “to-embedder” and “from-embedder” signals on window .

Parameters

window

a CdkWindow

 

embedder

the CdkWindow that window gets embedded in

 

Since: 2.18


cdk_offscreen_window_get_embedder ()

CdkWindow *
cdk_offscreen_window_get_embedder (CdkWindow *window);

Gets the window that window is embedded in.

Parameters

window

a CdkWindow

 

Returns

the embedding CdkWindow, or NULL if window is not an mbedded offscreen window.

[nullable][transfer none]

Since: 2.18


cdk_window_geometry_changed ()

void
cdk_window_geometry_changed (CdkWindow *window);

This function informs CDK that the geometry of an embedded offscreen window has changed. This is necessary for CDK to keep track of which offscreen window the pointer is in.

Parameters

window

an embedded offscreen CdkWindow

 

Since: 2.18


cdk_window_coords_from_parent ()

void
cdk_window_coords_from_parent (CdkWindow *window,
                               gdouble parent_x,
                               gdouble parent_y,
                               gdouble *x,
                               gdouble *y);

Transforms window coordinates from a parent window to a child window, where the parent window is the normal parent as returned by cdk_window_get_parent() for normal windows, and the window's embedder as returned by cdk_offscreen_window_get_embedder() for offscreen windows.

For normal windows, calling this function is equivalent to subtracting the return values of cdk_window_get_position() from the parent coordinates. For offscreen windows however (which can be arbitrarily transformed), this function calls the CdkWindow::from-embedder: signal to translate the coordinates.

You should always use this function when writing generic code that walks down a window hierarchy.

See also: cdk_window_coords_to_parent()

Parameters

window

a child window

 

parent_x

X coordinate in parent’s coordinate system

 

parent_y

Y coordinate in parent’s coordinate system

 

x

return location for X coordinate in child’s coordinate system.

[out][allow-none]

y

return location for Y coordinate in child’s coordinate system.

[out][allow-none]

Since: 2.22


cdk_window_coords_to_parent ()

void
cdk_window_coords_to_parent (CdkWindow *window,
                             gdouble x,
                             gdouble y,
                             gdouble *parent_x,
                             gdouble *parent_y);

Transforms window coordinates from a child window to its parent window, where the parent window is the normal parent as returned by cdk_window_get_parent() for normal windows, and the window's embedder as returned by cdk_offscreen_window_get_embedder() for offscreen windows.

For normal windows, calling this function is equivalent to adding the return values of cdk_window_get_position() to the child coordinates. For offscreen windows however (which can be arbitrarily transformed), this function calls the CdkWindow::to-embedder: signal to translate the coordinates.

You should always use this function when writing generic code that walks up a window hierarchy.

See also: cdk_window_coords_from_parent()

Parameters

window

a child window

 

x

X coordinate in child’s coordinate system

 

y

Y coordinate in child’s coordinate system

 

parent_x

return location for X coordinate in parent’s coordinate system, or NULL.

[out][allow-none]

parent_y

return location for Y coordinate in parent’s coordinate system, or NULL.

[out][allow-none]

Since: 2.22


cdk_window_get_effective_parent ()

CdkWindow *
cdk_window_get_effective_parent (CdkWindow *window);

Obtains the parent of window , as known to CDK. Works like cdk_window_get_parent() for normal windows, but returns the window’s embedder for offscreen windows.

See also: cdk_offscreen_window_get_embedder()

Parameters

window

a CdkWindow

 

Returns

effective parent of window .

[transfer none]

Since: 2.22


cdk_window_get_effective_toplevel ()

CdkWindow *
cdk_window_get_effective_toplevel (CdkWindow *window);

Gets the toplevel window that’s an ancestor of window .

Works like cdk_window_get_toplevel(), but treats an offscreen window's embedder as its parent, using cdk_window_get_effective_parent().

See also: cdk_offscreen_window_get_embedder()

Parameters

window

a CdkWindow

 

Returns

the effective toplevel window containing window .

[transfer none]

Since: 2.22

Types and Values

CdkWindow

typedef struct _CdkWindow CdkWindow;

enum CdkWindowType

Describes the kind of window.

Members

CDK_WINDOW_ROOT

root window; this window has no parent, covers the entire screen, and is created by the window system

 

CDK_WINDOW_TOPLEVEL

toplevel window (used to implement CtkWindow)

 

CDK_WINDOW_CHILD

child window (used to implement e.g. CtkEntry)

 

CDK_WINDOW_TEMP

override redirect temporary window (used to implement CtkMenu)

 

CDK_WINDOW_FOREIGN

foreign window (see cdk_window_foreign_new())

 

CDK_WINDOW_OFFSCREEN

offscreen window (see Offscreen Windows). Since 2.18

 

CDK_WINDOW_SUBSURFACE

subsurface-based window; This window is visually tied to a toplevel, and is moved/stacked with it. Currently this window type is only implemented in Wayland. Since 3.14

 

enum CdkWindowWindowClass

CDK_INPUT_OUTPUT windows are the standard kind of window you might expect. Such windows receive events and are also displayed on screen. CDK_INPUT_ONLY windows are invisible; they are usually placed above other windows in order to trap or filter the events. You can’t draw on CDK_INPUT_ONLY windows.

Members

CDK_INPUT_OUTPUT

window for graphics and events

 

CDK_INPUT_ONLY

window for events only

 

enum CdkWindowHints

Used to indicate which fields of a CdkGeometry struct should be paid attention to. Also, the presence/absence of CDK_HINT_POS , CDK_HINT_USER_POS , and CDK_HINT_USER_SIZE is significant, though they don't directly refer to CdkGeometry fields. CDK_HINT_USER_POS will be set automatically by CtkWindow if you call ctk_window_move(). CDK_HINT_USER_POS and CDK_HINT_USER_SIZE should be set if the user specified a size/position using a --geometry command-line argument; ctk_window_parse_geometry() automatically sets these flags.

Members

CDK_HINT_POS

indicates that the program has positioned the window

 

CDK_HINT_MIN_SIZE

min size fields are set

 

CDK_HINT_MAX_SIZE

max size fields are set

 

CDK_HINT_BASE_SIZE

base size fields are set

 

CDK_HINT_ASPECT

aspect ratio fields are set

 

CDK_HINT_RESIZE_INC

resize increment fields are set

 

CDK_HINT_WIN_GRAVITY

window gravity field is set

 

CDK_HINT_USER_POS

indicates that the window’s position was explicitly set by the user

 

CDK_HINT_USER_SIZE

indicates that the window’s size was explicitly set by the user

 

struct CdkGeometry

struct CdkGeometry {
  gint min_width;
  gint min_height;
  gint max_width;
  gint max_height;
  gint base_width;
  gint base_height;
  gint width_inc;
  gint height_inc;
  gdouble min_aspect;
  gdouble max_aspect;
  CdkGravity win_gravity;
};

The CdkGeometry struct gives the window manager information about a window’s geometry constraints. Normally you would set these on the CTK+ level using ctk_window_set_geometry_hints(). CtkWindow then sets the hints on the CdkWindow it creates.

cdk_window_set_geometry_hints() expects the hints to be fully valid already and simply passes them to the window manager; in contrast, ctk_window_set_geometry_hints() performs some interpretation. For example, CtkWindow will apply the hints to the geometry widget instead of the toplevel window, if you set a geometry widget. Also, the min_width /min_height /max_width /max_height fields may be set to -1, and CtkWindow will substitute the size request of the window or geometry widget. If the minimum size hint is not provided, CtkWindow will use its requisition as the minimum size. If the minimum size is provided and a geometry widget is set, CtkWindow will take the minimum size as the minimum size of the geometry widget rather than the entire window. The base size is treated similarly.

The canonical use-case for ctk_window_set_geometry_hints() is to get a terminal widget to resize properly. Here, the terminal text area should be the geometry widget; CtkWindow will then automatically set the base size to the size of other widgets in the terminal window, such as the menubar and scrollbar. Then, the width_inc and height_inc fields should be set to the size of one character in the terminal. Finally, the base size should be set to the size of one character. The net effect is that the minimum size of the terminal will have a 1x1 character terminal area, and only terminal sizes on the “character grid” will be allowed.

Here’s an example of how the terminal example would be implemented, assuming a terminal area widget called “terminal” and a toplevel window “toplevel”:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
CdkGeometry hints;

hints.base_width = terminal->char_width;
        hints.base_height = terminal->char_height;
        hints.min_width = terminal->char_width;
        hints.min_height = terminal->char_height;
        hints.width_inc = terminal->char_width;
        hints.height_inc = terminal->char_height;

 ctk_window_set_geometry_hints (CTK_WINDOW (toplevel),
                                CTK_WIDGET (terminal),
                                &hints,
                                CDK_HINT_RESIZE_INC |
                                CDK_HINT_MIN_SIZE |
                                CDK_HINT_BASE_SIZE);

The other useful fields are the min_aspect and max_aspect fields; these contain a width/height ratio as a floating point number. If a geometry widget is set, the aspect applies to the geometry widget rather than the entire window. The most common use of these hints is probably to set min_aspect and max_aspect to the same value, thus forcing the window to keep a constant aspect ratio.

Members

gint min_width;

minimum width of window (or -1 to use requisition, with CtkWindow only)

 

gint min_height;

minimum height of window (or -1 to use requisition, with CtkWindow only)

 

gint max_width;

maximum width of window (or -1 to use requisition, with CtkWindow only)

 

gint max_height;

maximum height of window (or -1 to use requisition, with CtkWindow only)

 

gint base_width;

allowed window widths are base_width + width_inc * N where N is any integer (-1 allowed with CtkWindow)

 

gint base_height;

allowed window widths are base_height + height_inc * N where N is any integer (-1 allowed with CtkWindow)

 

gint width_inc;

width resize increment

 

gint height_inc;

height resize increment

 

gdouble min_aspect;

minimum width/height ratio

 

gdouble max_aspect;

maximum width/height ratio

 

CdkGravity win_gravity;

window gravity, see ctk_window_set_gravity()

 

enum CdkGravity

Defines the reference point of a window and the meaning of coordinates passed to ctk_window_move(). See ctk_window_move() and the "implementation notes" section of the Extended Window Manager Hints specification for more details.

Members

CDK_GRAVITY_NORTH_WEST

the reference point is at the top left corner.

 

CDK_GRAVITY_NORTH

the reference point is in the middle of the top edge.

 

CDK_GRAVITY_NORTH_EAST

the reference point is at the top right corner.

 

CDK_GRAVITY_WEST

the reference point is at the middle of the left edge.

 

CDK_GRAVITY_CENTER

the reference point is at the center of the window.

 

CDK_GRAVITY_EAST

the reference point is at the middle of the right edge.

 

CDK_GRAVITY_SOUTH_WEST

the reference point is at the lower left corner.

 

CDK_GRAVITY_SOUTH

the reference point is at the middle of the lower edge.

 

CDK_GRAVITY_SOUTH_EAST

the reference point is at the lower right corner.

 

CDK_GRAVITY_STATIC

the reference point is at the top left corner of the window itself, ignoring window manager decorations.

 

enum CdkAnchorHints

Positioning hints for aligning a window relative to a rectangle.

These hints determine how the window should be positioned in the case that the window would fall off-screen if placed in its ideal position.

For example, CDK_ANCHOR_FLIP_X will replace CDK_GRAVITY_NORTH_WEST with CDK_GRAVITY_NORTH_EAST and vice versa if the window extends beyond the left or right edges of the monitor.

If CDK_ANCHOR_SLIDE_X is set, the window can be shifted horizontally to fit on-screen. If CDK_ANCHOR_RESIZE_X is set, the window can be shrunken horizontally to fit.

In general, when multiple flags are set, flipping should take precedence over sliding, which should take precedence over resizing.

Members

CDK_ANCHOR_FLIP_X

allow flipping anchors horizontally

 

CDK_ANCHOR_FLIP_Y

allow flipping anchors vertically

 

CDK_ANCHOR_SLIDE_X

allow sliding window horizontally

 

CDK_ANCHOR_SLIDE_Y

allow sliding window vertically

 

CDK_ANCHOR_RESIZE_X

allow resizing window horizontally

 

CDK_ANCHOR_RESIZE_Y

allow resizing window vertically

 

CDK_ANCHOR_FLIP

allow flipping anchors on both axes

 

CDK_ANCHOR_SLIDE

allow sliding window on both axes

 

CDK_ANCHOR_RESIZE

allow resizing window on both axes

 

Since: 3.22

Stability Level: Unstable


enum CdkWindowEdge

Determines a window edge or corner.

Members

CDK_WINDOW_EDGE_NORTH_WEST

the top left corner.

 

CDK_WINDOW_EDGE_NORTH

the top edge.

 

CDK_WINDOW_EDGE_NORTH_EAST

the top right corner.

 

CDK_WINDOW_EDGE_WEST

the left edge.

 

CDK_WINDOW_EDGE_EAST

the right edge.

 

CDK_WINDOW_EDGE_SOUTH_WEST

the lower left corner.

 

CDK_WINDOW_EDGE_SOUTH

the lower edge.

 

CDK_WINDOW_EDGE_SOUTH_EAST

the lower right corner.

 

enum CdkWindowTypeHint

These are hints for the window manager that indicate what type of function the window has. The window manager can use this when determining decoration and behaviour of the window. The hint must be set before mapping the window.

See the Extended Window Manager Hints specification for more details about window types.

Members

CDK_WINDOW_TYPE_HINT_NORMAL

Normal toplevel window.

 

CDK_WINDOW_TYPE_HINT_DIALOG

Dialog window.

 

CDK_WINDOW_TYPE_HINT_MENU

Window used to implement a menu; CTK+ uses this hint only for torn-off menus, see CtkTearoffMenuItem.

 

CDK_WINDOW_TYPE_HINT_TOOLBAR

Window used to implement toolbars.

 

CDK_WINDOW_TYPE_HINT_SPLASHSCREEN

Window used to display a splash screen during application startup.

 

CDK_WINDOW_TYPE_HINT_UTILITY

Utility windows which are not detached toolbars or dialogs.

 

CDK_WINDOW_TYPE_HINT_DOCK

Used for creating dock or panel windows.

 

CDK_WINDOW_TYPE_HINT_DESKTOP

Used for creating the desktop background window.

 

CDK_WINDOW_TYPE_HINT_DROPDOWN_MENU

A menu that belongs to a menubar.

 

CDK_WINDOW_TYPE_HINT_POPUP_MENU

A menu that does not belong to a menubar, e.g. a context menu.

 

CDK_WINDOW_TYPE_HINT_TOOLTIP

A tooltip.

 

CDK_WINDOW_TYPE_HINT_NOTIFICATION

A notification - typically a “bubble” that belongs to a status icon.

 

CDK_WINDOW_TYPE_HINT_COMBO

A popup from a combo box.

 

CDK_WINDOW_TYPE_HINT_DND

A window that is used to implement a DND cursor.

 

struct CdkWindowAttr

struct CdkWindowAttr {
  gchar *title;
  gint event_mask;
  gint x, y;
  gint width;
  gint height;
  CdkWindowWindowClass wclass;
  CdkVisual *visual;
  CdkWindowType window_type;
  CdkCursor *cursor;
  gchar *wmclass_name;
  gchar *wmclass_class;
  gboolean override_redirect;
  CdkWindowTypeHint type_hint;
};

Attributes to use for a newly-created window.

Members

gchar *title;

title of the window (for toplevel windows)

 

gint event_mask;

event mask (see cdk_window_set_events())

 

gint x;

X coordinate relative to parent window (see cdk_window_move())

 

gint y;

Y coordinate relative to parent window (see cdk_window_move())

 

gint width;

width of window

 

gint height;

height of window

 

CdkWindowWindowClass wclass;

CDK_INPUT_OUTPUT (normal window) or CDK_INPUT_ONLY (invisible window that receives events)

 

CdkVisual *visual;

CdkVisual for window

 

CdkWindowType window_type;

type of window

 

CdkCursor *cursor;

cursor for the window (see cdk_window_set_cursor())

 

gchar *wmclass_name;

don’t use (see ctk_window_set_wmclass())

 

gchar *wmclass_class;

don’t use (see ctk_window_set_wmclass())

 

gboolean override_redirect;

TRUE to bypass the window manager

 

CdkWindowTypeHint type_hint;

a hint of the function of the window

 

enum CdkWindowAttributesType

Used to indicate which fields in the CdkWindowAttr struct should be honored. For example, if you filled in the “cursor” and “x” fields of CdkWindowAttr, pass “CDK_WA_X | CDK_WA_CURSOR ” to cdk_window_new(). Fields in CdkWindowAttr not covered by a bit in this enum are required; for example, the width /height , wclass , and window_type fields are required, they have no corresponding flag in CdkWindowAttributesType.

Members

CDK_WA_TITLE

Honor the title field

 

CDK_WA_X

Honor the X coordinate field

 

CDK_WA_Y

Honor the Y coordinate field

 

CDK_WA_CURSOR

Honor the cursor field

 

CDK_WA_VISUAL

Honor the visual field

 

CDK_WA_WMCLASS

Honor the wmclass_class and wmclass_name fields

 

CDK_WA_NOREDIR

Honor the override_redirect field

 

CDK_WA_TYPE_HINT

Honor the type_hint field

 

enum CdkFullscreenMode

Indicates which monitor (in a multi-head setup) a window should span over when in fullscreen mode.

Members

CDK_FULLSCREEN_ON_CURRENT_MONITOR

Fullscreen on current monitor only.

 

CDK_FULLSCREEN_ON_ALL_MONITORS

Span across all monitors when fullscreen.

 

Since: 3.8


enum CdkFilterReturn

Specifies the result of applying a CdkFilterFunc to a native event.

Members

CDK_FILTER_CONTINUE

event not handled, continue processing.

 

CDK_FILTER_TRANSLATE

native event translated into a CDK event and stored in the event structure that was passed in.

 

CDK_FILTER_REMOVE

event handled, terminate processing.

 

CdkXEvent

typedef void CdkXEvent;	  /* Can be cast to window system specific

Used to represent native events (XEvents for the X11 backend, MSGs for Win32).


CDK_PARENT_RELATIVE

#define CDK_PARENT_RELATIVE  1L

A special value, indicating that the background for a window should be inherited from the parent window.


enum CdkModifierType

A set of bit-flags to indicate the state of modifier keys and mouse buttons in various event types. Typical modifier keys are Shift, Control, Meta, Super, Hyper, Alt, Compose, Apple, CapsLock or ShiftLock.

Like the X Window System, CDK supports 8 modifier keys and 5 mouse buttons.

Since 2.10, CDK recognizes which of the Meta, Super or Hyper keys are mapped to Mod2 - Mod5, and indicates this by setting CDK_SUPER_MASK, CDK_HYPER_MASK or CDK_META_MASK in the state field of key events.

Note that CDK may add internal values to events which include reserved values such as CDK_MODIFIER_RESERVED_13_MASK. Your code should preserve and ignore them. You can use CDK_MODIFIER_MASK to remove all reserved values.

Also note that the CDK X backend interprets button press events for button 4-7 as scroll events, so CDK_BUTTON4_MASK and CDK_BUTTON5_MASK will never be set.

Members

CDK_SHIFT_MASK

the Shift key.

 

CDK_LOCK_MASK

a Lock key (depending on the modifier mapping of the X server this may either be CapsLock or ShiftLock).

 

CDK_CONTROL_MASK

the Control key.

 

CDK_MOD1_MASK

the fourth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier, but normally it is the Alt key).

 

CDK_MOD2_MASK

the fifth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier).

 

CDK_MOD3_MASK

the sixth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier).

 

CDK_MOD4_MASK

the seventh modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier).

 

CDK_MOD5_MASK

the eighth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier).

 

CDK_BUTTON1_MASK

the first mouse button.

 

CDK_BUTTON2_MASK

the second mouse button.

 

CDK_BUTTON3_MASK

the third mouse button.

 

CDK_BUTTON4_MASK

the fourth mouse button.

 

CDK_BUTTON5_MASK

the fifth mouse button.

 

CDK_MODIFIER_RESERVED_13_MASK

A reserved bit flag; do not use in your own code

 

CDK_MODIFIER_RESERVED_14_MASK

A reserved bit flag; do not use in your own code

 

CDK_MODIFIER_RESERVED_15_MASK

A reserved bit flag; do not use in your own code

 

CDK_MODIFIER_RESERVED_16_MASK

A reserved bit flag; do not use in your own code

 

CDK_MODIFIER_RESERVED_17_MASK

A reserved bit flag; do not use in your own code

 

CDK_MODIFIER_RESERVED_18_MASK

A reserved bit flag; do not use in your own code

 

CDK_MODIFIER_RESERVED_19_MASK

A reserved bit flag; do not use in your own code

 

CDK_MODIFIER_RESERVED_20_MASK

A reserved bit flag; do not use in your own code

 

CDK_MODIFIER_RESERVED_21_MASK

A reserved bit flag; do not use in your own code

 

CDK_MODIFIER_RESERVED_22_MASK

A reserved bit flag; do not use in your own code

 

CDK_MODIFIER_RESERVED_23_MASK

A reserved bit flag; do not use in your own code

 

CDK_MODIFIER_RESERVED_24_MASK

A reserved bit flag; do not use in your own code

 

CDK_MODIFIER_RESERVED_25_MASK

A reserved bit flag; do not use in your own code

 

CDK_SUPER_MASK

the Super modifier. Since 2.10

 

CDK_HYPER_MASK

the Hyper modifier. Since 2.10

 

CDK_META_MASK

the Meta modifier. Since 2.10

 

CDK_MODIFIER_RESERVED_29_MASK

A reserved bit flag; do not use in your own code

 

CDK_RELEASE_MASK

not used in CDK itself. CTK+ uses it to differentiate between (keyval, modifiers) pairs from key press and release events.

 

CDK_MODIFIER_MASK

a mask covering all modifier types.

 

enum CdkModifierIntent

This enum is used with cdk_keymap_get_modifier_mask() in order to determine what modifiers the currently used windowing system backend uses for particular purposes. For example, on X11/Windows, the Control key is used for invoking menu shortcuts (accelerators), whereas on Apple computers it’s the Command key (which correspond to CDK_CONTROL_MASK and CDK_MOD2_MASK, respectively).

Members

CDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR

the primary modifier used to invoke menu accelerators.

 

CDK_MODIFIER_INTENT_CONTEXT_MENU

the modifier used to invoke context menus. Note that mouse button 3 always triggers context menus. When this modifier is not 0, it additionally triggers context menus when used with mouse button 1.

 

CDK_MODIFIER_INTENT_EXTEND_SELECTION

the modifier used to extend selections using modifier-click or modifier-cursor-key

 

CDK_MODIFIER_INTENT_MODIFY_SELECTION

the modifier used to modify selections, which in most cases means toggling the clicked item into or out of the selection.

 

CDK_MODIFIER_INTENT_NO_TEXT_INPUT

when any of these modifiers is pressed, the key event cannot produce a symbol directly. This is meant to be used for input methods, and for use cases like typeahead search.

 

CDK_MODIFIER_INTENT_SHIFT_GROUP

the modifier that switches between keyboard groups (AltGr on X11/Windows and Option/Alt on OS X).

 

CDK_MODIFIER_INTENT_DEFAULT_MOD_MASK

The set of modifier masks accepted as modifiers in accelerators. Needed because Command is mapped to MOD2 on OSX, which is widely used, but on X11 MOD2 is NumLock and using that for a mod key is problematic at best. Ref: https://bugzilla.gnome.org/show_bug.cgi?id=736125.

 

Since: 3.4


enum CdkWMDecoration

These are hints originally defined by the Motif toolkit. The window manager can use them when determining how to decorate the window. The hint must be set before mapping the window.

Members

CDK_DECOR_ALL

all decorations should be applied.

 

CDK_DECOR_BORDER

a frame should be drawn around the window.

 

CDK_DECOR_RESIZEH

the frame should have resize handles.

 

CDK_DECOR_TITLE

a titlebar should be placed above the window.

 

CDK_DECOR_MENU

a button for opening a menu should be included.

 

CDK_DECOR_MINIMIZE

a minimize button should be included.

 

CDK_DECOR_MAXIMIZE

a maximize button should be included.

 

enum CdkWMFunction

These are hints originally defined by the Motif toolkit. The window manager can use them when determining the functions to offer for the window. The hint must be set before mapping the window.

Members

CDK_FUNC_ALL

all functions should be offered.

 

CDK_FUNC_RESIZE

the window should be resizable.

 

CDK_FUNC_MOVE

the window should be movable.

 

CDK_FUNC_MINIMIZE

the window should be minimizable.

 

CDK_FUNC_MAXIMIZE

the window should be maximizable.

 

CDK_FUNC_CLOSE

the window should be closable.

 

Property Details

The “cursor” property

  “cursor”                   CdkCursor *

The mouse pointer for a CdkWindow. See cdk_window_set_cursor() and cdk_window_get_cursor() for details.

Owner: CdkWindow

Flags: Read / Write

Since: 2.18

Signal Details

The “create-surface” signal

CairoSurface*
user_function (CdkWindow *window,
               int        width,
               int        height,
               gpointer   user_data)

The ::create-surface signal is emitted when an offscreen window needs its surface (re)created, which happens either when the window is first drawn to, or when the window is being resized. The first signal handler that returns a non-NULL surface will stop any further signal emission, and its surface will be used.

Note that it is not possible to access the window's previous surface from within any callback of this signal. Calling cdk_offscreen_window_get_surface() will lead to a crash.

Parameters

window

the offscreen window on which the signal is emitted

 

width

the width of the offscreen surface to create

 

height

the height of the offscreen surface to create

 

user_data

user data set when the signal handler was connected.

 

Returns

the newly created cairo_surface_t for the offscreen window

Flags: Run Last

Since: 3.0


The “from-embedder” signal

void
user_function (CdkWindow *window,
               double     embedder_x,
               double     embedder_y,
               gpointer   offscreen_x,
               gpointer   offscreen_y,
               gpointer   user_data)

The ::from-embedder signal is emitted to translate coordinates in the embedder of an offscreen window to the offscreen window.

See also “to-embedder”.

Parameters

window

the offscreen window on which the signal is emitted

 

embedder_x

x coordinate in the embedder window

 

embedder_y

y coordinate in the embedder window

 

offscreen_x

return location for the x coordinate in the offscreen window.

[out][type double]

offscreen_y

return location for the y coordinate in the offscreen window.

[out][type double]

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 2.18


The “moved-to-rect” signal

void
user_function (CdkWindow *window,
               gpointer   flipped_rect,
               gpointer   final_rect,
               gboolean   flipped_x,
               gboolean   flipped_y,
               gpointer   user_data)

Emitted when the position of window is finalized after being moved to a destination rectangle.

window might be flipped over the destination rectangle in order to keep it on-screen, in which case flipped_x and flipped_y will be set to TRUE accordingly.

flipped_rect is the ideal position of window after any possible flipping, but before any possible sliding. final_rect is flipped_rect , but possibly translated in the case that flipping is still ineffective in keeping window on-screen.

Parameters

window

the CdkWindow that moved

 

flipped_rect

the position of window after any possible flipping or NULL if the backend can't obtain it.

[nullable]

final_rect

the final position of window or NULL if the backend can't obtain it.

[nullable]

flipped_x

TRUE if the anchors were flipped horizontally

 

flipped_y

TRUE if the anchors were flipped vertically

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First

Since: 3.22

Stability Level: Private


The “pick-embedded-child” signal

CdkWindow*
user_function (CdkWindow *window,
               double     x,
               double     y,
               gpointer   user_data)

The ::pick-embedded-child signal is emitted to find an embedded child at the given position.

Parameters

window

the window on which the signal is emitted

 

x

x coordinate in the window

 

y

y coordinate in the window

 

user_data

user data set when the signal handler was connected.

 

Returns

the CdkWindow of the embedded child at x , y , or NULL.

[nullable][transfer none]

Flags: Run Last

Since: 2.18


The “to-embedder” signal

void
user_function (CdkWindow *window,
               double     offscreen_x,
               double     offscreen_y,
               gpointer   embedder_x,
               gpointer   embedder_y,
               gpointer   user_data)

The ::to-embedder signal is emitted to translate coordinates in an offscreen window to its embedder.

See also “from-embedder”.

Parameters

window

the offscreen window on which the signal is emitted

 

offscreen_x

x coordinate in the offscreen window

 

offscreen_y

y coordinate in the offscreen window

 

embedder_x

return location for the x coordinate in the embedder window.

[out][type double]

embedder_y

return location for the y coordinate in the embedder window.

[out][type double]

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 2.18