Skip to main content

Window

Struct Window 

Source
pub struct Window { /* private fields */ }
Expand description

An LVGL object that queues the events of its widgets for one consumer.

The fixed ring has crate::WINDOW_EVENT_QUEUE_CAPACITY regular slots. A separate slot holds a pending CloseRequested in arrival order. Further close requests merge into it until the consumer takes it.

Press repeats and state changes coalesce for the same target between lifecycle events. When the ring is full, higher-priority events can evict lower-priority events. Insert and Delete are low-priority notifications. Lifecycle events stay in arrival order. The queue reserves room for the end of each accepted press. If it rejects a press, it rejects its end.

Losses are counted (Window::dropped_event_count) and logged at most once per second. The crate README (“Window events”) details the policy.

Implementations§

Source§

impl Window

Source

pub unsafe fn new(parent: *mut lv_obj_t) -> Result<NonNull<Self>>

Create a new window.

The caller owns the new window: give it to OwnedWindow::from_raw, or delete it itself with lv_obj_delete, exactly once.

§Arguments
  • parent - The parent object of the window.
§Safety

parent must be a live LVGL object, and the caller must hold the graphics lock.

Source

pub unsafe fn peek_event(window: NonNull<Self>) -> Option<Event>

Read the oldest queued event without removing it.

§Safety

The caller holds the graphics lock and window points to a live Window.

Source

pub unsafe fn pop_event(window: NonNull<Self>) -> Option<Event>

Take the oldest queued event. See Window for the queue policy.

§Safety

The caller holds the graphics lock and window points to a live Window.

Source

pub unsafe fn dropped_event_count(window: NonNull<Self>) -> u32

Count events lost to queue overflow since the window was created.

§Safety

The caller holds the graphics lock and window points to a live Window.

Source

pub unsafe fn discard_events_for_target( window: NonNull<Self>, target: *mut lv_obj_t, )

Forget queued targets before LVGL can reuse their addresses. Retain press boundaries and close requests with a null target.

§Safety

The caller holds the graphics lock and window points to a live Window.

Source

pub unsafe fn from_raw(window: *mut lv_obj_t) -> Option<NonNull<Self>>

Convert a raw pointer to a window object.

§Returns
  • Window - The raw pointer to the window.
§Safety

The caller holds the graphics lock. window is null or points to a live LVGL object with the provenance of its full instance.

Auto Trait Implementations§

§

impl !Freeze for Window

§

impl !RefUnwindSafe for Window

§

impl !Send for Window

§

impl !Sync for Window

§

impl Unpin for Window

§

impl UnsafeUnpin 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.