Skip to main content

WindowExtWayland

Trait WindowExtWayland 

pub trait WindowExtWayland {
    // Required methods
    fn set_ime_multiline(&self, multiline: bool);
    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, Vec<u8>)>) -> bool;
    fn server_side_decorations(&self) -> Option<bool>;
}
Expand description

Additional methods on Window that are specific to Wayland.

Required Methods§

fn set_ime_multiline(&self, multiline: bool)

Publish whether the original IME field accepts line feeds as text. Password and terminal purposes never gain the multiline hint.

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)

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

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>>

Returns xdg_toplevel of the window or None if the window is X11 window.

fn start_drag(&self, offers: Vec<(String, Vec<u8>)>) -> bool

Start a drag-and-drop from this window, offering offers as mime type → bytes.

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>

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.

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.

Implementors§