CtkWindow

CtkWindow — Toplevel which can contain other widgets

Functions

CtkWidget * ctk_window_new ()
void ctk_window_set_title ()
void ctk_window_set_wmclass ()
void ctk_window_set_resizable ()
gboolean ctk_window_get_resizable ()
void ctk_window_add_accel_group ()
void ctk_window_remove_accel_group ()
gboolean ctk_window_activate_focus ()
gboolean ctk_window_activate_default ()
void ctk_window_set_modal ()
void ctk_window_set_default_size ()
void ctk_window_set_default_geometry ()
void ctk_window_set_geometry_hints ()
void ctk_window_set_gravity ()
CdkGravity ctk_window_get_gravity ()
void ctk_window_set_position ()
void ctk_window_set_transient_for ()
void ctk_window_set_attached_to ()
void ctk_window_set_destroy_with_parent ()
void ctk_window_set_hide_titlebar_when_maximized ()
void ctk_window_set_screen ()
CdkScreen * ctk_window_get_screen ()
gboolean ctk_window_is_active ()
gboolean ctk_window_is_maximized ()
gboolean ctk_window_has_toplevel_focus ()
GList * ctk_window_list_toplevels ()
void ctk_window_add_mnemonic ()
void ctk_window_remove_mnemonic ()
gboolean ctk_window_mnemonic_activate ()
gboolean ctk_window_activate_key ()
gboolean ctk_window_propagate_key_event ()
CtkWidget * ctk_window_get_focus ()
void ctk_window_set_focus ()
CtkWidget * ctk_window_get_default_widget ()
void ctk_window_set_default ()
void ctk_window_present ()
void ctk_window_present_with_time ()
void ctk_window_close ()
void ctk_window_iconify ()
void ctk_window_deiconify ()
void ctk_window_stick ()
void ctk_window_unstick ()
void ctk_window_maximize ()
void ctk_window_unmaximize ()
void ctk_window_fullscreen ()
void ctk_window_fullscreen_on_monitor ()
void ctk_window_unfullscreen ()
void ctk_window_set_keep_above ()
void ctk_window_set_keep_below ()
void ctk_window_begin_resize_drag ()
void ctk_window_begin_move_drag ()
void ctk_window_set_decorated ()
void ctk_window_set_deletable ()
void ctk_window_set_mnemonic_modifier ()
void ctk_window_set_type_hint ()
void ctk_window_set_skip_taskbar_hint ()
void ctk_window_set_skip_pager_hint ()
void ctk_window_set_urgency_hint ()
void ctk_window_set_accept_focus ()
void ctk_window_set_focus_on_map ()
void ctk_window_set_startup_id ()
void ctk_window_set_role ()
gboolean ctk_window_get_decorated ()
gboolean ctk_window_get_deletable ()
GList * ctk_window_get_default_icon_list ()
const gchar * ctk_window_get_default_icon_name ()
void ctk_window_get_default_size ()
gboolean ctk_window_get_destroy_with_parent ()
gboolean ctk_window_get_hide_titlebar_when_maximized ()
GdkPixbuf * ctk_window_get_icon ()
GList * ctk_window_get_icon_list ()
const gchar * ctk_window_get_icon_name ()
CdkModifierType ctk_window_get_mnemonic_modifier ()
gboolean ctk_window_get_modal ()
void ctk_window_get_position ()
const gchar * ctk_window_get_role ()
void ctk_window_get_size ()
const gchar * ctk_window_get_title ()
CtkWindow * ctk_window_get_transient_for ()
CtkWidget * ctk_window_get_attached_to ()
CdkWindowTypeHint ctk_window_get_type_hint ()
gboolean ctk_window_get_skip_taskbar_hint ()
gboolean ctk_window_get_skip_pager_hint ()
gboolean ctk_window_get_urgency_hint ()
gboolean ctk_window_get_accept_focus ()
gboolean ctk_window_get_focus_on_map ()
CtkWindowGroup * ctk_window_get_group ()
gboolean ctk_window_has_group ()
CtkWindowType ctk_window_get_window_type ()
void ctk_window_move ()
gboolean ctk_window_parse_geometry ()
void ctk_window_reshow_with_initial_size ()
void ctk_window_resize ()
void ctk_window_resize_to_geometry ()
void ctk_window_set_default_icon_list ()
void ctk_window_set_default_icon ()
gboolean ctk_window_set_default_icon_from_file ()
void ctk_window_set_default_icon_name ()
void ctk_window_set_icon ()
void ctk_window_set_icon_list ()
gboolean ctk_window_set_icon_from_file ()
void ctk_window_set_icon_name ()
void ctk_window_set_auto_startup_notification ()
gdouble ctk_window_get_opacity ()
void ctk_window_set_opacity ()
gboolean ctk_window_get_mnemonics_visible ()
void ctk_window_set_mnemonics_visible ()
gboolean ctk_window_get_focus_visible ()
void ctk_window_set_focus_visible ()
void ctk_window_set_has_resize_grip ()
gboolean ctk_window_get_has_resize_grip ()
gboolean ctk_window_resize_grip_is_visible ()
gboolean ctk_window_get_resize_grip_area ()
CtkApplication * ctk_window_get_application ()
void ctk_window_set_application ()
void ctk_window_set_has_user_ref_count ()
void ctk_window_set_titlebar ()
CtkWidget * ctk_window_get_titlebar ()
void ctk_window_set_interactive_debugging ()

Properties

gboolean accept-focus Read / Write
CtkApplication * application Read / Write
CtkWidget * attached-to Read / Write / Construct
gboolean decorated Read / Write
int default-height Read / Write
int default-width Read / Write
gboolean deletable Read / Write
gboolean destroy-with-parent Read / Write
gboolean focus-on-map Read / Write
gboolean focus-visible Read / Write
CdkGravity gravity Read / Write
gboolean has-resize-grip Read / Write
gboolean has-toplevel-focus Read
gboolean hide-titlebar-when-maximized Read / Write
GdkPixbuf * icon Read / Write
char * icon-name Read / Write
gboolean is-active Read
gboolean is-maximized Read
gboolean mnemonics-visible Read / Write
gboolean modal Read / Write
gboolean resizable Read / Write
gboolean resize-grip-visible Read
char * role Read / Write
CdkScreen * screen Read / Write
gboolean skip-pager-hint Read / Write
gboolean skip-taskbar-hint Read / Write
char * startup-id Write
char * title Read / Write
CtkWindow * transient-for Read / Write / Construct
CtkWindowType type Read / Write / Construct Only
CdkWindowTypeHint type-hint Read / Write
gboolean urgency-hint Read / Write
CtkWindowPosition window-position Read / Write

Signals

void activate-default Action
void activate-focus Action
gboolean enable-debugging Action
void keys-changed Run First
void set-focus Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── CtkWidget
            ╰── CtkContainer
                ╰── CtkBin
                    ╰── CtkWindow
                        ├── CtkDialog
                        ├── CtkApplicationWindow
                        ├── CtkAssistant
                        ├── CtkOffscreenWindow
                        ├── CtkPlug
                        ╰── CtkShortcutsWindow

Implemented Interfaces

CtkWindow implements AtkImplementorIface and CtkBuildable.

Includes

#include <ctk/ctk.h>

Description

A CtkWindow is a toplevel window which can contain other widgets. Windows normally have decorations that are under the control of the windowing system and allow the user to manipulate the window (resize it, move it, close it,...).

CtkWindow as CtkBuildable

The CtkWindow implementation of the CtkBuildable interface supports a custom <accel-groups> element, which supports any number of <group> elements representing the CtkAccelGroup objects you want to add to your window (synonymous with ctk_window_add_accel_group().

It also supports the <initial-focus> element, whose name property names the widget to receive the focus when the window is mapped.

An example of a UI definition fragment with accel groups:

1
2
3
4
5
6
7
8
9
10
<object class="CtkWindow">
  <accel-groups>
    <group name="accelgroup1"/>
  </accel-groups>
  <initial-focus name="thunderclap"/>
</object>

...

<object class="CtkAccelGroup" id="accelgroup1"/>

The CtkWindow implementation of the CtkBuildable interface supports setting a child as the titlebar by specifying “titlebar” as the “type” attribute of a <child> element.


CSS nodes

1
2
3
4
window.background
├── decoration
├── <titlebar child>.titlebar [.default-decoration]
╰── <child>

CtkWindow has a main CSS node with name window and style class .background, and a subnode with name decoration.

Style classes that are typically used with the main CSS node are .csd (when client-side decorations are in use), .solid-csd (for client-side decorations without invisible borders), .ssd (used by mutter when rendering server-side decorations). CtkWindow also represents window states with the following style classes on the main node: .tiled, .maximized, .fullscreen. Specialized types of window often add their own discriminating style classes, such as .popup or .tooltip.

CtkWindow adds the .titlebar and .default-decoration style classes to the widget that is added as a titlebar child.

Functions

ctk_window_new ()

CtkWidget *
ctk_window_new (CtkWindowType type);

Creates a new CtkWindow, which is a toplevel window that can contain other widgets. Nearly always, the type of the window should be CTK_WINDOW_TOPLEVEL. If you’re implementing something like a popup menu from scratch (which is a bad idea, just use CtkMenu), you might use CTK_WINDOW_POPUP. CTK_WINDOW_POPUP is not for dialogs, though in some other toolkits dialogs are called “popups”. In CTK+, CTK_WINDOW_POPUP means a pop-up menu or pop-up tooltip. On X11, popup windows are not controlled by the window manager.

If you simply want an undecorated window (no window borders), use ctk_window_set_decorated(), don’t use CTK_WINDOW_POPUP.

All top-level windows created by ctk_window_new() are stored in an internal top-level window list. This list can be obtained from ctk_window_list_toplevels(). Due to Ctk+ keeping a reference to the window internally, ctk_window_new() does not return a reference to the caller.

To delete a CtkWindow, call ctk_widget_destroy().

Parameters

type

type of window

 

Returns

a new CtkWindow.


ctk_window_set_title ()

void
ctk_window_set_title (CtkWindow *window,
                      const gchar *title);

Sets the title of the CtkWindow. The title of a window will be displayed in its title bar; on the X Window System, the title bar is rendered by the window manager, so exactly how the title appears to users may vary according to a user’s exact configuration. The title should help a user distinguish this window from other windows they may have open. A good title might include the application name and current document filename, for example.

Parameters

window

a CtkWindow

 

title

title of the window

 

ctk_window_set_wmclass ()

void
ctk_window_set_wmclass (CtkWindow *window,
                        const gchar *wmclass_name,
                        const gchar *wmclass_class);

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

Don’t use this function. It sets the X Window System “class” and “name” hints for a window. According to the ICCCM, you should always set these to the same value for all windows in an application, and CTK+ sets them to that value by default, so calling this function is sort of pointless. However, you may want to call ctk_window_set_role() on each window in your application, for the benefit of the session manager. Setting the role allows the window manager to restore window positions when loading a saved session.

Parameters

window

a CtkWindow

 

wmclass_name

window name hint

 

wmclass_class

window class hint

 

ctk_window_set_resizable ()

void
ctk_window_set_resizable (CtkWindow *window,
                          gboolean resizable);

Sets whether the user can resize a window. Windows are user resizable by default.

Parameters

window

a CtkWindow

 

resizable

TRUE if the user can resize this window

 

ctk_window_get_resizable ()

gboolean
ctk_window_get_resizable (CtkWindow *window);

Gets the value set by ctk_window_set_resizable().

Parameters

window

a CtkWindow

 

Returns

TRUE if the user can resize the window


ctk_window_add_accel_group ()

void
ctk_window_add_accel_group (CtkWindow *window,
                            CtkAccelGroup *accel_group);

Associate accel_group with window , such that calling ctk_accel_groups_activate() on window will activate accelerators in accel_group .

Parameters

window

window to attach accelerator group to

 

accel_group

a CtkAccelGroup

 

ctk_window_remove_accel_group ()

void
ctk_window_remove_accel_group (CtkWindow *window,
                               CtkAccelGroup *accel_group);

Reverses the effects of ctk_window_add_accel_group().

Parameters

window

a CtkWindow

 

accel_group

a CtkAccelGroup

 

ctk_window_activate_focus ()

gboolean
ctk_window_activate_focus (CtkWindow *window);

Activates the current focused widget within the window.

Parameters

window

a CtkWindow

 

Returns

TRUE if a widget got activated.


ctk_window_activate_default ()

gboolean
ctk_window_activate_default (CtkWindow *window);

Activates the default widget for the window, unless the current focused widget has been configured to receive the default action (see ctk_widget_set_receives_default()), in which case the focused widget is activated.

Parameters

window

a CtkWindow

 

Returns

TRUE if a widget got activated.


ctk_window_set_modal ()

void
ctk_window_set_modal (CtkWindow *window,
                      gboolean modal);

Sets a window modal or non-modal. Modal windows prevent interaction with other windows in the same application. To keep modal dialogs on top of main application windows, use ctk_window_set_transient_for() to make the dialog transient for the parent; most window managers will then disallow lowering the dialog below the parent.

Parameters

window

a CtkWindow

 

modal

whether the window is modal

 

ctk_window_set_default_size ()

void
ctk_window_set_default_size (CtkWindow *window,
                             gint width,
                             gint height);

Sets the default size of a window. If the window’s “natural” size (its size request) is larger than the default, the default will be ignored. More generally, if the default size does not obey the geometry hints for the window (ctk_window_set_geometry_hints() can be used to set these explicitly), the default size will be clamped to the nearest permitted size.

Unlike ctk_widget_set_size_request(), which sets a size request for a widget and thus would keep users from shrinking the window, this function only sets the initial size, just as if the user had resized the window themselves. Users can still shrink the window again as they normally would. Setting a default size of -1 means to use the “natural” default size (the size request of the window).

For more control over a window’s initial size and how resizing works, investigate ctk_window_set_geometry_hints().

For some uses, ctk_window_resize() is a more appropriate function. ctk_window_resize() changes the current size of the window, rather than the size to be used on initial display. ctk_window_resize() always affects the window itself, not the geometry widget.

The default size of a window only affects the first time a window is shown; if a window is hidden and re-shown, it will remember the size it had prior to hiding, rather than using the default size.

Windows can’t actually be 0x0 in size, they must be at least 1x1, but passing 0 for width and height is OK, resulting in a 1x1 default size.

If you use this function to reestablish a previously saved window size, note that the appropriate size to save is the one returned by ctk_window_get_size(). Using the window allocation directly will not work in all circumstances and can lead to growing or shrinking windows.

Parameters

window

a CtkWindow

 

width

width in pixels, or -1 to unset the default width

 

height

height in pixels, or -1 to unset the default height

 

ctk_window_set_default_geometry ()

void
ctk_window_set_default_geometry (CtkWindow *window,
                                 gint width,
                                 gint height);

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

This function does nothing. If you want to set a default size, use ctk_window_set_default_size() instead.

Like ctk_window_set_default_size(), but width and height are interpreted in terms of the base size and increment set with ctk_window_set_geometry_hints.

Parameters

window

a CtkWindow

 

width

width in resize increments, or -1 to unset the default width

 

height

height in resize increments, or -1 to unset the default height

 

Since: 3.0


ctk_window_set_geometry_hints ()

void
ctk_window_set_geometry_hints (CtkWindow *window,
                               CtkWidget *geometry_widget,
                               CdkGeometry *geometry,
                               CdkWindowHints geom_mask);

This function sets up hints about how a window can be resized by the user. You can set a minimum and maximum size; allowed resize increments (e.g. for xterm, you can only resize by the size of a character); aspect ratios; and more. See the CdkGeometry struct.

Parameters

window

a CtkWindow

 

geometry_widget

widget the geometry hints used to be applied to or NULL. Since 3.20 this argument is ignored and CTK behaves as if NULL was set.

[allow-none]

geometry

struct containing geometry information or NULL.

[allow-none]

geom_mask

mask indicating which struct fields should be paid attention to

 

ctk_window_set_gravity ()

void
ctk_window_set_gravity (CtkWindow *window,
                        CdkGravity gravity);

Window gravity defines the meaning of coordinates passed to ctk_window_move(). See ctk_window_move() and CdkGravity for more details.

The default window gravity is CDK_GRAVITY_NORTH_WEST which will typically “do what you mean.”

Parameters

window

a CtkWindow

 

gravity

window gravity

 

ctk_window_get_gravity ()

CdkGravity
ctk_window_get_gravity (CtkWindow *window);

Gets the value set by ctk_window_set_gravity().

Parameters

window

a CtkWindow

 

Returns

window gravity.

[transfer none]


ctk_window_set_position ()

void
ctk_window_set_position (CtkWindow *window,
                         CtkWindowPosition position);

Sets a position constraint for this window. If the old or new constraint is CTK_WIN_POS_CENTER_ALWAYS, this will also cause the window to be repositioned to satisfy the new constraint.

Parameters

window

a CtkWindow.

 

position

a position constraint.

 

ctk_window_set_transient_for ()

void
ctk_window_set_transient_for (CtkWindow *window,
                              CtkWindow *parent);

Dialog windows should be set transient for the main application window they were spawned from. This allows window managers to e.g. keep the dialog on top of the main window, or center the dialog over the main window. ctk_dialog_new_with_buttons() and other convenience functions in CTK+ will sometimes call ctk_window_set_transient_for() on your behalf.

Passing NULL for parent unsets the current transient window.

On Wayland, this function can also be used to attach a new CTK_WINDOW_POPUP to a CTK_WINDOW_TOPLEVEL parent already mapped on screen so that the CTK_WINDOW_POPUP will be created as a subsurface-based window CDK_WINDOW_SUBSURFACE which can be positioned at will relatively to the CTK_WINDOW_TOPLEVEL surface.

On Windows, this function puts the child window on top of the parent, much as the window manager would have done on X.

Parameters

window

a CtkWindow

 

parent

parent window, or NULL.

[allow-none]

ctk_window_set_attached_to ()

void
ctk_window_set_attached_to (CtkWindow *window,
                            CtkWidget *attach_widget);

Marks window as attached to attach_widget . This creates a logical binding between the window and the widget it belongs to, which is used by CTK+ to propagate information such as styling or accessibility to window as if it was a children of attach_widget .

Examples of places where specifying this relation is useful are for instance a CtkMenu created by a CtkComboBox, a completion popup window created by CtkEntry or a typeahead search entry created by CtkTreeView.

Note that this function should not be confused with ctk_window_set_transient_for(), which specifies a window manager relation between two toplevels instead.

Passing NULL for attach_widget detaches the window.

Parameters

window

a CtkWindow

 

attach_widget

a CtkWidget, or NULL.

[allow-none]

Since: 3.4


ctk_window_set_destroy_with_parent ()

void
ctk_window_set_destroy_with_parent (CtkWindow *window,
                                    gboolean setting);

If setting is TRUE, then destroying the transient parent of window will also destroy window itself. This is useful for dialogs that shouldn’t persist beyond the lifetime of the main window they're associated with, for example.

Parameters

window

a CtkWindow

 

setting

whether to destroy window with its transient parent

 

ctk_window_set_hide_titlebar_when_maximized ()

void
ctk_window_set_hide_titlebar_when_maximized
                               (CtkWindow *window,
                                gboolean setting);

If setting is TRUE, then window will request that it’s titlebar should be hidden when maximized. This is useful for windows that don’t convey any information other than the application name in the titlebar, to put the available screen space to better use. If the underlying window system does not support the request, the setting will not have any effect.

Note that custom titlebars set with ctk_window_set_titlebar() are not affected by this. The application is in full control of their content and visibility anyway.

Parameters

window

a CtkWindow

 

setting

whether to hide the titlebar when window is maximized

 

Since: 3.4


ctk_window_set_screen ()

void
ctk_window_set_screen (CtkWindow *window,
                       CdkScreen *screen);

Sets the CdkScreen where the window is displayed; if the window is already mapped, it will be unmapped, and then remapped on the new screen.

Parameters

window

a CtkWindow.

 

screen

a CdkScreen.

 

Since: 2.2


ctk_window_get_screen ()

CdkScreen *
ctk_window_get_screen (CtkWindow *window);

Returns the CdkScreen associated with window .

Parameters

window

a CtkWindow.

 

Returns

a CdkScreen.

[transfer none]

Since: 2.2


ctk_window_is_active ()

gboolean
ctk_window_is_active (CtkWindow *window);

Returns whether the window is part of the current active toplevel. (That is, the toplevel window receiving keystrokes.) The return value is TRUE if the window is active toplevel itself, but also if it is, say, a CtkPlug embedded in the active toplevel. You might use this function if you wanted to draw a widget differently in an active window from a widget in an inactive window. See ctk_window_has_toplevel_focus()

Parameters

window

a CtkWindow

 

Returns

TRUE if the window part of the current active window.

Since: 2.4


ctk_window_is_maximized ()

gboolean
ctk_window_is_maximized (CtkWindow *window);

Retrieves the current maximized state of window .

Note that since maximization is ultimately handled by the window manager and happens asynchronously to an application request, you shouldn’t assume the return value of this function changing immediately (or at all), as an effect of calling ctk_window_maximize() or ctk_window_unmaximize().

Parameters

window

a CtkWindow

 

Returns

whether the window has a maximized state.

Since: 3.12


ctk_window_has_toplevel_focus ()

gboolean
ctk_window_has_toplevel_focus (CtkWindow *window);

Returns whether the input focus is within this CtkWindow. For real toplevel windows, this is identical to ctk_window_is_active(), but for embedded windows, like CtkPlug, the results will differ.

Parameters

window

a CtkWindow

 

Returns

TRUE if the input focus is within this CtkWindow

Since: 2.4


ctk_window_list_toplevels ()

GList *
ctk_window_list_toplevels (void);

Returns a list of all existing toplevel windows. The widgets in the list are not individually referenced. If you want to iterate through the list and perform actions involving callbacks that might destroy the widgets, you must call g_list_foreach (result, (GFunc)g_object_ref, NULL) first, and then unref all the widgets afterwards.

Returns

list of toplevel widgets.

[element-type CtkWidget][transfer container]


ctk_window_add_mnemonic ()

void
ctk_window_add_mnemonic (CtkWindow *window,
                         guint keyval,
                         CtkWidget *target);

Adds a mnemonic to this window.

Parameters

window

a CtkWindow

 

keyval

the mnemonic

 

target

the widget that gets activated by the mnemonic

 

ctk_window_remove_mnemonic ()

void
ctk_window_remove_mnemonic (CtkWindow *window,
                            guint keyval,
                            CtkWidget *target);

Removes a mnemonic from this window.

Parameters

window

a CtkWindow

 

keyval

the mnemonic

 

target

the widget that gets activated by the mnemonic

 

ctk_window_mnemonic_activate ()

gboolean
ctk_window_mnemonic_activate (CtkWindow *window,
                              guint keyval,
                              CdkModifierType modifier);

Activates the targets associated with the mnemonic.

Parameters

window

a CtkWindow

 

keyval

the mnemonic

 

modifier

the modifiers

 

Returns

TRUE if the activation is done.


ctk_window_activate_key ()

gboolean
ctk_window_activate_key (CtkWindow *window,
                         CdkEventKey *event);

Activates mnemonics and accelerators for this CtkWindow. This is normally called by the default ::key_press_event handler for toplevel windows, however in some cases it may be useful to call this directly when overriding the standard key handling for a toplevel window.

Parameters

window

a CtkWindow

 

event

a CdkEventKey

 

Returns

TRUE if a mnemonic or accelerator was found and activated.

Since: 2.4


ctk_window_propagate_key_event ()

gboolean
ctk_window_propagate_key_event (CtkWindow *window,
                                CdkEventKey *event);

Propagate a key press or release event to the focus widget and up the focus container chain until a widget handles event . This is normally called by the default ::key_press_event and ::key_release_event handlers for toplevel windows, however in some cases it may be useful to call this directly when overriding the standard key handling for a toplevel window.

Parameters

window

a CtkWindow

 

event

a CdkEventKey

 

Returns

TRUE if a widget in the focus chain handled the event.

Since: 2.4


ctk_window_get_focus ()

CtkWidget *
ctk_window_get_focus (CtkWindow *window);

Retrieves the current focused widget within the window. Note that this is the widget that would have the focus if the toplevel window focused; if the toplevel window is not focused then ctk_widget_has_focus (widget) will not be TRUE for the widget.

Parameters

window

a CtkWindow

 

Returns

the currently focused widget, or NULL if there is none.

[nullable][transfer none]


ctk_window_set_focus ()

void
ctk_window_set_focus (CtkWindow *window,
                      CtkWidget *focus);

If focus is not the current focus widget, and is focusable, sets it as the focus widget for the window. If focus is NULL, unsets the focus widget for this window. To set the focus to a particular widget in the toplevel, it is usually more convenient to use ctk_widget_grab_focus() instead of this function.

Parameters

window

a CtkWindow

 

focus

widget to be the new focus widget, or NULL to unset any focus widget for the toplevel window.

[allow-none]

ctk_window_get_default_widget ()

CtkWidget *
ctk_window_get_default_widget (CtkWindow *window);

Returns the default widget for window . See ctk_window_set_default() for more details.

Parameters

window

a CtkWindow

 

Returns

the default widget, or NULL if there is none.

[nullable][transfer none]

Since: 2.14


ctk_window_set_default ()

void
ctk_window_set_default (CtkWindow *window,
                        CtkWidget *default_widget);

The default widget is the widget that’s activated when the user presses Enter in a dialog (for example). This function sets or unsets the default widget for a CtkWindow. When setting (rather than unsetting) the default widget it’s generally easier to call ctk_widget_grab_default() on the widget. Before making a widget the default widget, you must call ctk_widget_set_can_default() on the widget you’d like to make the default.

Parameters

window

a CtkWindow

 

default_widget

widget to be the default, or NULL to unset the default widget for the toplevel.

[allow-none]

ctk_window_present ()

void
ctk_window_present (CtkWindow *window);

Presents a window to the user. This function should not be used as when it is called, it is too late to gather a valid timestamp to allow focus stealing prevention to work correctly.

Parameters

window

a CtkWindow

 

ctk_window_present_with_time ()

void
ctk_window_present_with_time (CtkWindow *window,
                              guint32 timestamp);

Presents a window to the user. This may mean raising the window in the stacking order, deiconifying it, moving it to the current desktop, and/or giving it the keyboard focus, possibly dependent on the user’s platform, window manager, and preferences.

If window is hidden, this function calls ctk_widget_show() as well.

This function should be used when the user tries to open a window that’s already open. Say for example the preferences dialog is currently open, and the user chooses Preferences from the menu a second time; use ctk_window_present() to move the already-open dialog where the user can see it.

Presents a window to the user in response to a user interaction. The timestamp should be gathered when the window was requested to be shown (when clicking a link for example), rather than once the window is ready to be shown.

Parameters

window

a CtkWindow

 

timestamp

the timestamp of the user interaction (typically a button or key press event) which triggered this call

 

Since: 2.8


ctk_window_close ()

void
ctk_window_close (CtkWindow *window);

Requests that the window is closed, similar to what happens when a window manager close button is clicked.

This function can be used with close buttons in custom titlebars.

Parameters

window

a CtkWindow

 

Since: 3.10


ctk_window_iconify ()

void
ctk_window_iconify (CtkWindow *window);

Asks to iconify (i.e. minimize) the specified window . Note that you shouldn’t assume the window is definitely iconified afterward, because other entities (e.g. the user or window manager) could deiconify it again, or there may not be a window manager in which case iconification isn’t possible, etc. But normally the window will end up iconified. Just don’t write code that crashes if not.

It’s permitted to call this function before showing a window, in which case the window will be iconified before it ever appears onscreen.

You can track iconification via the “window-state-event” signal on CtkWidget.

Parameters

window

a CtkWindow

 

ctk_window_deiconify ()

void
ctk_window_deiconify (CtkWindow *window);

Asks to deiconify (i.e. unminimize) the specified window . Note that you shouldn’t assume the window is definitely deiconified afterward, because other entities (e.g. the user or window manager)) could iconify it again before your code which assumes deiconification gets to run.

You can track iconification via the “window-state-event” signal on CtkWidget.

Parameters

window

a CtkWindow

 

ctk_window_stick ()

void
ctk_window_stick (CtkWindow *window);

Asks to stick window , which means that it will appear on all user desktops. Note that you shouldn’t assume the window is definitely stuck afterward, because other entities (e.g. the user or window manager could unstick it again, and some window managers do not support sticking windows. But normally the window will end up stuck. Just don't write code that crashes if not.

It’s permitted to call this function before showing a window.

You can track stickiness via the “window-state-event” signal on CtkWidget.

Parameters

window

a CtkWindow

 

ctk_window_unstick ()

void
ctk_window_unstick (CtkWindow *window);

Asks to unstick window , which means that it will appear on only one of the user’s desktops. Note that you shouldn’t assume the window is definitely unstuck afterward, because other entities (e.g. the user or window manager) could stick it again. But normally the window will end up stuck. Just don’t write code that crashes if not.

You can track stickiness via the “window-state-event” signal on CtkWidget.

Parameters

window

a CtkWindow

 

ctk_window_maximize ()

void
ctk_window_maximize (CtkWindow *window);

Asks to maximize window , so that it becomes full-screen. Note that you shouldn’t assume the window is definitely maximized afterward, because other entities (e.g. the user or window manager) could unmaximize it again, and not all window managers support maximization. But normally the window will end up maximized. Just don’t write code that crashes if not.

It’s permitted to call this function before showing a window, in which case the window will be maximized when it appears onscreen initially.

You can track maximization via the “window-state-event” signal on CtkWidget, or by listening to notifications on the “is-maximized” property.

Parameters

window

a CtkWindow

 

ctk_window_unmaximize ()

void
ctk_window_unmaximize (CtkWindow *window);

Asks to unmaximize window . Note that you shouldn’t assume the window is definitely unmaximized afterward, because other entities (e.g. the user or window manager) could maximize it again, and not all window managers honor requests to unmaximize. But normally the window will end up unmaximized. Just don’t write code that crashes if not.

You can track maximization via the “window-state-event” signal on CtkWidget.

Parameters

window

a CtkWindow

 

ctk_window_fullscreen ()

void
ctk_window_fullscreen (CtkWindow *window);

Asks to place window in the fullscreen state. Note that you shouldn’t assume the window is definitely full screen afterward, because other entities (e.g. the user or window manager) could unfullscreen it again, and not all window managers honor requests to fullscreen windows. But normally the window will end up fullscreen. Just don’t write code that crashes if not.

You can track the fullscreen state via the “window-state-event” signal on CtkWidget.

Parameters

window

a CtkWindow

 

Since: 2.2


ctk_window_fullscreen_on_monitor ()

void
ctk_window_fullscreen_on_monitor (CtkWindow *window,
                                  CdkScreen *screen,
                                  gint monitor);

Asks to place window in the fullscreen state. Note that you shouldn't assume the window is definitely full screen afterward.

You can track the fullscreen state via the "window-state-event" signal on CtkWidget.

Parameters

window

a CtkWindow

 

screen

a CdkScreen to draw to

 

monitor

which monitor to go fullscreen on

 

Since: 3.18


ctk_window_unfullscreen ()

void
ctk_window_unfullscreen (CtkWindow *window);

Asks to toggle off the fullscreen state for window . Note that you shouldn’t assume the window is definitely not full screen afterward, because other entities (e.g. the user or window manager) could fullscreen it again, and not all window managers honor requests to unfullscreen windows. But normally the window will end up restored to its normal state. Just don’t write code that crashes if not.

You can track the fullscreen state via the “window-state-event” signal on CtkWidget.

Parameters

window

a CtkWindow

 

Since: 2.2


ctk_window_set_keep_above ()

void
ctk_window_set_keep_above (CtkWindow *window,
                           gboolean setting);

Asks to keep window above, so that it stays on top. Note that you shouldn’t assume the window is definitely above afterward, because other entities (e.g. the user or window manager) could not keep it above, and not all window managers support keeping windows above. But normally the window will end kept above. Just don’t write code that crashes if not.

It’s permitted to call this function before showing a window, in which case the window will be kept above when it appears onscreen initially.

You can track the above state via the “window-state-event” signal on CtkWidget.

Note that, according to the Extended Window Manager Hints Specification, the above state is mainly meant for user preferences and should not be used by applications e.g. for drawing attention to their dialogs.

Parameters

window

a CtkWindow

 

setting

whether to keep window above other windows

 

Since: 2.4


ctk_window_set_keep_below ()

void
ctk_window_set_keep_below (CtkWindow *window,
                           gboolean setting);

Asks to keep window below, so that it stays in bottom. Note that you shouldn’t assume the window is definitely below afterward, because other entities (e.g. the user or window manager) could not keep it below, and not all window managers support putting windows below. But normally the window will be kept below. Just don’t write code that crashes if not.

It’s permitted to call this function before showing a window, in which case the window will be kept below when it appears onscreen initially.

You can track the below state via the “window-state-event” signal on CtkWidget.

Note that, according to the Extended Window Manager Hints Specification, the above state is mainly meant for user preferences and should not be used by applications e.g. for drawing attention to their dialogs.

Parameters

window

a CtkWindow

 

setting

whether to keep window below other windows

 

Since: 2.4


ctk_window_begin_resize_drag ()

void
ctk_window_begin_resize_drag (CtkWindow *window,
                              CdkWindowEdge edge,
                              gint button,
                              gint root_x,
                              gint root_y,
                              guint32 timestamp);

Starts resizing a window. This function is used if an application has window resizing controls. When CDK can support it, the resize will be done using the standard mechanism for the window manager or windowing system. Otherwise, CDK will try to emulate window resizing, potentially not all that well, depending on the windowing system.

Parameters

window

a CtkWindow

 

button

mouse button that initiated the drag

 

edge

position of the resize control

 

root_x

X position where the user clicked to initiate the drag, in root window coordinates

 

root_y

Y position where the user clicked to initiate the drag

 

timestamp

timestamp from the click event that initiated the drag

 

ctk_window_begin_move_drag ()

void
ctk_window_begin_move_drag (CtkWindow *window,
                            gint button,
                            gint root_x,
                            gint root_y,
                            guint32 timestamp);

Starts moving a window. This function is used if an application has window movement grips. When CDK can support it, the window movement will be done using the standard mechanism for the window manager or windowing system. Otherwise, CDK will try to emulate window movement, potentially not all that well, depending on the windowing system.

Parameters

window

a CtkWindow

 

button

mouse button that initiated the drag

 

root_x

X position where the user clicked to initiate the drag, in root window coordinates

 

root_y

Y position where the user clicked to initiate the drag

 

timestamp

timestamp from the click event that initiated the drag

 

ctk_window_set_decorated ()

void
ctk_window_set_decorated (CtkWindow *window,
                          gboolean setting);

By default, windows are decorated with a title bar, resize controls, etc. Some window managers allow CTK+ to disable these decorations, creating a borderless window. If you set the decorated property to FALSE using this function, CTK+ will do its best to convince the window manager not to decorate the window. Depending on the system, this function may not have any effect when called on a window that is already visible, so you should call it before calling ctk_widget_show().

On Windows, this function always works, since there’s no window manager policy involved.

Parameters

window

a CtkWindow

 

setting

TRUE to decorate the window

 

ctk_window_set_deletable ()

void
ctk_window_set_deletable (CtkWindow *window,
                          gboolean setting);

By default, windows have a close button in the window frame. Some window managers allow CTK+ to disable this button. If you set the deletable property to FALSE using this function, CTK+ will do its best to convince the window manager not to show a close button. Depending on the system, this function may not have any effect when called on a window that is already visible, so you should call it before calling ctk_widget_show().

On Windows, this function always works, since there’s no window manager policy involved.

Parameters

window

a CtkWindow

 

setting

TRUE to decorate the window as deletable

 

Since: 2.10


ctk_window_set_mnemonic_modifier ()

void
ctk_window_set_mnemonic_modifier (CtkWindow *window,
                                  CdkModifierType modifier);

Sets the mnemonic modifier for this window.

Parameters

window

a CtkWindow

 

modifier

the modifier mask used to activate mnemonics on this window.

 

ctk_window_set_type_hint ()

void
ctk_window_set_type_hint (CtkWindow *window,
                          CdkWindowTypeHint hint);

By setting the type hint for the window, you allow the window manager to decorate and handle the window in a way which is suitable to the function of the window in your application.

This function should be called before the window becomes visible.

ctk_dialog_new_with_buttons() and other convenience functions in CTK+ will sometimes call ctk_window_set_type_hint() on your behalf.

Parameters

window

a CtkWindow

 

hint

the window type

 

ctk_window_set_skip_taskbar_hint ()

void
ctk_window_set_skip_taskbar_hint (CtkWindow *window,
                                  gboolean setting);

Windows may set a hint asking the desktop environment not to display the window in the task bar. This function sets this hint.

Parameters

window

a CtkWindow

 

setting

TRUE to keep this window from appearing in the task bar

 

Since: 2.2


ctk_window_set_skip_pager_hint ()

void
ctk_window_set_skip_pager_hint (CtkWindow *window,
                                gboolean setting);

Windows may set a hint asking the desktop environment not to display the window in the pager. This function sets this hint. (A "pager" is any desktop navigation tool such as a workspace switcher that displays a thumbnail representation of the windows on the screen.)

Parameters

window

a CtkWindow

 

setting

TRUE to keep this window from appearing in the pager

 

Since: 2.2


ctk_window_set_urgency_hint ()

void
ctk_window_set_urgency_hint (CtkWindow *window,
                             gboolean setting);

Windows may set a hint asking the desktop environment to draw the users attention to the window. This function sets this hint.

Parameters

window

a CtkWindow

 

setting

TRUE to mark this window as urgent

 

Since: 2.8


ctk_window_set_accept_focus ()

void
ctk_window_set_accept_focus (CtkWindow *window,
                             gboolean setting);

Windows may set a hint asking the desktop environment not to receive the input focus. This function sets this hint.

Parameters

window

a CtkWindow

 

setting

TRUE to let this window receive input focus

 

Since: 2.4


ctk_window_set_focus_on_map ()

void
ctk_window_set_focus_on_map (CtkWindow *window,
                             gboolean setting);

Windows may set a hint asking the desktop environment not to receive the input focus when the window is mapped. This function sets this hint.

Parameters

window

a CtkWindow

 

setting

TRUE to let this window receive input focus on map

 

Since: 2.6


ctk_window_set_startup_id ()

void
ctk_window_set_startup_id (CtkWindow *window,
                           const gchar *startup_id);

Startup notification identifiers are used by desktop environment to track application startup, to provide user feedback and other features. This function changes the corresponding property on the underlying CdkWindow. Normally, startup identifier is managed automatically and you should only use this function in special cases like transferring focus from other processes. You should use this function before calling ctk_window_present() or any equivalent function generating a window map event.

This function is only useful on X11, not with other CTK+ targets.

Parameters

window

a CtkWindow

 

startup_id

a string with startup-notification identifier

 

Since: 2.12


ctk_window_set_role ()

void
ctk_window_set_role (CtkWindow *window,
                     const gchar *role);

This function is only useful on X11, not with other CTK+ targets.

In combination with the window title, the window role allows a window manager to identify "the same" window when an application is restarted. So for example you might set the “toolbox” role on your app’s toolbox window, so that when the user restarts their session, the window manager can put the toolbox back in the same place.

If a window already has a unique title, you don’t need to set the role, since the WM can use the title to identify the window when restoring the session.

Parameters

window

a CtkWindow

 

role

unique identifier for the window to be used when restoring a session

 

ctk_window_get_decorated ()

gboolean
ctk_window_get_decorated (CtkWindow *window);

Returns whether the window has been set to have decorations such as a title bar via ctk_window_set_decorated().

Parameters

window

a CtkWindow

 

Returns

TRUE if the window has been set to have decorations


ctk_window_get_deletable ()

gboolean
ctk_window_get_deletable (CtkWindow *window);

Returns whether the window has been set to have a close button via ctk_window_set_deletable().

Parameters

window

a CtkWindow

 

Returns

TRUE if the window has been set to have a close button

Since: 2.10


ctk_window_get_default_icon_list ()

GList *
ctk_window_get_default_icon_list (void);

Gets the value set by ctk_window_set_default_icon_list(). The list is a copy and should be freed with g_list_free(), but the pixbufs in the list have not had their reference count incremented.

Returns

copy of default icon list.

[element-type GdkPixbuf][transfer container]


ctk_window_get_default_icon_name ()

const gchar *
ctk_window_get_default_icon_name (void);

Returns the fallback icon name for windows that has been set with ctk_window_set_default_icon_name(). The returned string is owned by CTK+ and should not be modified. It is only valid until the next call to ctk_window_set_default_icon_name().

Returns

the fallback icon name for windows

Since: 2.16


ctk_window_get_default_size ()

void
ctk_window_get_default_size (CtkWindow *window,
                             gint *width,
                             gint *height);

Gets the default size of the window. A value of -1 for the width or height indicates that a default size has not been explicitly set for that dimension, so the “natural” size of the window will be used.

Parameters

window

a CtkWindow

 

width

location to store the default width, or NULL.

[out][allow-none]

height

location to store the default height, or NULL.

[out][allow-none]

ctk_window_get_destroy_with_parent ()

gboolean
ctk_window_get_destroy_with_parent (CtkWindow *window);

Returns whether the window will be destroyed with its transient parent. See ctk_window_set_destroy_with_parent().

Parameters

window

a CtkWindow

 

Returns

TRUE if the window will be destroyed with its transient parent.


ctk_window_get_hide_titlebar_when_maximized ()

gboolean
ctk_window_get_hide_titlebar_when_maximized
                               (CtkWindow *window);

Returns whether the window has requested to have its titlebar hidden when maximized. See ctk_window_set_hide_titlebar_when_maximized().

Parameters

window

a CtkWindow

 

Returns

TRUE if the window has requested to have its titlebar hidden when maximized

Since: 3.4


ctk_window_get_icon ()

GdkPixbuf *
ctk_window_get_icon (CtkWindow *window);

Gets the value set by ctk_window_set_icon() (or if you've called ctk_window_set_icon_list(), gets the first icon in the icon list).

Parameters

window

a CtkWindow

 

Returns

icon for window or NULL if none.

[transfer none][nullable]


ctk_window_get_icon_list ()

GList *
ctk_window_get_icon_list (CtkWindow *window);

Retrieves the list of icons set by ctk_window_set_icon_list(). The list is copied, but the reference count on each member won’t be incremented.

Parameters

window

a CtkWindow

 

Returns

copy of window’s icon list.

[element-type GdkPixbuf][transfer container]


ctk_window_get_icon_name ()

const gchar *
ctk_window_get_icon_name (CtkWindow *window);

Returns the name of the themed icon for the window, see ctk_window_set_icon_name().

Parameters

window

a CtkWindow

 

Returns

the icon name or NULL if the window has no themed icon.

[nullable]

Since: 2.6


ctk_window_get_mnemonic_modifier ()

CdkModifierType
ctk_window_get_mnemonic_modifier (CtkWindow *window);

Returns the mnemonic modifier for this window. See ctk_window_set_mnemonic_modifier().

Parameters

window

a CtkWindow

 

Returns

the modifier mask used to activate mnemonics on this window.


ctk_window_get_modal ()

gboolean
ctk_window_get_modal (CtkWindow *window);

Returns whether the window is modal. See ctk_window_set_modal().

Parameters

window

a CtkWindow

 

Returns

TRUE if the window is set to be modal and establishes a grab when shown


ctk_window_get_position ()

void
ctk_window_get_position (CtkWindow *window,
                         gint *root_x,
                         gint *root_y);

This function returns the position you need to pass to ctk_window_move() to keep window in its current position. This means that the meaning of the returned value varies with window gravity. See ctk_window_move() for more details.

The reliability of this function depends on the windowing system currently in use. Some windowing systems, such as Wayland, do not support a global coordinate system, and thus the position of the window will always be (0, 0). Others, like X11, do not have a reliable way to obtain the geometry of the decorations of a window if they are provided by the window manager. Additionally, on X11, window manager have been known to mismanage window gravity, which result in windows moving even if you use the coordinates of the current position as returned by this function.

If you haven’t changed the window gravity, its gravity will be CDK_GRAVITY_NORTH_WEST. This means that ctk_window_get_position() gets the position of the top-left corner of the window manager frame for the window. ctk_window_move() sets the position of this same top-left corner.

If a window has gravity CDK_GRAVITY_STATIC the window manager frame is not relevant, and thus ctk_window_get_position() will always produce accurate results. However you can’t use static gravity to do things like place a window in a corner of the screen, because static gravity ignores the window manager decorations.

Ideally, this function should return appropriate values if the window has client side decorations, assuming that the windowing system supports global coordinates.

In practice, saving the window position should not be left to applications, as they lack enough knowledge of the windowing system and the window manager state to effectively do so. The appropriate way to implement saving the window position is to use a platform-specific protocol, wherever that is available.

Parameters

window

a CtkWindow

 

root_x

return location for X coordinate of gravity-determined reference point, or NULL.

[out][allow-none]

root_y

return location for Y coordinate of gravity-determined reference point, or NULL.

[out][allow-none]

ctk_window_get_role ()

const gchar *
ctk_window_get_role (CtkWindow *window);

Returns the role of the window. See ctk_window_set_role() for further explanation.

Parameters

window

a CtkWindow

 

Returns

the role of the window if set, or NULL. The returned is owned by the widget and must not be modified or freed.

[nullable]


ctk_window_get_size ()

void
ctk_window_get_size (CtkWindow *window,
                     gint *width,
                     gint *height);

Obtains the current size of window .

If window is not visible on screen, this function return the size CTK+ will suggest to the window manager for the initial window size (but this is not reliably the same as the size the window manager will actually select). See: ctk_window_set_default_size().

Depending on the windowing system and the window manager constraints, the size returned by this function may not match the size set using ctk_window_resize(); additionally, since ctk_window_resize() may be implemented as an asynchronous operation, CTK+ cannot guarantee in any way that this code:

1
2
3
4
5
// width and height are set elsewhere
ctk_window_resize (window, width, height);

int new_width, new_height;
ctk_window_get_size (window, &new_width, &new_height);

will result in new_width and new_height matching width and height, respectively.

This function will return the logical size of the CtkWindow, excluding the widgets used in client side decorations; there is, however, no guarantee that the result will be completely accurate because client side decoration may include widgets that depend on the user preferences and that may not be visibile at the time you call this function.

The dimensions returned by this function are suitable for being stored across sessions; use ctk_window_set_default_size() to restore them when before showing the window.

To avoid potential race conditions, you should only call this function in response to a size change notification, for instance inside a handler for the “size-allocate” signal, or inside a handler for the “configure-event” signal:

1
2
3
4
5
6
7
8
9
static void
on_size_allocate (CtkWidget *widget, CtkAllocation *allocation)
{
  int new_width, new_height;

  ctk_window_get_size (CTK_WINDOW (widget), &new_width, &new_height);

  ...
}

Note that, if you connect to the “size-allocate” signal, you should not use the dimensions of the CtkAllocation passed to the signal handler, as the allocation may contain client side decorations added by CTK+, depending on the windowing system in use.

If you are getting a window size in order to position the window on the screen, you should, instead, simply set the window’s semantic type with ctk_window_set_type_hint(), which allows the window manager to e.g. center dialogs. Also, if you set the transient parent of dialogs with ctk_window_set_transient_for() window managers will often center the dialog over its parent window. It's much preferred to let the window manager handle these cases rather than doing it yourself, because all apps will behave consistently and according to user or system preferences, if the window manager handles it. Also, the window manager can take into account the size of the window decorations and border that it may add, and of which CTK+ has no knowledge. Additionally, positioning windows in global screen coordinates may not be allowed by the windowing system. For more information, see: ctk_window_set_position().

Parameters

window

a CtkWindow

 

width

return location for width, or NULL.

[out][nullable]

height

return location for height, or NULL.

[out][nullable]

ctk_window_get_title ()

const gchar *
ctk_window_get_title (CtkWindow *window);

Retrieves the title of the window. See ctk_window_set_title().

Parameters

window

a CtkWindow

 

Returns

the title of the window, or NULL if none has been set explicitly. The returned string is owned by the widget and must not be modified or freed.

[nullable]


ctk_window_get_transient_for ()

CtkWindow *
ctk_window_get_transient_for (CtkWindow *window);

Fetches the transient parent for this window. See ctk_window_set_transient_for().

Parameters

window

a CtkWindow

 

Returns

the transient parent for this window, or NULL if no transient parent has been set.

[nullable][transfer none]


ctk_window_get_attached_to ()

CtkWidget *
ctk_window_get_attached_to (CtkWindow *window);

Fetches the attach widget for this window. See ctk_window_set_attached_to().

Parameters

window

a CtkWindow

 

Returns

the widget where the window is attached, or NULL if the window is not attached to any widget.

[nullable][transfer none]

Since: 3.4


ctk_window_get_type_hint ()

CdkWindowTypeHint
ctk_window_get_type_hint (CtkWindow *window);

Gets the type hint for this window. See ctk_window_set_type_hint().

Parameters

window

a CtkWindow

 

Returns

the type hint for window .


ctk_window_get_skip_taskbar_hint ()

gboolean
ctk_window_get_skip_taskbar_hint (CtkWindow *window);

Gets the value set by ctk_window_set_skip_taskbar_hint()

Parameters

window

a CtkWindow

 

Returns

TRUE if window shouldn’t be in taskbar

Since: 2.2


ctk_window_get_skip_pager_hint ()

gboolean
ctk_window_get_skip_pager_hint (CtkWindow *window);

Gets the value set by ctk_window_set_skip_pager_hint().

Parameters

window

a CtkWindow

 

Returns

TRUE if window shouldn’t be in pager

Since: 2.2


ctk_window_get_urgency_hint ()

gboolean
ctk_window_get_urgency_hint (CtkWindow *window);

Gets the value set by ctk_window_set_urgency_hint()

Parameters

window

a CtkWindow

 

Returns

TRUE if window is urgent

Since: 2.8


ctk_window_get_accept_focus ()

gboolean
ctk_window_get_accept_focus (CtkWindow *window);

Gets the value set by ctk_window_set_accept_focus().

Parameters

window

a CtkWindow

 

Returns

TRUE if window should receive the input focus

Since: 2.4


ctk_window_get_focus_on_map ()

gboolean
ctk_window_get_focus_on_map (CtkWindow *window);

Gets the value set by ctk_window_set_focus_on_map().

Parameters

window

a CtkWindow

 

Returns

TRUE if window should receive the input focus when mapped.

Since: 2.6


ctk_window_get_group ()

CtkWindowGroup *
ctk_window_get_group (CtkWindow *window);

Returns the group for window or the default group, if window is NULL or if window does not have an explicit window group.

Parameters

window

a CtkWindow, or NULL.

[allow-none]

Returns

the CtkWindowGroup for a window or the default group.

[transfer none]

Since: 2.10


ctk_window_has_group ()

gboolean
ctk_window_has_group (CtkWindow *window);

Returns whether window has an explicit window group.

Parameters

window

a CtkWindow

 

Returns

TRUE if window has an explicit window group.

Since 2.22


ctk_window_get_window_type ()

CtkWindowType
ctk_window_get_window_type (CtkWindow *window);

Gets the type of the window. See CtkWindowType.

Parameters

window

a CtkWindow

 

Returns

the type of the window

Since: 2.20


ctk_window_move ()

void
ctk_window_move (CtkWindow *window,
                 gint x,
                 gint y);

Asks the window manager to move window to the given position. Window managers are free to ignore this; most window managers ignore requests for initial window positions (instead using a user-defined placement algorithm) and honor requests after the window has already been shown.

Note: the position is the position of the gravity-determined reference point for the window. The gravity determines two things: first, the location of the reference point in root window coordinates; and second, which point on the window is positioned at the reference point.

By default the gravity is CDK_GRAVITY_NORTH_WEST, so the reference point is simply the x , y supplied to ctk_window_move(). The top-left corner of the window decorations (aka window frame or border) will be placed at x , y . Therefore, to position a window at the top left of the screen, you want to use the default gravity (which is CDK_GRAVITY_NORTH_WEST) and move the window to 0,0.

To position a window at the bottom right corner of the screen, you would set CDK_GRAVITY_SOUTH_EAST, which means that the reference point is at x + the window width and y + the window height, and the bottom-right corner of the window border will be placed at that reference point. So, to place a window in the bottom right corner you would first set gravity to south east, then write: ctk_window_move (window, cdk_screen_width() - window_width, cdk_screen_height() - window_height) (note that this example does not take multi-head scenarios into account).

The Extended Window Manager Hints Specification has a nice table of gravities in the “implementation notes” section.

The ctk_window_get_position() documentation may also be relevant.

Parameters

window

a CtkWindow

 

x

X coordinate to move window to

 

y

Y coordinate to move window to

 

ctk_window_parse_geometry ()

gboolean
ctk_window_parse_geometry (CtkWindow *window,
                           const gchar *geometry);

Parses a standard X Window System geometry string - see the manual page for X (type “man X”) for details on this. ctk_window_parse_geometry() does work on all CTK+ ports including Win32 but is primarily intended for an X environment.

If either a size or a position can be extracted from the geometry string, ctk_window_parse_geometry() returns TRUE and calls ctk_window_set_default_size() and/or ctk_window_move() to resize/move the window.

If ctk_window_parse_geometry() returns TRUE, it will also set the CDK_HINT_USER_POS and/or CDK_HINT_USER_SIZE hints indicating to the window manager that the size/position of the window was user-specified. This causes most window managers to honor the geometry.

Note that for ctk_window_parse_geometry() to work as expected, it has to be called when the window has its “final” size, i.e. after calling ctk_widget_show_all() on the contents and ctk_window_set_geometry_hints() on the window.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <ctk/ctk.h>

static void
fill_with_content (CtkWidget *vbox)
{
  // fill with content...
}

int
main (int argc, char *argv[])
{
  CtkWidget *window, *vbox;
  CdkGeometry size_hints = {
    100, 50, 0, 0, 100, 50, 10,
    10, 0.0, 0.0, CDK_GRAVITY_NORTH_WEST
  };

  ctk_init (&argc, &argv);

  window = ctk_window_new (CTK_WINDOW_TOPLEVEL);
  vbox = ctk_box_new (CTK_ORIENTATION_VERTICAL, 0);

  ctk_container_add (CTK_CONTAINER (window), vbox);
  fill_with_content (vbox);
  ctk_widget_show_all (vbox);

  ctk_window_set_geometry_hints (CTK_WINDOW (window),
	  			    NULL,
				    &size_hints,
				    CDK_HINT_MIN_SIZE |
				    CDK_HINT_BASE_SIZE |
				    CDK_HINT_RESIZE_INC);

  if (argc > 1)
    {
      gboolean res;
      res = ctk_window_parse_geometry (CTK_WINDOW (window),
                                       argv[1]);
      if (! res)
        fprintf (stderr,
                 "Failed to parse “%s”\n",
                 argv[1]);
    }

  ctk_widget_show_all (window);
  ctk_main ();

  return 0;
}

Parameters

window

a CtkWindow

 

geometry

geometry string

 

Returns

TRUE if string was parsed successfully


ctk_window_reshow_with_initial_size ()

void
ctk_window_reshow_with_initial_size (CtkWindow *window);

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

GUI builders can call ctk_widget_hide(), ctk_widget_unrealize() and then ctk_widget_show() on window themselves, if they still need this functionality.

Hides window , then reshows it, resetting the default size and position of the window. Used by GUI builders only.

Parameters

window

a CtkWindow

 

ctk_window_resize ()

void
ctk_window_resize (CtkWindow *window,
                   gint width,
                   gint height);

Resizes the window as if the user had done so, obeying geometry constraints. The default geometry constraint is that windows may not be smaller than their size request; to override this constraint, call ctk_widget_set_size_request() to set the window's request to a smaller value.

If ctk_window_resize() is called before showing a window for the first time, it overrides any default size set with ctk_window_set_default_size().

Windows may not be resized smaller than 1 by 1 pixels.

When using client side decorations, CTK+ will do its best to adjust the given size so that the resulting window size matches the requested size without the title bar, borders and shadows added for the client side decorations, but there is no guarantee that the result will be totally accurate because these widgets added for client side decorations depend on the theme and may not be realized or visible at the time ctk_window_resize() is issued.

If the CtkWindow has a titlebar widget (see ctk_window_set_titlebar()), then typically, ctk_window_resize() will compensate for the height of the titlebar widget only if the height is known when the resulting CtkWindow configuration is issued. For example, if new widgets are added after the CtkWindow configuration and cause the titlebar widget to grow in height, this will result in a window content smaller that specified by ctk_window_resize() and not a larger window.

Parameters

window

a CtkWindow

 

width

width in pixels to resize the window to

 

height

height in pixels to resize the window to

 

ctk_window_resize_to_geometry ()

void
ctk_window_resize_to_geometry (CtkWindow *window,
                               gint width,
                               gint height);

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

This function does nothing. Use ctk_window_resize() and compute the geometry yourself.

Like ctk_window_resize(), but width and height are interpreted in terms of the base size and increment set with ctk_window_set_geometry_hints.

Parameters

window

a CtkWindow

 

width

width in resize increments to resize the window to

 

height

height in resize increments to resize the window to

 

Since: 3.0


ctk_window_set_default_icon_list ()

void
ctk_window_set_default_icon_list (GList *list);

Sets an icon list to be used as fallback for windows that haven't had ctk_window_set_icon_list() called on them to set up a window-specific icon list. This function allows you to set up the icon for all windows in your app at once.

See ctk_window_set_icon_list() for more details.

Parameters

list

a list of GdkPixbuf.

[element-type GdkPixbuf][transfer container]

ctk_window_set_default_icon ()

void
ctk_window_set_default_icon (GdkPixbuf *icon);

Sets an icon to be used as fallback for windows that haven't had ctk_window_set_icon() called on them from a pixbuf.

Parameters

icon

the icon

 

Since: 2.4


ctk_window_set_default_icon_from_file ()

gboolean
ctk_window_set_default_icon_from_file (const gchar *filename,
                                       GError **err);

Sets an icon to be used as fallback for windows that haven't had ctk_window_set_icon_list() called on them from a file on disk. Warns on failure if err is NULL.

Parameters

filename

location of icon file.

[type filename]

err

location to store error, or NULL.

[allow-none]

Returns

TRUE if setting the icon succeeded.

Since: 2.2


ctk_window_set_default_icon_name ()

void
ctk_window_set_default_icon_name (const gchar *name);

Sets an icon to be used as fallback for windows that haven't had ctk_window_set_icon_list() called on them from a named themed icon, see ctk_window_set_icon_name().

Parameters

name

the name of the themed icon

 

Since: 2.6


ctk_window_set_icon ()

void
ctk_window_set_icon (CtkWindow *window,
                     GdkPixbuf *icon);

Sets up the icon representing a CtkWindow. This icon is used when the window is minimized (also known as iconified). Some window managers or desktop environments may also place it in the window frame, or display it in other contexts. On others, the icon is not used at all, so your mileage may vary.

The icon should be provided in whatever size it was naturally drawn; that is, don’t scale the image before passing it to CTK+. Scaling is postponed until the last minute, when the desired final size is known, to allow best quality.

If you have your icon hand-drawn in multiple sizes, use ctk_window_set_icon_list(). Then the best size will be used.

This function is equivalent to calling ctk_window_set_icon_list() with a 1-element list.

See also ctk_window_set_default_icon_list() to set the icon for all windows in your application in one go.

Parameters

window

a CtkWindow

 

icon

icon image, or NULL.

[allow-none]

ctk_window_set_icon_list ()

void
ctk_window_set_icon_list (CtkWindow *window,
                          GList *list);

Sets up the icon representing a CtkWindow. The icon is used when the window is minimized (also known as iconified). Some window managers or desktop environments may also place it in the window frame, or display it in other contexts. On others, the icon is not used at all, so your mileage may vary.

ctk_window_set_icon_list() allows you to pass in the same icon in several hand-drawn sizes. The list should contain the natural sizes your icon is available in; that is, don’t scale the image before passing it to CTK+. Scaling is postponed until the last minute, when the desired final size is known, to allow best quality.

By passing several sizes, you may improve the final image quality of the icon, by reducing or eliminating automatic image scaling.

Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and larger images (64x64, 128x128) if you have them.

See also ctk_window_set_default_icon_list() to set the icon for all windows in your application in one go.

Note that transient windows (those who have been set transient for another window using ctk_window_set_transient_for()) will inherit their icon from their transient parent. So there’s no need to explicitly set the icon on transient windows.

Parameters

window

a CtkWindow

 

list

list of GdkPixbuf.

[element-type GdkPixbuf]

ctk_window_set_icon_from_file ()

gboolean
ctk_window_set_icon_from_file (CtkWindow *window,
                               const gchar *filename,
                               GError **err);

Sets the icon for window . Warns on failure if err is NULL.

This function is equivalent to calling ctk_window_set_icon() with a pixbuf created by loading the image from filename .

Parameters

window

a CtkWindow

 

filename

location of icon file.

[type filename]

err

location to store error, or NULL.

[allow-none]

Returns

TRUE if setting the icon succeeded.

Since: 2.2


ctk_window_set_icon_name ()

void
ctk_window_set_icon_name (CtkWindow *window,
                          const gchar *name);

Sets the icon for the window from a named themed icon. See the docs for CtkIconTheme for more details. On some platforms, the window icon is not used at all.

Note that this has nothing to do with the WM_ICON_NAME property which is mentioned in the ICCCM.

Parameters

window

a CtkWindow

 

name

the name of the themed icon.

[allow-none]

Since: 2.6


ctk_window_set_auto_startup_notification ()

void
ctk_window_set_auto_startup_notification
                               (gboolean setting);

By default, after showing the first CtkWindow, CTK+ calls cdk_notify_startup_complete(). Call this function to disable the automatic startup notification. You might do this if your first window is a splash screen, and you want to delay notification until after your real main window has been shown, for example.

In that example, you would disable startup notification temporarily, show your splash screen, then re-enable it so that showing the main window would automatically result in notification.

Parameters

setting

TRUE to automatically do startup notification

 

Since: 2.2


ctk_window_get_opacity ()

gdouble
ctk_window_get_opacity (CtkWindow *window);

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

Use ctk_widget_get_opacity instead.

Fetches the requested opacity for this window. See ctk_window_set_opacity().

Parameters

window

a CtkWindow

 

Returns

the requested opacity for this window.

Since: 2.12


ctk_window_set_opacity ()

void
ctk_window_set_opacity (CtkWindow *window,
                        gdouble opacity);

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

Use ctk_widget_set_opacity instead.

Request the windowing system to make window partially transparent, with opacity 0 being fully transparent and 1 fully opaque. (Values of the opacity parameter are clamped to the [0,1] range.) On X11 this has any effect only on X screens with a compositing manager running. See ctk_widget_is_composited(). On Windows it should work always.

Note that setting a window’s opacity after the window has been shown causes it to flicker once on Windows.

Parameters

window

a CtkWindow

 

opacity

desired opacity, between 0 and 1

 

Since: 2.12


ctk_window_get_mnemonics_visible ()

gboolean
ctk_window_get_mnemonics_visible (CtkWindow *window);

Gets the value of the “mnemonics-visible” property.

Parameters

window

a CtkWindow

 

Returns

TRUE if mnemonics are supposed to be visible in this window.

Since: 2.20


ctk_window_set_mnemonics_visible ()

void
ctk_window_set_mnemonics_visible (CtkWindow *window,
                                  gboolean setting);

Sets the “mnemonics-visible” property.

Parameters

window

a CtkWindow

 

setting

the new value

 

Since: 2.20


ctk_window_get_focus_visible ()

gboolean
ctk_window_get_focus_visible (CtkWindow *window);

Gets the value of the “focus-visible” property.

Parameters

window

a CtkWindow

 

Returns

TRUE if “focus rectangles” are supposed to be visible in this window.

Since: 3.2


ctk_window_set_focus_visible ()

void
ctk_window_set_focus_visible (CtkWindow *window,
                              gboolean setting);

Sets the “focus-visible” property.

Parameters

window

a CtkWindow

 

setting

the new value

 

Since: 3.2


ctk_window_set_has_resize_grip ()

void
ctk_window_set_has_resize_grip (CtkWindow *window,
                                gboolean value);

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

Resize grips have been removed.

Sets whether window has a corner resize grip.

Note that the resize grip is only shown if the window is actually resizable and not maximized. Use ctk_window_resize_grip_is_visible() to find out if the resize grip is currently shown.

Parameters

window

a CtkWindow

 

value

TRUE to allow a resize grip

 

Since: 3.0


ctk_window_get_has_resize_grip ()

gboolean
ctk_window_get_has_resize_grip (CtkWindow *window);

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

Resize grips have been removed.

Determines whether the window may have a resize grip.

Parameters

window

a CtkWindow

 

Returns

TRUE if the window has a resize grip

Since: 3.0


ctk_window_resize_grip_is_visible ()

gboolean
ctk_window_resize_grip_is_visible (CtkWindow *window);

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

Resize grips have been removed.

Determines whether a resize grip is visible for the specified window.

Parameters

window

a CtkWindow

 

Returns

TRUE if a resize grip exists and is visible

Since: 3.0


ctk_window_get_resize_grip_area ()

gboolean
ctk_window_get_resize_grip_area (CtkWindow *window,
                                 CdkRectangle *rect);

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

Resize grips have been removed.

If a window has a resize grip, this will retrieve the grip position, width and height into the specified CdkRectangle.

Parameters

window

a CtkWindow

 

rect

a pointer to a CdkRectangle which we should store the resize grip area.

[out]

Returns

TRUE if the resize grip’s area was retrieved

Since: 3.0


ctk_window_get_application ()

CtkApplication *
ctk_window_get_application (CtkWindow *window);

Gets the CtkApplication associated with the window (if any).

Parameters

window

a CtkWindow

 

Returns

a CtkApplication, or NULL.

[nullable][transfer none]

Since: 3.0


ctk_window_set_application ()

void
ctk_window_set_application (CtkWindow *window,
                            CtkApplication *application);

Sets or unsets the CtkApplication associated with the window.

The application will be kept alive for at least as long as it has any windows associated with it (see g_application_hold() for a way to keep it alive without windows).

Normally, the connection between the application and the window will remain until the window is destroyed, but you can explicitly remove it by setting the application to NULL.

This is equivalent to calling ctk_application_remove_window() and/or ctk_application_add_window() on the old/new applications as relevant.

Parameters

window

a CtkWindow

 

application

a CtkApplication, or NULL to unset.

[allow-none]

Since: 3.0


ctk_window_set_has_user_ref_count ()

void
ctk_window_set_has_user_ref_count (CtkWindow *window,
                                   gboolean setting);

Tells CTK+ whether to drop its extra reference to the window when ctk_widget_destroy() is called.

This function is only exported for the benefit of language bindings which may need to keep the window alive until their wrapper object is garbage collected. There is no justification for ever calling this function in an application.

Parameters

window

a CtkWindow

 

setting

the new value

 

Since: 3.0


ctk_window_set_titlebar ()

void
ctk_window_set_titlebar (CtkWindow *window,
                         CtkWidget *titlebar);

Sets a custom titlebar for window .

A typical widget used here is CtkHeaderBar, as it provides various features expected of a titlebar while allowing the addition of child widgets to it.

If you set a custom titlebar, CTK+ will do its best to convince the window manager not to put its own titlebar on the window. Depending on the system, this function may not work for a window that is already visible, so you set the titlebar before calling ctk_widget_show().

Parameters

window

a CtkWindow

 

titlebar

the widget to use as titlebar.

[allow-none]

Since: 3.10


ctk_window_get_titlebar ()

CtkWidget *
ctk_window_get_titlebar (CtkWindow *window);

Returns the custom titlebar that has been set with ctk_window_set_titlebar().

Parameters

window

a CtkWindow

 

Returns

the custom titlebar, or NULL.

[nullable][transfer none]

Since: 3.16


ctk_window_set_interactive_debugging ()

void
ctk_window_set_interactive_debugging (gboolean enable);

Opens or closes the interactive debugger, which offers access to the widget hierarchy of the application and to useful debugging tools.

Parameters

enable

TRUE to enable interactive debugging

 

Since: 3.14

Types and Values

CtkWindow

typedef struct _CtkWindow CtkWindow;

struct CtkWindowClass

struct CtkWindowClass {
  CtkBinClass parent_class;

  void     (* set_focus)   (CtkWindow *window,
                            CtkWidget *focus);

  /* G_SIGNAL_ACTION signals for keybindings */

  void     (* activate_focus)   (CtkWindow *window);
  void     (* activate_default) (CtkWindow *window);
  void	   (* keys_changed)     (CtkWindow *window);
  gboolean (* enable_debugging) (CtkWindow *window,
                                 gboolean   toggle);
};

Members

set_focus ()

Sets child as the focus widget for the window.

 

activate_focus ()

Activates the current focused widget within the window.

 

activate_default ()

Activates the default widget for the window.

 

keys_changed ()

Signal gets emitted when the set of accelerators or mnemonics that are associated with window changes.

 

enable_debugging ()

Class handler for the “enable-debugging” keybinding signal. Since: 3.14

 

enum CtkWindowType

A CtkWindow can be one of these types. Most things you’d consider a “window” should have type CTK_WINDOW_TOPLEVEL; windows with this type are managed by the window manager and have a frame by default (call ctk_window_set_decorated() to toggle the frame). Windows with type CTK_WINDOW_POPUP are ignored by the window manager; window manager keybindings won’t work on them, the window manager won’t decorate the window with a frame, many CTK+ features that rely on the window manager will not work (e.g. resize grips and maximization/minimization). CTK_WINDOW_POPUP is used to implement widgets such as CtkMenu or tooltips that you normally don’t think of as windows per se. Nearly all windows should be CTK_WINDOW_TOPLEVEL. In particular, do not use CTK_WINDOW_POPUP just to turn off the window borders; use ctk_window_set_decorated() for that.

Members

CTK_WINDOW_TOPLEVEL

A regular window, such as a dialog.

 

CTK_WINDOW_POPUP

A special window such as a tooltip.

 

enum CtkWindowPosition

Window placement can be influenced using this enumeration. Note that using CTK_WIN_POS_CENTER_ALWAYS is almost always a bad idea. It won’t necessarily work well with all window managers or on all windowing systems.

Members

CTK_WIN_POS_NONE

No influence is made on placement.

 

CTK_WIN_POS_CENTER

Windows should be placed in the center of the screen.

 

CTK_WIN_POS_MOUSE

Windows should be placed at the current mouse position.

 

CTK_WIN_POS_CENTER_ALWAYS

Keep window centered as it changes size, etc.

 

CTK_WIN_POS_CENTER_ON_PARENT

Center the window on its transient parent (see ctk_window_set_transient_for()).

 

Property Details

The “accept-focus” property

  “accept-focus”             gboolean

Whether the window should receive the input focus.

Owner: CtkWindow

Flags: Read / Write

Default value: TRUE

Since: 2.4


The “application” property

  “application”              CtkApplication *

The CtkApplication associated with the window.

The application will be kept alive for at least as long as it has any windows associated with it (see g_application_hold() for a way to keep it alive without windows).

Normally, the connection between the application and the window will remain until the window is destroyed, but you can explicitly remove it by setting the :application property to NULL.

Owner: CtkWindow

Flags: Read / Write

Since: 3.0


The “attached-to” property

  “attached-to”              CtkWidget *

The widget to which this window is attached. See ctk_window_set_attached_to().

Examples of places where specifying this relation is useful are for instance a CtkMenu created by a CtkComboBox, a completion popup window created by CtkEntry or a typeahead search entry created by CtkTreeView.

Owner: CtkWindow

Flags: Read / Write / Construct

Since: 3.4


The “decorated” property

  “decorated”                gboolean

Whether the window should be decorated by the window manager.

Owner: CtkWindow

Flags: Read / Write

Default value: TRUE

Since: 2.4


The “default-height” property

  “default-height”           int

The default height of the window, used when initially showing the window.

Owner: CtkWindow

Flags: Read / Write

Allowed values: >= -1

Default value: -1


The “default-width” property

  “default-width”            int

The default width of the window, used when initially showing the window.

Owner: CtkWindow

Flags: Read / Write

Allowed values: >= -1

Default value: -1


The “deletable” property

  “deletable”                gboolean

Whether the window frame should have a close button.

Owner: CtkWindow

Flags: Read / Write

Default value: TRUE

Since: 2.10


The “destroy-with-parent” property

  “destroy-with-parent”      gboolean

If this window should be destroyed when the parent is destroyed.

Owner: CtkWindow

Flags: Read / Write

Default value: FALSE


The “focus-on-map” property

  “focus-on-map”             gboolean

Whether the window should receive the input focus when mapped.

Owner: CtkWindow

Flags: Read / Write

Default value: TRUE

Since: 2.6


The “focus-visible” property

  “focus-visible”            gboolean

Whether 'focus rectangles' are currently visible in this window.

This property is maintained by CTK+ based on user input and should not be set by applications.

Owner: CtkWindow

Flags: Read / Write

Default value: TRUE

Since: 2.20


The “gravity” property

  “gravity”                  CdkGravity

The window gravity of the window. See ctk_window_move() and CdkGravity for more details about window gravity.

Owner: CtkWindow

Flags: Read / Write

Default value: CDK_GRAVITY_NORTH_WEST

Since: 2.4


The “has-resize-grip” property

  “has-resize-grip”          gboolean

Whether the window has a corner resize grip.

Note that the resize grip is only shown if the window is actually resizable and not maximized. Use “resize-grip-visible” to find out if the resize grip is currently shown.

CtkWindow:has-resize-grip has been deprecated since version 3.14 and should not be used in newly-written code.

Resize grips have been removed.

Owner: CtkWindow

Flags: Read / Write

Default value: FALSE

Since: 3.0


The “has-toplevel-focus” property

  “has-toplevel-focus”       gboolean

Whether the input focus is within this CtkWindow.

Owner: CtkWindow

Flags: Read

Default value: FALSE


The “hide-titlebar-when-maximized” property

  “hide-titlebar-when-maximized” gboolean

Whether the titlebar should be hidden during maximization.

Owner: CtkWindow

Flags: Read / Write

Default value: FALSE

Since: 3.4


The “icon” property

  “icon”                     GdkPixbuf *

Icon for this window.

Owner: CtkWindow

Flags: Read / Write


The “icon-name” property

  “icon-name”                char *

The :icon-name property specifies the name of the themed icon to use as the window icon. See CtkIconTheme for more details.

Owner: CtkWindow

Flags: Read / Write

Default value: NULL

Since: 2.6


The “is-active” property

  “is-active”                gboolean

Whether the toplevel is the current active window.

Owner: CtkWindow

Flags: Read

Default value: FALSE


The “is-maximized” property

  “is-maximized”             gboolean

Whether the window is maximized.

Owner: CtkWindow

Flags: Read

Default value: FALSE


The “mnemonics-visible” property

  “mnemonics-visible”        gboolean

Whether mnemonics are currently visible in this window.

This property is maintained by CTK+ based on user input, and should not be set by applications.

Owner: CtkWindow

Flags: Read / Write

Default value: TRUE

Since: 2.20


The “modal” property

  “modal”                    gboolean

If TRUE, the window is modal (other windows are not usable while this one is up).

Owner: CtkWindow

Flags: Read / Write

Default value: FALSE


The “resizable” property

  “resizable”                gboolean

If TRUE, users can resize the window.

Owner: CtkWindow

Flags: Read / Write

Default value: TRUE


The “resize-grip-visible” property

  “resize-grip-visible”      gboolean

Whether a corner resize grip is currently shown.

CtkWindow:resize-grip-visible has been deprecated since version 3.14 and should not be used in newly-written code.

Resize grips have been removed.

Owner: CtkWindow

Flags: Read

Default value: FALSE

Since: 3.0


The “role” property

  “role”                     char *

Unique identifier for the window to be used when restoring a session.

Owner: CtkWindow

Flags: Read / Write

Default value: NULL


The “screen” property

  “screen”                   CdkScreen *

The screen where this window will be displayed.

Owner: CtkWindow

Flags: Read / Write


The “skip-pager-hint” property

  “skip-pager-hint”          gboolean

TRUE if the window should not be in the pager.

Owner: CtkWindow

Flags: Read / Write

Default value: FALSE


The “skip-taskbar-hint” property

  “skip-taskbar-hint”        gboolean

TRUE if the window should not be in the task bar.

Owner: CtkWindow

Flags: Read / Write

Default value: FALSE


The “startup-id” property

  “startup-id”               char *

The :startup-id is a write-only property for setting window's startup notification identifier. See ctk_window_set_startup_id() for more details.

Owner: CtkWindow

Flags: Write

Default value: NULL

Since: 2.12


The “title” property

  “title”                    char *

The title of the window.

Owner: CtkWindow

Flags: Read / Write

Default value: NULL


The “transient-for” property

  “transient-for”            CtkWindow *

The transient parent of the window. See ctk_window_set_transient_for() for more details about transient windows.

Owner: CtkWindow

Flags: Read / Write / Construct

Since: 2.10


The “type” property

  “type”                     CtkWindowType

The type of the window.

Owner: CtkWindow

Flags: Read / Write / Construct Only

Default value: CTK_WINDOW_TOPLEVEL


The “type-hint” property

  “type-hint”                CdkWindowTypeHint

Hint to help the desktop environment understand what kind of window this is and how to treat it.

Owner: CtkWindow

Flags: Read / Write

Default value: CDK_WINDOW_TYPE_HINT_NORMAL


The “urgency-hint” property

  “urgency-hint”             gboolean

TRUE if the window should be brought to the user's attention.

Owner: CtkWindow

Flags: Read / Write

Default value: FALSE


The “window-position” property

  “window-position”          CtkWindowPosition

The initial position of the window.

Owner: CtkWindow

Flags: Read / Write

Default value: CTK_WIN_POS_NONE

Signal Details

The “activate-default” signal

void
user_function (CtkWindow *window,
               gpointer   user_data)

The ::activate-default signal is a keybinding signal which gets emitted when the user activates the default widget of window .

Parameters

window

the window which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Action


The “activate-focus” signal

void
user_function (CtkWindow *window,
               gpointer   user_data)

The ::activate-focus signal is a keybinding signal which gets emitted when the user activates the currently focused widget of window .

Parameters

window

the window which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Action


The “enable-debugging” signal

gboolean
user_function (CtkWindow *window,
               gboolean   toggle,
               gpointer   user_data)

The ::enable-debugging signal is a keybinding signal which gets emitted when the user enables or disables interactive debugging. When toggle is TRUE, interactive debugging is toggled on or off, when it is FALSE, the debugger will be pointed at the widget under the pointer.

The default bindings for this signal are Ctrl-Shift-I and Ctrl-Shift-D.

Return: TRUE if the key binding was handled

Parameters

window

the window on which the signal is emitted

 

toggle

toggle the debugger

 

user_data

user data set when the signal handler was connected.

 

Flags: Action


The “keys-changed” signal

void
user_function (CtkWindow *window,
               gpointer   user_data)

The ::keys-changed signal gets emitted when the set of accelerators or mnemonics that are associated with window changes.

Parameters

window

the window which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First


The “set-focus” signal

void
user_function (CtkWindow *window,
               CtkWidget *widget,
               gpointer   user_data)

This signal is emitted whenever the currently focused widget in this window changes.

Parameters

window

the window which received the signal

 

widget

the newly focused widget (or NULL for no focus).

[nullable]

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 2.24