X11Wm

Struct X11Wm 

Source
pub struct X11Wm { /* private fields */ }
Available on crate feature xwayland only.
Expand description

The runtime state of an reparenting XWayland window manager.

Implementations§

Source§

impl X11Wm

Source

pub fn start_wm<D>( handle: LoopHandle<'static, D>, dh: &DisplayHandle, connection: UnixStream, client: Client, ) -> Result<Self, Box<dyn Error>>

Start a new window manager for a given Xwayland connection

§Arguments
  • handle is an eventloop handle used to queue up and handle incoming X11 events
  • dh is the corresponding display handle to the wayland connection of the Xwayland instance
  • connection is the corresponding x11 client connection of the Xwayland instance
  • client is the wayland client instance of the Xwayland instance
Source

pub fn id(&self) -> XwmId

Id of this X11 WM

Source

pub fn raise_window<'a, W: X11Relatable + 'a>( &mut self, window: &'a W, ) -> Result<(), ConnectionError>

Raises a window in the internal X11 state

Needs to be called to match raising of windows inside the compositor to keep the stacking order in sync with the compositor to avoid erroneous behavior.

Source

pub fn update_stacking_order_downwards<'a, W: X11Relatable + 'a>( &mut self, order: impl Iterator<Item = &'a W>, ) -> Result<(), ConnectionError>

Updates the stacking order by matching provided windows downwards.

This function reorders provided x11 windows in such a way, that windows inside the internal X11 stack follow the provided order without moving other windows around as much as possible. The internal stack stores windows bottom -> top, so order here is also bottom -> top.

Window IDs unknown to this XWM will be ignored. The first window in order found will not be moved.

If a window is encountered in order that is stacked below the first window, it will be moved to be directly above the previous window in order. E.g. Windows C -> A -> B -> E given in order with an internal stack of D -> A -> B -> C, will be reordered as D -> C -> A -> B. First A is moved to be directly above C, then Bis moved to be directly above A.

Windows in the internal stack, that are not present in order will be skipped over in the process.

So if windows A -> C are given in order and the internal stack is A -> B -> C, no reordering will occur.

See X11Wm::update_stacking_order_upwards for a variant of this algorithm, which works from the bottom up or X11Wm::raise_window for an easier but much more limited way to reorder.

Source

pub fn update_stacking_order_upwards<'a, W: X11Relatable + 'a>( &mut self, order: impl Iterator<Item = &'a W>, ) -> Result<(), ConnectionError>

Updates the stacking order by moving provided windows upwards.

This function reorders provided x11 windows in such a way, that windows inside the internal X11 stack follow the provided order in reverse without moving other windows around as much as possible. The internal stack stores windows bottom -> top, so due to the reversal, order here is top -> bottom.

Window IDs unknown to this XWM will be ignored. The first window in order found will not be moved.

If a window is encountered in order that is stacked above the first window, it will be moved to be directly below the previous window in order. E.g. Windows C -> A -> B given in order with an internal stack of D -> A -> B -> C, will be reordered as D -> B -> A -> C. A is below C, so it isn’t moved, then B is moved to be directly below A.

Windows in the internal stack, that are not present in order will be skipped over in the process.

So if windows A -> C are given in order and the internal stack is C -> B -> A, no reordering will occur.

See X11Wm::update_stacking_order_downwards for a variant of this algorithm, which works from the top down or X11Wm::raise_window for an easier but much more limited way to reorder.

Source

pub fn set_cursor( &mut self, pixels: &[u8], size: Size<u16, Logical>, hotspot: Point<u16, Logical>, ) -> Result<(), ReplyOrIdError>

Set the default cursor used by X clients.

pixels is expected to be in rgba-format with each channel encoded as an u8.

This function will panic, if pixels is not at least size.w * size.h * 4 long.

Source

pub fn new_selection( &mut self, selection: SelectionTarget, mime_types: Option<Vec<String>>, ) -> Result<(), ReplyOrIdError>

Notify Xwayland of a new selection.

mime_types being None indicate there is no active selection anymore.

Source

pub fn send_selection( &mut self, selection_type: SelectionTarget, mime_type: String, fd: OwnedFd, ) -> Result<(), SelectionError>

Request to transfer the active selection for the provided mime_type to the provided file descriptor.

Source

pub fn set_xsettings( &mut self, settings: impl Iterator<Item = (String, Value)>, ) -> Result<(), SettingsError>

Updates XSETTINGS with the newly provided name/value-pairs.

Source

pub fn get_randr_primary_output(&self) -> Result<Option<String>, ReplyError>

Gets the current primary output as advertised by xrandr

Source

pub fn set_randr_primary_output( &mut self, output: Option<&Output>, ) -> Result<(), PrimaryOutputError>

Updates the primary output as advertised by xrandr

Trait Implementations§

Source§

impl Debug for X11Wm

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for X11Wm

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for X11Wm

§

impl !RefUnwindSafe for X11Wm

§

impl Send for X11Wm

§

impl Sync for X11Wm

§

impl Unpin for X11Wm

§

impl !UnwindSafe for X11Wm

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

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

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

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more