rs::state

Struct Application

Source
pub struct Application {
    pub im: InputMethod,
    pub visibility_override: State,
    pub physical_keyboard: Presence,
    pub debug_mode_enabled: bool,
    pub preferred_output: Option<OutputId>,
    pub outputs: HashMap<OutputId, OutputState>,
    pub layout_choice: LayoutChoice,
    pub overlay_layout: Option<LayoutId>,
}
Expand description

The actual logic of the program. At this moment, limited to calculating visibility and IM hints.

It keeps the panel visible for a short time period after each hide request. This prevents flickering on quick successive enable/disable events. It does not treat user-driven hiding in a special way.

This is the “functional core”. All state changes return the next state and the optimal time for the next check.

This state tracker can be driven by any event loop.

Fields§

§im: InputMethod§visibility_override: State§physical_keyboard: Presence§debug_mode_enabled: bool§preferred_output: Option<OutputId>

The output on which the panel should appear. This is stored as part of the state because it’s not clear how to derive the output from the rest of the state. It should probably follow the focused input, but not sure about being allowed on non-touch displays.

§outputs: HashMap<OutputId, OutputState>§layout_choice: LayoutChoice

We presume that the system always has some preference, even though we receive the preference after init, and we might not receive one at all (gsettings missing). Then a default is used.

§overlay_layout: Option<LayoutId>

Manual override of the system layout

Implementations§

Source§

impl Application

Source

pub fn new(now: Instant) -> Self

A conservative default, ignoring the actual state of things. It will initially show the keyboard for a blink.

Source

pub fn apply_event(self, event: Event, now: Instant) -> Self

Source

fn get_preferred_height_and_arrangement( output: &OutputState, ) -> Option<(PixelSize, ArrangementKind)>

Source

fn get_layout_names(&self) -> (String, Option<String>)

Returns layout name, overlay name

Trait Implementations§

Source§

impl ActorState for Application

Source§

fn get_next_wake(&self, now: Instant) -> Option<Instant>

Returns the next time to update the outcome.

Source§

type Event = Event

Source§

type Outcome = Outcome

Source§

fn apply_event(self, e: Self::Event, time: Instant) -> Self

Returns the new internal state after the event gets processed.
Source§

fn get_outcome(&self, now: Instant) -> Outcome

Returns the observable state of the actor given this internal state.
Source§

impl Clone for Application

Source§

fn clone(&self) -> Application

Returns a copy 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 Application

Source§

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

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

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

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