Trait WindowExtWayland
pub trait WindowExtWayland {
// Required methods
fn set_ime_content_type(&self, content: Option<ImeContentType>);
fn private_text_input(&self, snapshot: Option<[u8; 32]>) -> bool;
fn acknowledge_private_text_input(&self, serial: u32, outcome: u32);
fn present_with_feedback(
&self,
observer: Box<dyn FnOnce(WaylandPresentation) + Send>,
present: impl FnOnce(),
) -> bool;
fn xdg_toplevel(&self) -> Option<NonNull<c_void>>;
fn start_drag(&self, offers: Vec<(String, DragData)>) -> bool;
fn server_side_decorations(&self) -> Option<bool>;
fn client_buffer_formats(&self) -> Vec<(u32, u64)>;
fn create_client_buffer(
&self,
source: ClientBufferSource<'_>,
on_release: Box<dyn Fn() + Send + Sync>,
) -> Option<ClientBuffer>;
fn attach_client_buffer(
&self,
buffer: &ClientBuffer,
damage: &[(i32, i32, i32, i32)],
observer: Option<Box<dyn FnOnce(WaylandPresentation) + Send>>,
) -> bool;
fn is_session_lock_up(&self) -> bool;
fn unlock_session(&self);
}Expand description
Additional methods on Window that are specific to Wayland.
Required Methods§
fn set_ime_content_type(&self, content: Option<ImeContentType>)
fn set_ime_content_type(&self, content: Option<ImeContentType>)
Send this content type to the input method instead of the one
Window::set_ime_purpose
stands for; None goes back to the purpose’s.
fn private_text_input(&self, snapshot: Option<[u8; 32]>) -> bool
fn private_text_input(&self, snapshot: Option<[u8; 32]>) -> bool
Publish a private, ephemeral equality stamp for the original editable field. An empty stamp disables admission. Does not grant microphone or IME ownership.
fn acknowledge_private_text_input(&self, serial: u32, outcome: u32)
fn acknowledge_private_text_input(&self, serial: u32, outcome: u32)
Resolve the exact original request after its actual renderer result. Outcome is accepted (0), known rejection (1), or unknown delivery (2).
fn present_with_feedback(
&self,
observer: Box<dyn FnOnce(WaylandPresentation) + Send>,
present: impl FnOnce(),
) -> bool
fn present_with_feedback( &self, observer: Box<dyn FnOnce(WaylandPresentation) + Send>, present: impl FnOnce(), ) -> bool
Observe the next committed buffer with the standard presentation protocol.
Holds the native window state lock across the request and present so an
IME/configure commit cannot take the feedback for an unrelated buffer.
Always calls present; returns false when the protocol is unavailable.
A frame callback or client submission never completes this observer.
fn xdg_toplevel(&self) -> Option<NonNull<c_void>>
fn xdg_toplevel(&self) -> Option<NonNull<c_void>>
Returns xdg_toplevel of the window or None if the window is X11 window.
fn start_drag(&self, offers: Vec<(String, DragData)>) -> bool
fn start_drag(&self, offers: Vec<(String, DragData)>) -> bool
Start a drag-and-drop from this window, offering offers as
mime type → content: bytes, or a file that is read only when a
receiver asks for it, on the thread that writes the pipe
(DragData::File).
Call it while a pointer button is held — the compositor validates the drag against that implicit grab, so a drag started without one is ignored. The receiving application asks for whichever offered mime type it understands and is handed those bytes.
Bytes rather than a file path, because the receiver may be a
sandboxed app in its own mount namespace where a path from this
process does not resolve. Offer a text/uri-list too if the
receiver may want a name, but never offer only that.
Returns whether the drag was started: false on X11, when no
pointer is on the seat, when the compositor has no
wl_data_device_manager, or when offers is empty.
fn server_side_decorations(&self) -> Option<bool>
fn server_side_decorations(&self) -> Option<bool>
Whether the compositor draws this window’s decorations, as settled by
xdg-decoration in the last configure. None before the first
configure. An X11 window manager always decorates.
fn client_buffer_formats(&self) -> Vec<(u32, u64)>
fn client_buffer_formats(&self) -> Vec<(u32, u64)>
The (fourcc, modifier) pairs the compositor takes as dma-bufs; empty on X11 or before the compositor announced them (Tilo).
fn create_client_buffer(
&self,
source: ClientBufferSource<'_>,
on_release: Box<dyn Fn() + Send + Sync>,
) -> Option<ClientBuffer>
fn create_client_buffer( &self, source: ClientBufferSource<'_>, on_release: Box<dyn Fn() + Send + Sync>, ) -> Option<ClientBuffer>
A wl_buffer of pixels another process drew (Tilo’s render
service), calling on_release whenever the compositor releases it.
None on X11, or for a buffer the compositor does not take.
fn attach_client_buffer(
&self,
buffer: &ClientBuffer,
damage: &[(i32, i32, i32, i32)],
observer: Option<Box<dyn FnOnce(WaylandPresentation) + Send>>,
) -> bool
fn attach_client_buffer( &self, buffer: &ClientBuffer, damage: &[(i32, i32, i32, i32)], observer: Option<Box<dyn FnOnce(WaylandPresentation) + Send>>, ) -> bool
Attach buffer to this window’s surface with damage (buffer
pixels: x, y, width, height; empty damages all of it) and commit,
observing the commit’s presentation with observer. Returns whether
the presentation is observed (Tilo).
fn is_session_lock_up(&self) -> bool
fn is_session_lock_up(&self) -> bool
Whether this window is the session’s lock screen and the compositor confirmed the lock: it has its surface, sized to the output, and every input is its. Before that it draws nothing.
fn unlock_session(&self)
fn unlock_session(&self)
End the session’s lock this window holds, after it established that the person may: the session’s desktop shows again. A window that is not the lock screen does nothing.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.