pub struct XdgSessionV1 { /* private fields */ }Expand description
A session for an application
A xdg_session_v1 object represents a session for an application. While the object exists, all surfaces which have been added to the session will have states stored by the compositor which can be reapplied at a later time. Two sessions cannot exist for the same identifier string.
States for surfaces added to a session are automatically updated by the compositor when they are changed.
See also the Event enum for this interface.
Implementations§
Source§impl XdgSessionV1
impl XdgSessionV1
Sourcepub fn destroy(&self)
pub fn destroy(&self)
Destroy the session
Destroy a session object, preserving the current state but not continuing to make further updates if state changes occur. This makes the associated xdg_toplevel_session_v1 objects inert.
Sourcepub fn remove(&self)
pub fn remove(&self)
Remove the session
Remove the session, making it no longer available for restoration. A compositor should in response to this request remove the data related to this session from its storage.
Sourcepub fn add_toplevel<U, D: 'static>(
&self,
toplevel: &XdgToplevel,
name: String,
qh: &QueueHandle<D>,
udata: U,
) -> XdgToplevelSessionV1
pub fn add_toplevel<U, D: 'static>( &self, toplevel: &XdgToplevel, name: String, qh: &QueueHandle<D>, udata: U, ) -> XdgToplevelSessionV1
add a new surface to the session
Attempt to add a given surface to the session. The passed name is used to identify what window is being restored, and may be used to store window specific state within the session.
The name given to the toplevel must not correspond to any previously existing toplevel names in the session. If the name matches an already known toplevel name in the session, a ‘name_in_use’ protocol error will be raised.
The toplevel object must not be added more than once to any session created by the client, otherwise the ‘already_added’ protocol error will be raised.
This request will return a xdg_toplevel_session_v1 for later manipulation. As this resource is created from an empty initial state, compositors must not emit a xdg_toplevel_session_v1.restored event for resources created through this request.
The name string must be UTF-8 encoded. It is also limited by the maximum length of wayland messages (around 4KB). The ‘invalid_name’ protocol error will be raised if an invalid string is provided.
Sourcepub fn restore_toplevel<U, D: 'static>(
&self,
toplevel: &XdgToplevel,
name: String,
qh: &QueueHandle<D>,
udata: U,
) -> XdgToplevelSessionV1
pub fn restore_toplevel<U, D: 'static>( &self, toplevel: &XdgToplevel, name: String, qh: &QueueHandle<D>, udata: U, ) -> XdgToplevelSessionV1
restore a surface state
Inform the compositor that the toplevel associated with the passed name should have its window management state restored.
If the toplevel name was previously granted to another xdg_toplevel, the ‘name_in_use’ protocol error will be raised.
The toplevel object must not be added more than once to any session created by the client, otherwise the ‘already_added’ protocol error will be raised.
This request must be called prior to the first commit on the associated wl_surface after creating the toplevel, otherwise an ‘already_mapped’ error is raised.
As part of the initial configure sequence, if the toplevel was successfully restored, a xdg_toplevel_session_v1.restored event is emitted. If the toplevel name was not known in the session, this request will be equivalent to the xdg_toplevel_session_v1.add_toplevel request, and no such event will be emitted. See the xdg_toplevel_session_v1.restored event for further details.
The name string must be UTF-8 encoded. It is also limited by the maximum length of wayland messages (around 4KB). The ‘invalid_name’ protocol error will be raised if an invalid string is provided.
Sourcepub fn remove_toplevel(&self, name: String)
pub fn remove_toplevel(&self, name: String)
remove a surface from the session
Remove a specified surface from the session and render any related xdg_toplevel_session_v1 object inert. The compositor should remove any data related to the toplevel in the corresponding session from its internal storage.
The window is specified by its name in the session. The name string must be encoded in UTF-8, and it is limited in size by the maximum length of wayland messages (around 4KB).
Trait Implementations§
Source§impl Borrow<ObjectId> for XdgSessionV1
impl Borrow<ObjectId> for XdgSessionV1
Source§impl Clone for XdgSessionV1
impl Clone for XdgSessionV1
Source§fn clone(&self) -> XdgSessionV1
fn clone(&self) -> XdgSessionV1
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more