[−][src]Module smithay_client_toolkit::environment
Environment management utilities
This module provide the tools to automatically bind the wayland global objects you need in your program.
At the heart of this is the environment!
macro, which allows you to signal the globals you need
and a struct to manage them as they are signaled in the registry.
Global handlers
Wayland globals are split in two kinds, that we will call here "single" globals and "multi" globals.
- "single" globals represent a capability of the server. They are generally signaled in the registry
from the start and never removed. They are signaled a single time. Examples of these globals are
wl_compositor
,wl_shm
orxdg_wm_base
. - "multi" globals represent a resource that the server gives you access to. These globals can be
created or removed during the run of the program, and may exist as more than one instance, each
representing a different physical resource. Examples of such globals are
wl_output
orwl_seat
.
The objects you need to handle these globals must implement one the two traits
GlobalHandler<I>
or MultiGlobalHandler<I>
,
depending on the kind of globals it will handle. These objects are responsible for binding the globals
from the registry, and assigning them to filters to receive their events as necessary.
This module provides a generic implementation of the GlobalHandler<I>
trait
as SimpleGlobal<I>
. It can manage "single" globals that do not generate
events, and thus require no filter.
the environment!
macro
This macro is at the core of this module. See its documentation for details about how to
use it: environment!
. You can alternatively use the
default_environment!
macro to quickly setup things and bring
in all SCTK modules.
Structs
Environment | A Wayland Environment |
SimpleGlobal | A minimalist global handler for "single" globals |
Traits
GlobalHandler | Required trait for implementing a handler for "single" globals |
InnerEnv | Internal trait for the |
MultiGlobalHandler | Required trait for implementing a handler for "multi" globals |