pub struct SurfaceState<S: Shell> { /* private fields */ }
Expand description

To support the current state and the pending state double buffering, the surface state must be deep cloneable.

Implementations§

source§

impl<S: Shell> SurfaceState<S>

source

pub fn new(surface: Rc<Surface<S>>) -> Self

Create a new surface state

source

pub fn stack(&self) -> &VecList<SurfaceStackEntry<S>>

Returns a reference to the surface stack in this surface state

source

pub fn stack_mut(&mut self) -> &mut VecList<SurfaceStackEntry<S>>

Returns unique reference to the surface stack in this surface state

source§

impl<S: Shell> SurfaceState<S>

source

pub fn parent(&self) -> Option<S::Token>

Returns the token of the parent surface state of this surface state, if any. None if this surface is not a subsurface.

source

pub fn top(this: S::Token, shell: &S) -> (S::Token, Point<i32, Surface>)

Find the top of the subtree rooted at this surface. Returns the token, and it’s offset relative to this surface.

source

pub fn next_in_stack( &self, index: Index<SurfaceStackEntry<S>>, shell: &S ) -> Option<(S::Token, Point<i32, Surface>)>

The the surface on top of the index surface in the subtree rooted at this surface. Returns the token, and it’s offset relative to this surface.

Example

Say surface A has stack “B A C D”, and surface D has stack “E D F G”. Then A.next_in_stack(C) will return E. Because D is the next surface of C in A’s stack, and the first surface of D’s stack is E.

source

pub fn bottom(this: S::Token, shell: &S) -> (S::Token, Point<i32, Surface>)

Find the bottom of the subtree rooted at this surface. Returns the token, and it’s offset relative to this surface.

Example

Say surface A has stack “B A C D”, and surface B has stack “E D F G”. Then A.bottom() will return E. Because B is the bottom of A’s immediate stack, and the bottom surface of B’s stack is E.

source

pub fn prev_in_stack( &self, index: Index<SurfaceStackEntry<S>>, shell: &S ) -> Option<(S::Token, Point<i32, Surface>)>

The the surface beneath the index surface in the subtree rooted at this surface. Returns the token, and it’s offset relative to this surface.

Example

Say surface A has stack “B A C D”, and surface C has stack “E C F G”. Then A.prev_in_stack(D) will return G. Because C is the previous surface of D in A’s stack, and the bottom most surface of C’s stack is G.

source

pub fn buffer_scale_f32(&self) -> Scale<NotNan<f32>>

Return the buffer scale

source

pub fn set_buffer_scale(&mut self, scale: u32)

Set the buffer scale

source

pub fn surface(&self) -> &Weak<Surface<S>>

Get a weak reference to the surface this surface state belongs to.

source

pub fn damage_buffer(&mut self)

Mark the surface’s buffer as damaged. No-op if the surface has no buffer.

source

pub fn set_buffer_from_object(&mut self, buffer: &Buffer<S::Buffer>)

Set the buffer.

source

pub fn buffer(&self) -> Option<&Rc<S::Buffer>>

Get a reference to the buffer.

source

pub fn add_frame_callback(&mut self, callback: u32)

Add a frame callback.

source

pub fn set_role_state<T: RoleState>(&mut self, state: T)

Set role related state.

source

pub fn role_state<T: RoleState>(&self) -> Option<Option<&T>>

Get a reference to the role related state.

None if there is no role related state assigned to this surface. Some(None) if T is not the correct type.

source

pub fn role_state_mut<T: RoleState>(&mut self) -> Option<Option<&mut T>>

Get a unique reference to the role related state.

None if there is no role related state assigned to this surface. Some(None) if T is not the correct type.

source

pub fn scan_for_freeing(token: S::Token, shell: &S, queue: &mut Vec<S::Token>)

Assuming token is going to be released, scan the tree for any transient children that can be freed as well, and append them to queue.

Trait Implementations§

source§

impl<S: Shell> Clone for SurfaceState<S>

source§

fn clone(&self) -> Self

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<S: Shell> Debug for SurfaceState<S>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> !RefUnwindSafe for SurfaceState<S>

§

impl<S> !Send for SurfaceState<S>

§

impl<S> !Sync for SurfaceState<S>

§

impl<S> Unpin for SurfaceState<S>where <S as Shell>::Token: Unpin,

§

impl<S> !UnwindSafe for SurfaceState<S>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dstwhere T: Cast<Dst>,

Casts the value.
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Src, Dst> CastFrom<Src> for Dstwhere Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

const: unstable · 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 Twhere U: From<T>,

const: unstable · 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<Src, Dst> LosslessTryInto<Dst> for Srcwhere Dst: LosslessTryFrom<Src>,

source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
source§

impl<Src, Dst> LossyInto<Dst> for Srcwhere Dst: LossyFrom<Src>,

source§

fn lossy_into(self) -> Dst

Performs the conversion.
source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dstwhere T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dstwhere T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
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
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dstwhere T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.