Struct smithay_client_toolkit::Environment
source · pub struct Environment {
pub manager: GlobalManager,
pub compositor: Proxy<WlCompositor>,
pub subcompositor: Proxy<WlSubcompositor>,
pub shell: Shell,
pub shm: Proxy<WlShm>,
pub data_device_manager: Proxy<WlDataDeviceManager>,
pub outputs: OutputMgr,
pub decorations_mgr: Option<Proxy<ZxdgDecorationManagerV1>>,
/* private fields */
}
Expand description
A convenience for global management
This type provides convenience utilities for writing wayland client apps, by auto-binding a large portion of the global objects you’ll likely need to write your app. This is mostly provided as a mean to factor a consequent amount of dumb, redundant code.
Fields§
§manager: GlobalManager
The underlying GlobalManager wrapping your registry
compositor: Proxy<WlCompositor>
The compositor global, used to create surfaces
subcompositor: Proxy<WlSubcompositor>
The subcompositor global, used to create subsurfaces
shell: Shell
The shell global, used make your surfaces into windows
This tries to bind using the xdg_shell protocol, and fallbacks to wl_shell if it fails
shm: Proxy<WlShm>
The SHM global, to create shared memory buffers
data_device_manager: Proxy<WlDataDeviceManager>
The data device manager, used to handle drag&drop and selection copy/paste
outputs: OutputMgr
A manager for handling the advertised outputs
decorations_mgr: Option<Proxy<ZxdgDecorationManagerV1>>
The decoration manager, if the server supports server-side decorations
Implementations§
source§impl Environment
impl Environment
sourcepub fn from_display(
display: &Proxy<WlDisplay>,
evq: &mut EventQueue
) -> Result<Environment>
pub fn from_display(
display: &Proxy<WlDisplay>,
evq: &mut EventQueue
) -> Result<Environment>
Create an environment wrapping a new registry
It requires you to provide the EventQueue
as well because
the initialization process does a few roundtrip to the server
to initialize all the globals.
sourcepub fn from_display_with_cb<Impl>(
display: &Proxy<WlDisplay>,
evq: &mut EventQueue,
cb: Impl
) -> Result<Environment>where
Impl: FnMut(GlobalEvent, Proxy<WlRegistry>) + Send + 'static,
pub fn from_display_with_cb<Impl>(
display: &Proxy<WlDisplay>,
evq: &mut EventQueue,
cb: Impl
) -> Result<Environment>where
Impl: FnMut(GlobalEvent, Proxy<WlRegistry>) + Send + 'static,
Create an environment wrapping a new registry
Additionally to from_display
, this allows you to provide
a callback to be notified of global events, just like
GlobalManager::new_with_cb
. Note that you will still
receive events even if they are processed by this Environment
.
sourcepub fn shm_formats(&self) -> Vec<Format>
pub fn shm_formats(&self) -> Vec<Format>
Retrieve the accepted SHM formats of the server