Window

Struct Window 

Source
pub struct Window(/* private fields */);
Available on crate features wayland_frontend and desktop only.
Expand description

Represents a single application window

Implementations§

Source§

impl Window

Source

pub fn downgrade(&self) -> WeakWindow

Create a weak reference to this window that does not prevent the inner resources from being dropped.

Source§

impl Window

Source

pub fn new(toplevel: ToplevelSurface) -> Window

👎Deprecated

Construct a new Window from a xdg toplevel surface

This function is deprecated. Use Window::new_wayland_window instead.

Source

pub fn new_wayland_window(toplevel: ToplevelSurface) -> Window

Construct a new Window from a xdg toplevel surface

Source

pub fn new_x11_window(surface: X11Surface) -> Window

Available on crate feature xwayland only.

Construct a new Window from an X11 surface

Source

pub fn id(&self) -> usize

Returns the window ID

Source

pub fn is_wayland(&self) -> bool

Checks if the window is a wayland one.

Source

pub fn is_x11(&self) -> bool

Available on crate feature xwayland only.

Checks if the window is an X11 one.

Source

pub fn geometry(&self) -> Rectangle<i32, Logical>

Returns the geometry of this window.

Source

pub fn bbox(&self) -> Rectangle<i32, Logical>

Returns a bounding box over this window and its children.

Source

pub fn bbox_with_popups(&self) -> Rectangle<i32, Logical>

Returns a bounding box over this window and children including popups.

Note: You need to use a PopupManager to track popups, otherwise the bounding box will not include the popups.

Source

pub fn set_activated(&self, active: bool) -> bool

Activate/Deactivate this window

Source

pub fn send_ping(&self, serial: Serial) -> Result<(), PingError>

Sends a ping to the window to check that the client is still responding.

For xdg_toplevel surfaces, you can implement XdgShellHandler::client_pong to be notified of replies.

For X11/XWayland surfaces, you can implement XwmHandler::ping_acked to be notified of replies.

Fails if the window’s underlying surface does not support a ping protocol, is dead, or already has a pending ping.

Source

pub fn send_frame<T, F>( &self, output: &Output, time: T, throttle: Option<Duration>, primary_scan_out_output: F, )

Sends the frame callback to all the subsurfaces in this window that requested it

See send_frames_surface_tree for more information

Source

pub fn send_dmabuf_feedback<'a, P, F>( &self, output: &Output, primary_scan_out_output: P, select_dmabuf_feedback: F, )

Sends the dmabuf feedback to all the subsurfaces in this window that requested it

See send_dmabuf_feedback_surface_tree for more information

Source

pub fn take_presentation_feedback<F1, F2>( &self, output_feedback: &mut OutputPresentationFeedback, primary_scan_out_output: F1, presentation_feedback_flags: F2, )

Takes the PresentationFeedbackCallbacks from all subsurfaces in this window

see take_presentation_feedback_surface_tree for more information

Source

pub fn with_surfaces<F>(&self, processor: F)

Run a closure on all surfaces in this window (including it’s popups, if PopupManager is used)

Source

pub fn on_commit(&self)

Updates internal values

Needs to be called whenever the toplevel surface or any unsynchronized subsurfaces of this window are updated to correctly update the bounding box of this window.

Source

pub fn surface_under<P: Into<Point<f64, Logical>>>( &self, point: P, surface_type: WindowSurfaceType, ) -> Option<(WlSurface, Point<i32, Logical>)>

Finds the topmost surface under this point matching the input regions of the surface and returns it together with the location of this surface.

In case no surface input region matches the point None is returned.

  • point should be relative to (0,0) of the window.
Source

pub fn toplevel(&self) -> Option<&ToplevelSurface>

Returns the underlying xdg toplevel surface

Source

pub fn x11_surface(&self) -> Option<&X11Surface>

Available on crate feature xwayland only.

Returns the underlying X11 surface

Source

pub fn underlying_surface(&self) -> &WindowSurface

Returns the underlying surface

Source

pub fn override_z_index(&self, z_index: u8)

Override the z_index of this Window

Source

pub fn user_data(&self) -> &UserDataMap

Returns a UserDataMap to allow associating arbitrary data with this window.

Trait Implementations§

Source§

impl<R> AsRenderElements<R> for Window
where R: Renderer + ImportAll, R::TextureId: Clone + 'static,

Source§

type RenderElement = WaylandSurfaceRenderElement<R>

Type of the render element
Source§

fn render_elements<C: From<WaylandSurfaceRenderElement<R>>>( &self, renderer: &mut R, location: Point<i32, Physical>, scale: Scale<f64>, alpha: f32, ) -> Vec<C>

Returns render elements for a given position and scale
Source§

impl Clone for Window

Source§

fn clone(&self) -> Window

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Window

Source§

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

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

impl Hash for Window

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IsAlive for Window

Source§

fn alive(&self) -> bool

Check if object is alive
Source§

impl PartialEq for Window

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl SpaceElement for Window

Source§

fn geometry(&self) -> Rectangle<i32, Logical>

Returns the geometry of this element. Read more
Source§

fn bbox(&self) -> Rectangle<i32, Logical>

Returns the bounding box of this element
Source§

fn is_in_input_region(&self, point: &Point<f64, Logical>) -> bool

Returns whenever a given point inside this element will be able to receive input
Source§

fn z_index(&self) -> u8

Gets the z-index of this element
Source§

fn set_activate(&self, activated: bool)

Set the rendered state to activated, if applicable to this element
Source§

fn output_enter(&self, output: &Output, overlap: Rectangle<i32, Logical>)

The element is displayed on a given output. Read more
Source§

fn output_leave(&self, output: &Output)

The element left a given output
Source§

fn refresh(&self)

Periodically called to update internal state, if necessary
Source§

impl WaylandFocus for Window

Source§

fn wl_surface(&self) -> Option<Cow<'_, WlSurface>>

Returns the underlying wl_surface, if any. Read more
Source§

fn same_client_as(&self, object_id: &ObjectId) -> bool

Returns true, if the underlying wayland object originates from the same client connection as the provided ObjectId. Read more
Source§

impl Eq for Window

Auto Trait Implementations§

§

impl Freeze for Window

§

impl !RefUnwindSafe for Window

§

impl Send for Window

§

impl Sync for Window

§

impl Unpin for Window

§

impl !UnwindSafe for Window

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

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,