Module desktop

Source
Available on crate feature desktop only.
Expand description

Desktop management helpers

This module contains helpers to organize and interact with desktop-style shells.

It is therefore a lot more opinionated than for example the xdg-shell handler and tightly integrates with some protocols (e.g. xdg-shell).

The usage of this module is therefor entirely optional and depending on your use-case you might also only want to use a limited set of the helpers provided.

§Helpers

§Window

A window represents what is typically understood by the end-user as a single application window.

Currently it abstracts over xdg-shell toplevels and Xwayland surfaces. It provides a bunch of methods to calculate and retrieve its size, manage itself, attach additional user_data as well as a drawing function to ease rendering it’s related surfaces.

Note that a Window on it’s own has no position. For that it needs to be placed inside a Space.

§Space

A space represents a two-dimensional plane of undefined dimensions. Windows (and other types implementing SpaceElement) and Outputs can be mapped onto it.

Elements get a position and stacking order through mapping. Outputs become views of a part of the Space and can be rendered via render_output.

§Layer Shell

A LayerSurface represents a surface as provided by e.g. the layer-shell protocol. It provides similar helper methods as a Window does to toplevel surfaces.

Each Output can be associated a LayerMap by calling layer_map_for_output, which LayerSurfaces can be mapped upon. Associated layer maps are automatically rendered by render_output, but a draw function is also provided for manual layer-surface management.

§Popups

Provides a PopupManager, which can be used to automatically keep track of popups and their relations to one-another. Popups are then automatically rendered with their matching toplevel surfaces, when either crate::backend::renderer::element::AsRenderElements::render_elements or render_output is called.

§Remarks

Note that the desktop abstractions are concerned with easing rendering different clients and therefore need to be able to manage client buffers to do so. If you plan to use the provided drawing functions, you need to use on_commit_buffer_handler.

Re-exports§

pub use self::space::Space;

Modules§

space
This module contains the Space helper class as well has related rendering helpers to add custom elements or different clients to a space.
utilswayland_frontend
Helper functions to ease dealing with surface trees

Structs§

LayerMapwayland_frontend
Map of LayerSurfaces on an Output
LayerSurfacewayland_frontend
A LayerSurface represents a single layer surface as given by the wlr-layer-shell protocol.
PopupGrabwayland_frontend
Represents the explicit grab a client requested for a popup
PopupKeyboardGrabwayland_frontend
Default implementation of a KeyboardGrab for PopupGrab
PopupManagerwayland_frontend
Helper to track popups.
PopupPointerGrabwayland_frontend
Default implementation of a PointerGrab for PopupGrab
Windowwayland_frontend
Represents a single application window
WindowSurfaceTypewayland_frontend
Defines the surface types that can be queried with Window::surface_under

Enums§

PopupGrabErrorwayland_frontend
Defines the possible errors that can be returned from PopupManager::grab_popup
PopupKindwayland_frontend
Represents a popup surface
PopupUngrabStrategywayland_frontend
Defines the possibly strategies for the PopupGrab::ungrab operation
WindowSurfacewayland_frontend
Represents the surface of a Window

Functions§

find_popup_root_surfacewayland_frontend
Finds the toplevel wl_surface this popup belongs to.
get_popup_toplevel_coordswayland_frontend
Computes this popup’s location relative to its toplevel wl_surface’s geometry.
layer_map_for_outputwayland_frontend
Retrieve a LayerMap for a given Output.