2.5 <GdkToplevel>

Interface: <GdkToplevel>

A freestanding toplevel surface.

The <GdkToplevel> interface provides useful APIs for interacting with the windowing system, such as controlling maximization and size of the surface, setting icons and transient parents for dialogs.

Properties

Property: toplevel:capabilities self

The capabilities that are available for this toplevel.

Its value is a <GdkToplevelCapabilities>.

It is read only.

Property: toplevel:decorated self

Whether the window manager should add decorations.

Its value is a boolean.

Set it with (set! (toplevel:decorated self) value).

Property: toplevel:deletable self

Whether the window manager should allow to close the surface.

Its value is a boolean.

Set it with (set! (toplevel:deletable self) value).

Property: toplevel:fullscreen-mode self

The fullscreen mode of the surface.

Its value is a <GdkFullscreenMode> (or, to set it, one of its symbols).

Set it with (set! (toplevel:fullscreen-mode self) value).

Property: toplevel:gravity self

The gravity to use when resizing a surface programmatically.

Gravity describes which point of the surface we want to keep fixed (meaning that the surface will grow in the opposite direction). For example, a gravity of north-east means that we want to fix top right corner of the surface.

This property is just a hint that may affect the result when negotiating toplevel sizes with the windowing system. It does not affect interactive resizes started with toplevel:begin-resize.

Its value is a <GdkGravity> (or, to set it, one of its symbols).

Set it with (set! (toplevel:gravity self) value).

Property: toplevel:icon-list self

A list of textures to use as icon.

Its value is a foreign pointer (or, to set it, a bytevector).

Set it with (set! (toplevel:icon-list self) value).

Property: toplevel:modal self

Whether the surface is modal.

Its value is a boolean.

Set it with (set! (toplevel:modal self) value).

Property: toplevel:shortcuts-inhibited self

Whether the surface should inhibit keyboard shortcuts.

Its value is a boolean.

It is read only.

Property: toplevel:startup-id self

The startup ID of the surface.

See <GdkAppLaunchContext> for more information about startup feedback.

Its value is a string, or #f.

Set it with (set! (toplevel:startup-id self) value).

Property: toplevel:state self

The state of the toplevel.

Its value is a <GdkToplevelState>.

It is read only.

Property: toplevel:title self

The title of the surface.

Its value is a string, or #f.

Set it with (set! (toplevel:title self) value).

Property: toplevel:transient-for self

The transient parent of the surface.

Its value is a <GdkSurface>, or #f.

Set it with (set! (toplevel:transient-for self) value).

Procedures

Method: toplevel:begin-move self device button x y timestamp
Method: begin-move self device button x y timestamp

Begins an interactive move operation.

You might use this function to implement draggable titlebars.

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

device

Passed: a <GdkDevice>.

the device used for the operation

button

Passed: a 32-bit integer.

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

x

Passed: a real number.

surface X coordinate of mouse click that began the drag

y

Passed: a real number.

surface Y coordinate of mouse click that began the drag

timestamp

Passed: an unsigned 32-bit integer.

timestamp of mouse click that began the drag (use event:get-time)

Method: toplevel:begin-resize self edge device button x y timestamp
Method: begin-resize self edge device button x y timestamp

Begins an interactive resize operation.

You might use this function to implement a “window resize grip.”

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

edge

Passed: a <GdkSurfaceEdge>, or one of its symbols.

the edge or corner from which the drag is started

device

Passed: a <GdkDevice>, or #f.

the device used for the operation

button

Passed: a 32-bit integer.

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

x

Passed: a real number.

surface X coordinate of mouse click that began the drag

y

Passed: a real number.

surface Y coordinate of mouse click that began the drag

timestamp

Passed: an unsigned 32-bit integer.

timestamp of mouse click that began the drag (use event:get-time)

Method: toplevel:focus self timestamp
Method: focus self 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.

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

timestamp

Passed: an unsigned 32-bit integer.

timestamp of the event triggering the surface focus

Method: toplevel:get-capabilities self ⇒ %return
Method: get-capabilities self ⇒ %return

The capabilities that are available for this toplevel.

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

%return

Returned: a <GdkToplevelCapabilities>.

the capabilities of the <GdkToplevel>.

Method: toplevel:get-gravity self ⇒ %return
Method: get-gravity self ⇒ %return

Returns the gravity that is used when changing the toplevel size programmatically.

self

Passed: a <GdkToplevel>.

a toplevel

%return

Returned: a <GdkGravity>.

the gravity

Method: toplevel:get-state self ⇒ %return
Method: get-state self ⇒ %return

Gets the bitwise or of the currently active surface state flags, from the <GdkToplevelState> enumeration.

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

%return

Returned: a <GdkToplevelState>.

surface state bitfield

Method: toplevel:inhibit-system-shortcuts self [event]
Method: inhibit-system-shortcuts self [event]

Requests that the self inhibit the system shortcuts.

This is 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 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 toplevel:shortcuts-inhibited property.

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

event

Passed, or left out: a <GdkEvent>, or #f.

the <GdkEvent> that is triggering the inhibit request, or #f if none is available

Method: toplevel:lower? self ⇒ %return
Method: lower? self ⇒ %return

Asks to lower the self below other windows.

The windowing system may choose to ignore the request.

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

%return

Returned: a boolean.

#t if the surface was lowered

Method: toplevel:minimize? self ⇒ %return
Method: minimize? self ⇒ %return

Asks to minimize the self.

The windowing system may choose to ignore the request.

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

%return

Returned: a boolean.

#t if the surface was minimized

Method: toplevel:present self layout
Method: present self layout

Present self after having processed the <GdkToplevelLayout> rules.

If the toplevel was previously not showing, it will be showed, otherwise it will change layout according to layout.

GDK may emit the toplevel:compute-size signal to let the user of this toplevel compute the preferred size of the toplevel surface.

Presenting is asynchronous and the specified layout parameters are not guaranteed to be respected.

self

Passed: a <GdkToplevel>.

the <GdkToplevel> to show

layout

Passed: a <GdkToplevelLayout>.

the <GdkToplevelLayout> object used to layout

Method: toplevel:restore-system-shortcuts self
Method: restore-system-shortcuts self

Restore default system keyboard shortcuts which were previously inhibited.

This undoes the effect of toplevel:inhibit-system-shortcuts.

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

Method: toplevel:set-decorated self decorated
Method: set-decorated self decorated

Sets the toplevel to be decorated.

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

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

decorated

Passed: a boolean.

#t to request decorations

Method: toplevel:set-deletable self deletable
Method: set-deletable self deletable

Sets the toplevel to be deletable.

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

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

deletable

Passed: a boolean.

#t to request a delete button

Method: toplevel:set-gravity self gravity
Method: set-gravity self gravity

Sets the gravity that is used when changing the toplevel size programmatically.

self

Passed: a <GdkToplevel>.

a toplevel

gravity

Passed: a <GdkGravity>, or one of its symbols.

the new gravity

Method: toplevel:set-icon-list self surfaces
Method: set-icon-list self 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.

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

surfaces

Passed: a list, each a <GdkTexture>.

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

Method: toplevel:set-modal self modal
Method: set-modal self modal

Sets the toplevel to be 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 toplevel:set-transient-for.

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

modal

Passed: a boolean.

#t if the surface is modal, #f otherwise.

Method: toplevel:set-startup-id self startup-id
Method: set-startup-id self startup-id

Sets the startup notification ID.

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

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

startup-id

Passed: a string.

a string with startup-notification identifier

Method: toplevel:set-title self title
Method: set-title self title

Sets the title of a toplevel surface.

The title maybe be displayed in the titlebar, in lists of windows, etc.

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

title

Passed: a string.

title of surface

Method: toplevel:set-transient-for self parent
Method: set-transient-for self parent

Sets a transient-for 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.

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

parent

Passed: a <GdkSurface>.

another toplevel <GdkSurface>

Method: toplevel:show-window-menu? self event ⇒ %return
Method: show-window-menu? self event ⇒ %return

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.

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

event

Passed: a <GdkEvent>.

a <GdkEvent> to show the menu for

%return

Returned: a boolean.

#t if the window menu was shown and #f otherwise.

Method: toplevel:supports-edge-constraints? self ⇒ %return
Method: supports-edge-constraints? self ⇒ %return

Returns whether the desktop environment supports tiled window states.

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

%return

Returned: a boolean.

#t if the desktop environment supports tiled window states

Method: toplevel:titlebar-gesture? self gesture ⇒ %return
Method: titlebar-gesture? self gesture ⇒ %return

Performs a title bar gesture.

self

Passed: a <GdkToplevel>.

a <GdkToplevel>

gesture

Passed: a <GdkTitlebarGesture>, or one of its symbols.

a <GdkTitlebarGesture>

%return

Returned: a boolean.

whether the gesture was performed

Signals

Signal: toplevel:compute-size

Connect a handler with (connect object toplevel:compute-size handler). It is called as (handler self size).

Emitted when the size for the surface needs to be computed, when it is present.

This signal will normally be emitted during or after a call to toplevel:present, depending on the configuration received by the windowing system. It may also be emitted at any other point in time, in response to the windowing system spontaneously changing the configuration of the toplevel surface.

It is the responsibility of the toplevel user to handle this signal and compute the desired size of the toplevel, given the information passed via the <GdkToplevelSize> object. Failing to do so will result in an arbitrary size being used as a result.

self

Passed: a <GdkToplevel>.

size

Passed: a <GdkToplevelSize>.

a <GdkToplevelSize>