[−][src]Struct smithay_client_toolkit::Environment
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: WlCompositor
The compositor global, used to create surfaces
subcompositor: 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: WlShm
The SHM global, to create shared memory buffers
data_device_manager: 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<ZxdgDecorationManagerV1>
The decoration manager, if the server supports server-side decorations
Methods
impl Environment
[src]
pub fn from_display(
display: &WlDisplay,
evq: &mut EventQueue
) -> Result<Environment>
[src]
display: &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.
pub fn from_display_with_cb<Impl>(
display: &WlDisplay,
evq: &mut EventQueue,
cb: Impl
) -> Result<Environment> where
Impl: FnMut(GlobalEvent, WlRegistry) + 'static,
[src]
display: &WlDisplay,
evq: &mut EventQueue,
cb: Impl
) -> Result<Environment> where
Impl: FnMut(GlobalEvent, WlRegistry) + '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
.
pub fn shm_formats(&self) -> Vec<Format>
[src]
Retrieve the accepted SHM formats of the server
pub fn create_surface<F>(&self, dpi_change: F) -> WlSurface where
F: FnMut(i32, WlSurface) + Send + 'static,
[src]
F: FnMut(i32, WlSurface) + Send + 'static,
Create a new dpi aware surface
The provided callback will be fired whenever the DPI factor associated to it changes.
The DPI factor associated to a surface is defined as the maximum of the DPI factors of the outputs it is displayed on.
pub fn create_shell_surface<Impl>(
&self,
surface: &WlSurface,
shell_impl: Impl
) -> Box<dyn ShellSurface> where
Impl: FnMut(Event) + Send + 'static,
[src]
&self,
surface: &WlSurface,
shell_impl: Impl
) -> Box<dyn ShellSurface> where
Impl: FnMut(Event) + Send + 'static,
Create a new shell surface
Auto Trait Implementations
impl !RefUnwindSafe for Environment
impl Send for Environment
impl Sync for Environment
impl Unpin for Environment
impl !UnwindSafe for Environment
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,