Struct wayland_protocols::xdg::shell::server::xdg_toplevel::XdgToplevel
source · pub struct XdgToplevel { /* private fields */ }
Expand description
toplevel surface
This interface defines an xdg_surface role which allows a surface to, among other things, set window-like properties such as maximize, fullscreen, and minimize, set application-specific metadata like title and id, and well as trigger user interactive operations such as interactive resize and move.
A xdg_toplevel by default is responsible for providing the full intended visual representation of the toplevel, which depending on the window state, may mean things like a title bar, window controls and drop shadow.
Unmapping an xdg_toplevel means that the surface cannot be shown by the compositor until it is explicitly mapped again. All active operations (e.g., move, resize) are canceled and all attributes (e.g. title, state, stacking, …) are discarded for an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to the state it had right after xdg_surface.get_toplevel. The client can re-map the toplevel by performing a commit without any buffer attached, waiting for a configure event and handling it as usual (see xdg_surface description).
Attaching a null buffer to a toplevel unmaps the surface.
See also the Request enum for this interface.
Implementations§
source§impl XdgToplevel
impl XdgToplevel
sourcepub fn configure(&self, width: i32, height: i32, states: Vec<u8>)
pub fn configure(&self, width: i32, height: i32, states: Vec<u8>)
suggest a surface change
This configure event asks the client to resize its toplevel surface or to change its state. The configured state should not be applied immediately. See xdg_surface.configure for details.
The width and height arguments specify a hint to the window about how its surface should be resized in window geometry coordinates. See set_window_geometry.
If the width or height arguments are zero, it means the client should decide its own window dimension. This may happen when the compositor needs to configure the state of the surface but doesn’t have any information about any previous or expected dimension.
The states listed in the event specify how the width/height arguments should be interpreted, and possibly how it should be drawn.
Clients must send an ack_configure in response to this event. See xdg_surface.configure and xdg_surface.ack_configure for details.
sourcepub fn close(&self)
pub fn close(&self)
surface wants to be closed
The close event is sent by the compositor when the user wants the surface to be closed. This should be equivalent to the user clicking the close button in client-side decorations, if your application has any.
This is only a request that the user intends to close the window. The client may choose to ignore this request, or show a dialog to ask the user to save their data, etc.
sourcepub fn configure_bounds(&self, width: i32, height: i32)
pub fn configure_bounds(&self, width: i32, height: i32)
recommended window geometry bounds
The configure_bounds event may be sent prior to a xdg_toplevel.configure event to communicate the bounds a window geometry size is recommended to constrain to.
The passed width and height are in surface coordinate space. If width and height are 0, it means bounds is unknown and equivalent to as if no configure_bounds event was ever sent for this surface.
The bounds can for example correspond to the size of a monitor excluding any panels or other shell components, so that a surface isn’t created in a way that it cannot fit.
The bounds may change at any point, and in such a case, a new xdg_toplevel.configure_bounds will be sent, followed by xdg_toplevel.configure and xdg_surface.configure.
sourcepub fn wm_capabilities(&self, capabilities: Vec<u8>)
pub fn wm_capabilities(&self, capabilities: Vec<u8>)
compositor capabilities
This event advertises the capabilities supported by the compositor. If a capability isn’t supported, clients should hide or disable the UI elements that expose this functionality. For instance, if the compositor doesn’t advertise support for minimized toplevels, a button triggering the set_minimized request should not be displayed.
The compositor will ignore requests it doesn’t support. For instance, a compositor which doesn’t advertise support for minimized will ignore set_minimized requests.
Compositors must send this event once before the first xdg_surface.configure event. When the capabilities change, compositors must send this event again and then send an xdg_surface.configure event.
The configured state should not be applied immediately. See xdg_surface.configure for details.
The capabilities are sent as an array of 32-bit unsigned integers in native endianness.
Trait Implementations§
source§impl Borrow<ObjectId> for XdgToplevel
impl Borrow<ObjectId> for XdgToplevel
source§impl Clone for XdgToplevel
impl Clone for XdgToplevel
source§fn clone(&self) -> XdgToplevel
fn clone(&self) -> XdgToplevel
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for XdgToplevel
impl Debug for XdgToplevel
source§impl Hash for XdgToplevel
impl Hash for XdgToplevel
source§impl PartialEq<Weak<XdgToplevel>> for XdgToplevel
impl PartialEq<Weak<XdgToplevel>> for XdgToplevel
source§impl PartialEq for XdgToplevel
impl PartialEq for XdgToplevel
source§impl Resource for XdgToplevel
impl Resource for XdgToplevel
source§fn object_data(&self) -> Option<&Arc<dyn Any + Send + Sync>>
fn object_data(&self) -> Option<&Arc<dyn Any + Send + Sync>>
source§fn handle(&self) -> &WeakHandle
fn handle(&self) -> &WeakHandle
source§fn from_id(conn: &DisplayHandle, id: ObjectId) -> Result<Self, InvalidId>
fn from_id(conn: &DisplayHandle, id: ObjectId) -> Result<Self, InvalidId>
source§fn send_event(&self, evt: Self::Event<'_>) -> Result<(), InvalidId>
fn send_event(&self, evt: Self::Event<'_>) -> Result<(), InvalidId>
source§fn parse_request(
conn: &DisplayHandle,
msg: Message<ObjectId, OwnedFd>,
) -> Result<(Self, Self::Request), DispatchError>
fn parse_request( conn: &DisplayHandle, msg: Message<ObjectId, OwnedFd>, ) -> Result<(Self, Self::Request), DispatchError>
source§fn write_event<'a>(
&self,
conn: &DisplayHandle,
msg: Self::Event<'a>,
) -> Result<Message<ObjectId, BorrowedFd<'a>>, InvalidId>
fn write_event<'a>( &self, conn: &DisplayHandle, msg: Self::Event<'a>, ) -> Result<Message<ObjectId, BorrowedFd<'a>>, InvalidId>
source§fn is_alive(&self) -> bool
fn is_alive(&self) -> bool
impl Eq for XdgToplevel
Auto Trait Implementations§
impl Freeze for XdgToplevel
impl !RefUnwindSafe for XdgToplevel
impl Send for XdgToplevel
impl Sync for XdgToplevel
impl Unpin for XdgToplevel
impl !UnwindSafe for XdgToplevel
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.