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
impl WindowState
sourcepub fn new(
connection: Connection,
queue_handle: &QueueHandle<WinitState>,
winit_state: &WinitState,
initial_size: Size,
window: Window,
theme: Option<Theme>,
) -> Self
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.
sourcefn apply_on_pointer<F: Fn(&ThemedPointer<WinitPointerData>, &WinitPointerData)>(
&self,
callback: F,
)
fn apply_on_pointer<F: Fn(&ThemedPointer<WinitPointerData>, &WinitPointerData)>( &self, callback: F, )
Apply closure on the given pointer.
sourcepub fn frame_callback_state(&self) -> FrameCallbackState
pub fn frame_callback_state(&self) -> FrameCallbackState
Get the current state of the frame callback.
sourcepub fn frame_callback_received(&mut self)
pub fn frame_callback_received(&mut self)
The frame callback was received, but not yet sent to the user.
sourcepub fn frame_callback_reset(&mut self)
pub fn frame_callback_reset(&mut self)
Reset the frame callbacks state.
sourcepub fn request_frame_callback(&mut self)
pub fn request_frame_callback(&mut self)
Request a frame callback if we don’t have one for this window in flight.
pub fn configure( &mut self, configure: WindowConfigure, shm: &Shm, subcompositor: &Option<Arc<SubcompositorState>>, ) -> bool
sourcefn inner_size_bounds(
&self,
configure: &WindowConfigure,
) -> (Option<NonZeroU32>, Option<NonZeroU32>)
fn inner_size_bounds( &self, configure: &WindowConfigure, ) -> (Option<NonZeroU32>, Option<NonZeroU32>)
Compute the bounds for the inner size of the surface.
fn is_stateless(configure: &WindowConfigure) -> bool
sourcepub fn drag_resize_window(
&self,
direction: ResizeDirection,
) -> Result<(), ExternalError>
pub fn drag_resize_window( &self, direction: ResizeDirection, ) -> Result<(), ExternalError>
Start interacting drag resize.
sourcepub fn drag_window(&self) -> Result<(), ExternalError>
pub fn drag_window(&self) -> Result<(), ExternalError>
Start the window drag.
sourcepub fn frame_click(
&mut self,
click: FrameClick,
pressed: bool,
seat: &WlSeat,
serial: u32,
timestamp: Duration,
window_id: WindowId,
updates: &mut Vec<WindowCompositorUpdate>,
) -> Option<bool>
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.
pub fn frame_point_left(&mut self)
pub fn frame_point_moved( &mut self, seat: &WlSeat, surface: &WlSurface, timestamp: Duration, x: f64, y: f64, ) -> Option<CursorIcon>
sourcepub fn set_resizable(&mut self, resizable: bool) -> bool
pub fn set_resizable(&mut self, resizable: bool) -> bool
Set the resizable state on the window.
Returns true
when the state was applied.
sourcepub fn ime_allowed(&self) -> bool
pub fn ime_allowed(&self) -> bool
Whether the IME is allowed.
sourcepub fn inner_size(&self) -> LogicalSize<u32>
pub fn inner_size(&self) -> LogicalSize<u32>
Get the size of the window.
sourcepub fn is_configured(&self) -> bool
pub fn is_configured(&self) -> bool
Whether the window received initial configure event from the compositor.
pub fn is_decorated(&mut self) -> bool
sourcepub fn outer_size(&self) -> LogicalSize<u32>
pub fn outer_size(&self) -> LogicalSize<u32>
Get the outer size of the window.
sourcepub fn pointer_entered(&mut self, added: Weak<ThemedPointer<WinitPointerData>>)
pub fn pointer_entered(&mut self, added: Weak<ThemedPointer<WinitPointerData>>)
Register pointer on the top-level.
sourcepub fn pointer_left(&mut self, removed: Weak<ThemedPointer<WinitPointerData>>)
pub fn pointer_left(&mut self, removed: Weak<ThemedPointer<WinitPointerData>>)
Pointer has left the top-level.
sourcepub fn refresh_frame(&mut self) -> bool
pub fn refresh_frame(&mut self) -> bool
Refresh the decorations frame if it’s present returning whether the client should redraw.
sourcepub fn reload_cursor_style(&mut self)
pub fn reload_cursor_style(&mut self)
Reload the cursor style on the given window.
sourcepub fn reload_transparency_hint(&self)
pub fn reload_transparency_hint(&self)
Reissue the transparency hint to the compositor.
sourcepub fn request_inner_size(&mut self, inner_size: Size) -> PhysicalSize<u32>
pub fn request_inner_size(&mut self, inner_size: Size) -> PhysicalSize<u32>
Try to resize the window when the user can do so.
sourcefn resize(&mut self, inner_size: LogicalSize<u32>)
fn resize(&mut self, inner_size: LogicalSize<u32>)
Resize the window to the new inner size.
sourcepub fn scale_factor(&self) -> f64
pub fn scale_factor(&self) -> f64
Get the scale factor of the window.
sourcepub fn set_cursor(&mut self, cursor_icon: CursorIcon)
pub fn set_cursor(&mut self, cursor_icon: CursorIcon)
Set the cursor icon.
sourcepub(crate) fn set_custom_cursor(&mut self, cursor: RootCustomCursor)
pub(crate) fn set_custom_cursor(&mut self, cursor: RootCustomCursor)
Set the custom cursor icon.
fn apply_custom_cursor(&self, cursor: &CustomCursor)
sourcepub fn set_min_inner_size(&mut self, size: Option<LogicalSize<u32>>)
pub fn set_min_inner_size(&mut self, size: Option<LogicalSize<u32>>)
Set maximum inner window size.
sourcepub fn set_max_inner_size(&mut self, size: Option<LogicalSize<u32>>)
pub fn set_max_inner_size(&mut self, size: Option<LogicalSize<u32>>)
Set maximum inner window size.
sourcepub fn set_cursor_grab(
&mut self,
mode: CursorGrabMode,
) -> Result<(), ExternalError>
pub fn set_cursor_grab( &mut self, mode: CursorGrabMode, ) -> Result<(), ExternalError>
Set the cursor grabbing state on the top-level.
sourcepub fn reload_min_max_hints(&mut self)
pub fn reload_min_max_hints(&mut self)
Reload the hints for minimum and maximum sizes.
sourcefn set_cursor_grab_inner(
&mut self,
mode: CursorGrabMode,
) -> Result<(), ExternalError>
fn set_cursor_grab_inner( &mut self, mode: CursorGrabMode, ) -> Result<(), ExternalError>
Set the grabbing state on the surface.
sourcepub fn set_cursor_position(
&self,
position: LogicalPosition<f64>,
) -> Result<(), ExternalError>
pub fn set_cursor_position( &self, position: LogicalPosition<f64>, ) -> Result<(), ExternalError>
Set the position of the cursor.
sourcepub fn set_cursor_visible(&mut self, cursor_visible: bool)
pub fn set_cursor_visible(&mut self, cursor_visible: bool)
Set the visibility state of the cursor.
sourcepub fn set_decorate(&mut self, decorate: bool)
pub fn set_decorate(&mut self, decorate: bool)
Whether show or hide client side decorations.
sourcepub fn add_seat_focus(&mut self, seat: ObjectId)
pub fn add_seat_focus(&mut self, seat: ObjectId)
Add seat focus for the window.
sourcepub fn remove_seat_focus(&mut self, seat: &ObjectId)
pub fn remove_seat_focus(&mut self, seat: &ObjectId)
Remove seat focus from the window.
sourcepub fn set_ime_allowed(&mut self, allowed: bool) -> bool
pub fn set_ime_allowed(&mut self, allowed: bool) -> bool
Returns true
if the requested state was applied.
sourcepub fn set_ime_cursor_area(
&self,
position: LogicalPosition<u32>,
size: LogicalSize<u32>,
)
pub fn set_ime_cursor_area( &self, position: LogicalPosition<u32>, size: LogicalSize<u32>, )
Set the IME position.
sourcepub fn set_ime_purpose(&mut self, purpose: ImePurpose)
pub fn set_ime_purpose(&mut self, purpose: ImePurpose)
Set the IME purpose.
sourcepub fn ime_purpose(&self) -> ImePurpose
pub fn ime_purpose(&self) -> ImePurpose
Get the IME purpose.
sourcepub fn set_scale_factor(&mut self, scale_factor: f64)
pub fn set_scale_factor(&mut self, scale_factor: f64)
Set the scale factor for the given window.
sourcepub fn set_title(&mut self, title: String)
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.
sourcepub fn set_transparent(&mut self, transparent: bool)
pub fn set_transparent(&mut self, transparent: bool)
Mark the window as transparent.
sourcepub fn text_input_entered(&mut self, text_input: &ZwpTextInputV3)
pub fn text_input_entered(&mut self, text_input: &ZwpTextInputV3)
Register text input on the top-level.
sourcepub fn text_input_left(&mut self, text_input: &ZwpTextInputV3)
pub fn text_input_left(&mut self, text_input: &ZwpTextInputV3)
The text input left the top-level.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WindowState
impl !RefUnwindSafe for WindowState
impl Send for WindowState
impl Sync for WindowState
impl Unpin for WindowState
impl !UnwindSafe for WindowState
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§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
.source§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
.source§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.source§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.