pub struct Window(/* private fields */);wayland_frontend and desktop only.Expand description
Represents a single application window
Implementations§
Source§impl Window
impl Window
Sourcepub fn downgrade(&self) -> WeakWindow
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
impl Window
Sourcepub fn new(toplevel: ToplevelSurface) -> Window
👎Deprecated
pub fn new(toplevel: ToplevelSurface) -> Window
Construct a new Window from a xdg toplevel surface
This function is deprecated. Use Window::new_wayland_window instead.
Sourcepub fn new_wayland_window(toplevel: ToplevelSurface) -> Window
pub fn new_wayland_window(toplevel: ToplevelSurface) -> Window
Construct a new Window from a xdg toplevel surface
Sourcepub fn new_x11_window(surface: X11Surface) -> Window
Available on crate feature xwayland only.
pub fn new_x11_window(surface: X11Surface) -> Window
xwayland only.Construct a new Window from an X11 surface
Sourcepub fn is_wayland(&self) -> bool
pub fn is_wayland(&self) -> bool
Checks if the window is a wayland one.
Sourcepub fn is_x11(&self) -> bool
Available on crate feature xwayland only.
pub fn is_x11(&self) -> bool
xwayland only.Checks if the window is an X11 one.
Sourcepub fn bbox(&self) -> Rectangle<i32, Logical>
pub fn bbox(&self) -> Rectangle<i32, Logical>
Returns a bounding box over this window and its children.
Sourcepub fn bbox_with_popups(&self) -> Rectangle<i32, Logical>
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.
Sourcepub fn set_activated(&self, active: bool) -> bool
pub fn set_activated(&self, active: bool) -> bool
Activate/Deactivate this window
Sourcepub fn send_ping(&self, serial: Serial) -> Result<(), PingError>
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.
Sourcepub fn send_frame<T, F>(
&self,
output: &Output,
time: T,
throttle: Option<Duration>,
primary_scan_out_output: F,
)
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
Sourcepub fn send_dmabuf_feedback<'a, P, F>(
&self,
output: &Output,
primary_scan_out_output: P,
select_dmabuf_feedback: F,
)where
P: FnMut(&WlSurface, &SurfaceData) -> Option<Output> + Copy,
F: Fn(&WlSurface, &SurfaceData) -> &'a DmabufFeedback + Copy,
pub fn send_dmabuf_feedback<'a, P, F>(
&self,
output: &Output,
primary_scan_out_output: P,
select_dmabuf_feedback: F,
)where
P: FnMut(&WlSurface, &SurfaceData) -> Option<Output> + Copy,
F: Fn(&WlSurface, &SurfaceData) -> &'a DmabufFeedback + Copy,
Sends the dmabuf feedback to all the subsurfaces in this window that requested it
See send_dmabuf_feedback_surface_tree for more information
Sourcepub fn take_presentation_feedback<F1, F2>(
&self,
output_feedback: &mut OutputPresentationFeedback,
primary_scan_out_output: F1,
presentation_feedback_flags: F2,
)
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
Sourcepub fn with_surfaces<F>(&self, processor: F)
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)
Sourcepub fn on_commit(&self)
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.
Sourcepub fn surface_under<P: Into<Point<f64, Logical>>>(
&self,
point: P,
surface_type: WindowSurfaceType,
) -> Option<(WlSurface, Point<i32, Logical>)>
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.
pointshould be relative to (0,0) of the window.
Sourcepub fn toplevel(&self) -> Option<&ToplevelSurface>
pub fn toplevel(&self) -> Option<&ToplevelSurface>
Returns the underlying xdg toplevel surface
Sourcepub fn x11_surface(&self) -> Option<&X11Surface>
Available on crate feature xwayland only.
pub fn x11_surface(&self) -> Option<&X11Surface>
xwayland only.Returns the underlying X11 surface
Sourcepub fn underlying_surface(&self) -> &WindowSurface
pub fn underlying_surface(&self) -> &WindowSurface
Returns the underlying surface
Sourcepub fn override_z_index(&self, z_index: u8)
pub fn override_z_index(&self, z_index: u8)
Override the z_index of this Window
Sourcepub fn user_data(&self) -> &UserDataMap
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
impl<R> AsRenderElements<R> for Window
Source§type RenderElement = WaylandSurfaceRenderElement<R>
type RenderElement = WaylandSurfaceRenderElement<R>
Source§impl SpaceElement for Window
impl SpaceElement for Window
Source§fn is_in_input_region(&self, point: &Point<f64, Logical>) -> bool
fn is_in_input_region(&self, point: &Point<f64, Logical>) -> bool
Source§fn set_activate(&self, activated: bool)
fn set_activate(&self, activated: bool)
Source§fn output_enter(&self, output: &Output, overlap: Rectangle<i32, Logical>)
fn output_enter(&self, output: &Output, overlap: Rectangle<i32, Logical>)
Source§fn output_leave(&self, output: &Output)
fn output_leave(&self, output: &Output)
Source§impl WaylandFocus for Window
impl WaylandFocus for Window
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> 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,
§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.