Struct winit::platform_impl::linux::wayland::window::state::WindowState

source ·
pub struct WindowState {
Show 35 fields pub connection: Connection, pub shm: WlShm, custom_cursor_pool: Arc<Mutex<SlotPool>>, pub last_configure: Option<WindowConfigure>, pub pointers: Vec<Weak<ThemedPointer<WinitPointerData>>>, selected_cursor: SelectedCursor, pub cursor_visible: bool, pub pointer_constraints: Option<Arc<PointerConstraintsState>>, pub queue_handle: QueueHandle<WinitState>, theme: Option<Theme>, title: String, resizable: bool, seat_focus: HashSet<ObjectId>, scale_factor: f64, transparent: bool, compositor: Arc<CompositorState>, cursor_grab_mode: GrabState, ime_allowed: bool, ime_purpose: ImePurpose, text_inputs: Vec<ZwpTextInputV3>, size: LogicalSize<u32>, csd_fails: bool, decorate: bool, min_inner_size: LogicalSize<u32>, max_inner_size: Option<LogicalSize<u32>>, stateless_size: LogicalSize<u32>, initial_size: Option<Size>, frame_callback_state: FrameCallbackState, viewport: Option<WpViewport>, fractional_scale: Option<WpFractionalScaleV1>, blur: Option<OrgKdeKwinBlur>, blur_manager: Option<KWinBlurManager>, has_pending_move: Option<u32>, pub window: Window, frame: Option<AdwaitaFrame<WinitState>>,
}
Expand description

The state of the window which is being updated from the WinitState.

Fields§

§connection: Connection

The connection to Wayland server.

§shm: WlShm

The Shm to set cursor.

§custom_cursor_pool: Arc<Mutex<SlotPool>>§last_configure: Option<WindowConfigure>

The last received configure.

§pointers: Vec<Weak<ThemedPointer<WinitPointerData>>>

The pointers observed on the window.

§selected_cursor: SelectedCursor§cursor_visible: bool

Whether the cursor is visible.

§pointer_constraints: Option<Arc<PointerConstraintsState>>

Pointer constraints to lock/confine pointer.

§queue_handle: QueueHandle<WinitState>

Queue handle.

§theme: Option<Theme>

Theme variant.

§title: String

The current window title.

§resizable: bool

Whether the frame is resizable.

§seat_focus: HashSet<ObjectId>

Seats that has keyboard focus on that window.

§scale_factor: f64

The scale factor of the window.

§transparent: bool

Whether the window is transparent.

§compositor: Arc<CompositorState>

The state of the compositor to create WlRegions.

§cursor_grab_mode: GrabState

The current cursor grabbing mode.

§ime_allowed: bool

Whether the IME input is allowed for that window.

§ime_purpose: ImePurpose

The current IME purpose.

§text_inputs: Vec<ZwpTextInputV3>

The text inputs observed on the window.

§size: LogicalSize<u32>

The inner size of the window, as in without client side decorations.

§csd_fails: bool

Whether the CSD fail to create, so we don’t try to create them on each iteration.

§decorate: bool

Whether we should decorate the frame.

§min_inner_size: LogicalSize<u32>

Min size.

§max_inner_size: Option<LogicalSize<u32>>§stateless_size: LogicalSize<u32>

The size of the window when no states were applied to it. The primary use for it is to fallback to original window size, before it was maximized, if the compositor sends None for the new size in the configure.

§initial_size: Option<Size>

Initial window size provided by the user. Removed on the first configure.

§frame_callback_state: FrameCallbackState

The state of the frame callback.

§viewport: Option<WpViewport>§fractional_scale: Option<WpFractionalScaleV1>§blur: Option<OrgKdeKwinBlur>§blur_manager: Option<KWinBlurManager>§has_pending_move: Option<u32>

Whether the client side decorations have pending move operations.

The value is the serial of the event triggered moved.

§window: Window

The underlying SCTK window.

§frame: Option<AdwaitaFrame<WinitState>>

The window frame, which is created from the configure request.

Implementations§

source§

impl WindowState

source

pub fn new( connection: Connection, queue_handle: &QueueHandle<WinitState>, winit_state: &WinitState, initial_size: Size, window: Window, theme: Option<Theme>, ) -> Self

Create new window state.

source

fn apply_on_pointer<F: Fn(&ThemedPointer<WinitPointerData>, &WinitPointerData)>( &self, callback: F, )

Apply closure on the given pointer.

source

pub fn frame_callback_state(&self) -> FrameCallbackState

Get the current state of the frame callback.

source

pub fn frame_callback_received(&mut self)

The frame callback was received, but not yet sent to the user.

source

pub fn frame_callback_reset(&mut self)

Reset the frame callbacks state.

source

pub fn request_frame_callback(&mut self)

Request a frame callback if we don’t have one for this window in flight.

source

pub fn configure( &mut self, configure: WindowConfigure, shm: &Shm, subcompositor: &Option<Arc<SubcompositorState>>, ) -> bool

source

fn inner_size_bounds( &self, configure: &WindowConfigure, ) -> (Option<NonZeroU32>, Option<NonZeroU32>)

Compute the bounds for the inner size of the surface.

source

fn is_stateless(configure: &WindowConfigure) -> bool

source

pub fn drag_resize_window( &self, direction: ResizeDirection, ) -> Result<(), ExternalError>

Start interacting drag resize.

source

pub fn drag_window(&self) -> Result<(), ExternalError>

Start the window drag.

source

pub fn frame_click( &mut self, click: FrameClick, pressed: bool, seat: &WlSeat, serial: u32, timestamp: Duration, window_id: WindowId, updates: &mut Vec<WindowCompositorUpdate>, ) -> Option<bool>

Tells whether the window should be closed.

source

pub fn frame_point_left(&mut self)

source

pub fn frame_point_moved( &mut self, seat: &WlSeat, surface: &WlSurface, timestamp: Duration, x: f64, y: f64, ) -> Option<CursorIcon>

source

pub fn resizable(&self) -> bool

Get the stored resizable state.

source

pub fn set_resizable(&mut self, resizable: bool) -> bool

Set the resizable state on the window.

Returns true when the state was applied.

source

pub fn has_focus(&self) -> bool

Whether the window is focused by any seat.

source

pub fn ime_allowed(&self) -> bool

Whether the IME is allowed.

source

pub fn inner_size(&self) -> LogicalSize<u32>

Get the size of the window.

source

pub fn is_configured(&self) -> bool

Whether the window received initial configure event from the compositor.

source

pub fn is_decorated(&mut self) -> bool

source

pub fn outer_size(&self) -> LogicalSize<u32>

Get the outer size of the window.

source

pub fn pointer_entered(&mut self, added: Weak<ThemedPointer<WinitPointerData>>)

Register pointer on the top-level.

source

pub fn pointer_left(&mut self, removed: Weak<ThemedPointer<WinitPointerData>>)

Pointer has left the top-level.

source

pub fn refresh_frame(&mut self) -> bool

Refresh the decorations frame if it’s present returning whether the client should redraw.

source

pub fn reload_cursor_style(&mut self)

Reload the cursor style on the given window.

source

pub fn reload_transparency_hint(&self)

Reissue the transparency hint to the compositor.

source

pub fn request_inner_size(&mut self, inner_size: Size) -> PhysicalSize<u32>

Try to resize the window when the user can do so.

source

fn resize(&mut self, inner_size: LogicalSize<u32>)

Resize the window to the new inner size.

source

pub fn scale_factor(&self) -> f64

Get the scale factor of the window.

source

pub fn set_cursor(&mut self, cursor_icon: CursorIcon)

Set the cursor icon.

source

pub(crate) fn set_custom_cursor(&mut self, cursor: RootCustomCursor)

Set the custom cursor icon.

source

fn apply_custom_cursor(&self, cursor: &CustomCursor)

source

pub fn set_min_inner_size(&mut self, size: Option<LogicalSize<u32>>)

Set maximum inner window size.

source

pub fn set_max_inner_size(&mut self, size: Option<LogicalSize<u32>>)

Set maximum inner window size.

source

pub fn set_theme(&mut self, theme: Option<Theme>)

Set the CSD theme.

source

pub fn theme(&self) -> Option<Theme>

The current theme for CSD decorations.

source

pub fn set_cursor_grab( &mut self, mode: CursorGrabMode, ) -> Result<(), ExternalError>

Set the cursor grabbing state on the top-level.

source

pub fn reload_min_max_hints(&mut self)

Reload the hints for minimum and maximum sizes.

source

fn set_cursor_grab_inner( &mut self, mode: CursorGrabMode, ) -> Result<(), ExternalError>

Set the grabbing state on the surface.

source

pub fn show_window_menu(&self, position: LogicalPosition<u32>)

source

pub fn set_cursor_position( &self, position: LogicalPosition<f64>, ) -> Result<(), ExternalError>

Set the position of the cursor.

source

pub fn set_cursor_visible(&mut self, cursor_visible: bool)

Set the visibility state of the cursor.

source

pub fn set_decorate(&mut self, decorate: bool)

Whether show or hide client side decorations.

source

pub fn add_seat_focus(&mut self, seat: ObjectId)

Add seat focus for the window.

source

pub fn remove_seat_focus(&mut self, seat: &ObjectId)

Remove seat focus from the window.

source

pub fn set_ime_allowed(&mut self, allowed: bool) -> bool

Returns true if the requested state was applied.

source

pub fn set_ime_cursor_area( &self, position: LogicalPosition<u32>, size: LogicalSize<u32>, )

Set the IME position.

source

pub fn set_ime_purpose(&mut self, purpose: ImePurpose)

Set the IME purpose.

source

pub fn ime_purpose(&self) -> ImePurpose

Get the IME purpose.

source

pub fn set_scale_factor(&mut self, scale_factor: f64)

Set the scale factor for the given window.

source

pub fn set_blur(&mut self, blurred: bool)

Make window background blurred

source

pub fn set_title(&mut self, title: String)

Set the window title to a new value.

This will automatically truncate the title to something meaningful.

source

pub fn set_transparent(&mut self, transparent: bool)

Mark the window as transparent.

source

pub fn text_input_entered(&mut self, text_input: &ZwpTextInputV3)

Register text input on the top-level.

source

pub fn text_input_left(&mut self, text_input: &ZwpTextInputV3)

The text input left the top-level.

source

pub fn title(&self) -> &str

Get the cached title.

Trait Implementations§

source§

impl Drop for WindowState

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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> Downcast for T
where T: Any,

source§

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.
source§

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.
source§

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.
source§

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.
source§

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

source§

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

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