WaylandToplevel

class WaylandToplevel(**properties: Any)

Superclasses: WaylandSurface, Surface, Object

Implemented Interfaces: Toplevel

The Wayland implementation of GdkToplevel.

Beyond the Toplevel API, the Wayland implementation has API to set up cross-process parent-child relationships between surfaces with export_handle and set_transient_for_exported.

Methods

class WaylandToplevel
drop_exported_handle(handle: str) None

Destroy a handle that was obtained with export_handle().

Note that this API depends on an unstable Wayland protocol, and thus may require changes in the future.

Added in version 4.12.

Parameters:

handle – the handle to drop

export_handle(callback: Callable[[...], None], *user_data: Any) bool

Asynchronously obtains a handle for a surface that can be passed to other processes.

When the handle has been obtained, callback will be called.

It is an error to call this function on a surface that is already exported.

When the handle is no longer needed, unexport_handle should be called to clean up resources.

The main purpose for obtaining a handle is to mark a surface from another surface as transient for this one, see set_transient_for_exported.

Before 4.12, this API could not safely be used multiple times, since there was no reference counting for handles. Starting with 4.12, every call to this function obtains a new handle, and every call to drop_exported_handle drops just the handle that it is given.

Note that this API depends on an unstable Wayland protocol, and thus may require changes in the future.

Parameters:
  • callback – callback to call with the handle

  • user_data – user data for callback

set_application_id(application_id: str) None

Sets the application id on a GdkToplevel.

Parameters:

application_id – the application id for the toplevel

set_transient_for_exported(parent_handle_str: str) bool

Marks toplevel as transient for the surface to which the given parent_handle_str refers.

Typically, the handle will originate from a export_handle call in another process.

Note that this API depends on an unstable Wayland protocol, and thus may require changes in the future.

Parameters:

parent_handle_str – an exported handle for a surface

unexport_handle() None

Destroys the handle that was obtained with export_handle().

It is an error to call this function on a surface that does not have a handle.

Since 4.12, this function does nothing. Use drop_exported_handle instead to drop a handle that was obtained with export_handle.

Note that this API depends on an unstable Wayland protocol, and thus may require changes in the future.

Deprecated since version 4.12: Use drop_exported_handle instead, this function does nothing