Toplevels

Toplevels — Interface for toplevel surfaces

Properties

gboolean decorated Read / Write
gboolean deletable Read / Write
GdkFullscreenMode fullscreen-mode Read / Write
gpointer icon-list Read / Write
gboolean modal Read / Write
gboolean shortcuts-inhibited Read
gchar * startup-id Read / Write
GdkSurfaceState state Read
gchar * title Read / Write
GdkSurface * transient-for Read / Write

Types and Values

Object Hierarchy

    GInterface
    ╰── GdkToplevel

Prerequisites

GdkToplevel requires GdkSurface.

Includes

#include <gdk/gdk.h>

Description

A GdkToplevel is a freestanding toplevel surface.

Functions

gdk_toplevel_present ()

gboolean
gdk_toplevel_present (GdkToplevel *toplevel,
                      int width,
                      int height,
                      GdkToplevelLayout *layout);

Present toplevel after having processed the GdkToplevelLayout rules. If the toplevel was previously now showing, it will be showed, otherwise it will change layout according to layout .

Presenting may fail.

Parameters

toplevel

the GdkToplevel to show

 

width

the unconstrained toplevel width to layout

 

height

the unconstrained toplevel height to layout

 

layout

the GdkToplevelLayout object used to layout

 

Returns

FALSE if toplevel failed to be presented, otherwise TRUE.


gdk_toplevel_minimize ()

gboolean
gdk_toplevel_minimize (GdkToplevel *toplevel);

Asks to minimize the toplevel .

The windowing system may choose to ignore the request.

Parameters

toplevel

a GdkToplevel

 

Returns

TRUE if the surface was minimized


gdk_toplevel_lower ()

gboolean
gdk_toplevel_lower (GdkToplevel *toplevel);

Asks to lower the toplevel below other windows.

The windowing system may choose to ignore the request.

Parameters

toplevel

a GdkToplevel

 

Returns

TRUE if the surface was lowered


gdk_toplevel_focus ()

void
gdk_toplevel_focus (GdkToplevel *toplevel,
                    guint32 timestamp);

Sets keyboard focus to surface .

In most cases, gtk_window_present_with_time() should be used on a GtkWindow, rather than calling this function.

Parameters

toplevel

a GdkToplevel

 

timestamp

timestamp of the event triggering the surface focus

 

gdk_toplevel_get_state ()

GdkSurfaceState
gdk_toplevel_get_state (GdkToplevel *toplevel);

Gets the bitwise OR of the currently active surface state flags, from the GdkSurfaceState enumeration.

Parameters

toplevel

a GdkToplevel

 

Returns

surface state bitfield


gdk_toplevel_set_title ()

void
gdk_toplevel_set_title (GdkToplevel *toplevel,
                        const char *title);

Sets the title of a toplevel surface, to be displayed in the titlebar, in lists of windows, etc.

Parameters

toplevel

a GdkToplevel

 

title

title of surface

 

gdk_toplevel_set_startup_id ()

void
gdk_toplevel_set_startup_id (GdkToplevel *toplevel,
                             const char *startup_id);

When using GTK, typically you should use gtk_window_set_startup_id() instead of this low-level function.

Parameters

toplevel

a GdkToplevel

 

startup_id

a string with startup-notification identifier

 

gdk_toplevel_set_transient_for ()

void
gdk_toplevel_set_transient_for (GdkToplevel *toplevel,
                                GdkSurface *parent);

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

See gtk_window_set_transient_for() if you’re using GtkWindow or GtkDialog.

Parameters

toplevel

a GdkToplevel

 

parent

another toplevel GdkSurface

 

gdk_toplevel_set_modal ()

void
gdk_toplevel_set_modal (GdkToplevel *toplevel,
                        gboolean modal);

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

You should only use this on surfaces for which you have previously called gdk_toplevel_set_transient_for().

Parameters

toplevel

A toplevel surface

 

modal

TRUE if the surface is modal, FALSE otherwise.

 

gdk_toplevel_set_icon_list ()

void
gdk_toplevel_set_icon_list (GdkToplevel *toplevel,
                            GList *surfaces);

Sets a list of icons for the surface.

One of these will be used to represent the surface in iconic form. The icon may be shown in window lists or task bars. 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.

Note that some platforms don't support surface icons.

Parameters

toplevel

a GdkToplevel

 

surfaces

A list of textures to use as icon, of different sizes.

[transfer none][element-type GdkTexture]

gdk_toplevel_show_window_menu ()

gboolean
gdk_toplevel_show_window_menu (GdkToplevel *toplevel,
                               GdkEvent *event);

Asks the windowing system to show the window menu.

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

Parameters

toplevel

a GdkToplevel

 

event

a GdkEvent to show the menu for

 

Returns

TRUE if the window menu was shown and FALSE otherwise.


gdk_toplevel_set_decorated ()

void
gdk_toplevel_set_decorated (GdkToplevel *toplevel,
                            gboolean decorated);

Setting decorated to FALSE hints the desktop environment that the surface has its own, client-side decorations and does not need to have window decorations added.

Parameters

toplevel

a GdkToplevel

 

decorated

TRUE to request decorations

 

gdk_toplevel_set_deletable ()

void
gdk_toplevel_set_deletable (GdkToplevel *toplevel,
                            gboolean deletable);

Setting deletable to TRUE hints the desktop environment that it should offer the user a way to close the surface.

Parameters

toplevel

a GdkToplevel

 

deletable

TRUE to request a delete button

 

gdk_toplevel_supports_edge_constraints ()

gboolean
gdk_toplevel_supports_edge_constraints
                               (GdkToplevel *toplevel);

Returns whether the desktop environment supports tiled window states.

Parameters

toplevel

a GdkToplevel

 

Returns

TRUE if the desktop environment supports tiled window states


gdk_toplevel_inhibit_system_shortcuts ()

void
gdk_toplevel_inhibit_system_shortcuts (GdkToplevel *toplevel,
                                       GdkEvent *event);

Requests that the toplevel inhibit the system shortcuts, asking the desktop environment/windowing system to let all keyboard events reach the surface, as long as it is focused, instead of triggering system actions.

If granted, the rerouting remains active until the default shortcuts processing is restored with gdk_toplevel_restore_system_shortcuts(), or the request is revoked by the desktop environment, windowing system or the user.

A typical use case for this API is remote desktop or virtual machine viewers which need to inhibit the default system keyboard shortcuts so that the remote session or virtual host gets those instead of the local environment.

The windowing system or desktop environment may ask the user to grant or deny the request or even choose to ignore the request entirely.

The caller can be notified whenever the request is granted or revoked by listening to the GdkToplevel::shortcuts-inhibited property.

Parameters

toplevel

the GdkToplevel requesting system keyboard shortcuts

 

event

the GdkEvent that is triggering the inhibit request, or NULL if none is available.

[nullable]

gdk_toplevel_restore_system_shortcuts ()

void
gdk_toplevel_restore_system_shortcuts (GdkToplevel *toplevel);

Restore default system keyboard shortcuts which were previously requested to be inhibited by gdk_toplevel_inhibit_system_shortcuts().

Parameters

toplevel

a GdkToplevel

 

gdk_toplevel_begin_resize ()

void
gdk_toplevel_begin_resize (GdkToplevel *toplevel,
                           GdkSurfaceEdge edge,
                           GdkDevice *device,
                           int button,
                           double x,
                           double y,
                           guint32 timestamp);

Begins an interactive resize operation (for a toplevel surface). You might use this function to implement a “window resize grip.”

Parameters

toplevel

a GdkToplevel

 

edge

the edge or corner from which the drag is started

 

device

the device used for the operation.

[nullable]

button

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

 

x

surface X coordinate of mouse click that began the drag

 

y

surface Y coordinate of mouse click that began the drag

 

timestamp

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

 

gdk_toplevel_begin_move ()

void
gdk_toplevel_begin_move (GdkToplevel *toplevel,
                         GdkDevice *device,
                         int button,
                         double x,
                         double y,
                         guint32 timestamp);

Begins an interactive move operation (for a toplevel surface). You might use this function to implement draggable titlebars.

Parameters

toplevel

a GdkToplevel

 

device

the device used for the operation

 

button

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

 

x

surface X coordinate of mouse click that began the drag

 

y

surface Y coordinate of mouse click that began the drag

 

timestamp

timestamp of mouse click that began the drag

 

Types and Values

GdkToplevel

typedef struct _GdkToplevel GdkToplevel;

enum GdkFullscreenMode

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

Members

GDK_FULLSCREEN_ON_CURRENT_MONITOR

Fullscreen on current monitor only.

 

GDK_FULLSCREEN_ON_ALL_MONITORS

Span across all monitors when fullscreen.

 

Property Details

The “decorated” property

  “decorated”                gboolean

Decorated.

Owner: GdkToplevel

Flags: Read / Write

Default value: FALSE


The “deletable” property

  “deletable”                gboolean

Deletable.

Owner: GdkToplevel

Flags: Read / Write

Default value: FALSE


The “fullscreen-mode” property

  “fullscreen-mode”          GdkFullscreenMode

Fullscreen mode.

Owner: GdkToplevel

Flags: Read / Write

Default value: GDK_FULLSCREEN_ON_CURRENT_MONITOR


The “icon-list” property

  “icon-list”                gpointer

The list of icon textures.

Owner: GdkToplevel

Flags: Read / Write


The “modal” property

  “modal”                    gboolean

Whether the surface is modal.

Owner: GdkToplevel

Flags: Read / Write

Default value: FALSE


The “shortcuts-inhibited” property

  “shortcuts-inhibited”      gboolean

Whether keyboard shortcuts are inhibited.

Owner: GdkToplevel

Flags: Read

Default value: FALSE


The “startup-id” property

  “startup-id”               gchar *

The startup ID of the surface.

Owner: GdkToplevel

Flags: Read / Write

Default value: NULL


The “state” property

  “state”                    GdkSurfaceState

State.

Owner: GdkToplevel

Flags: Read

Default value: GDK_SURFACE_STATE_WITHDRAWN


The “title” property

  “title”                    gchar *

The title of the surface.

Owner: GdkToplevel

Flags: Read / Write

Default value: NULL


The “transient-for” property

  “transient-for”            GdkSurface *

The transient parent of the surface.

Owner: GdkToplevel

Flags: Read / Write