⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Surface

Struct Surface 

Source
pub struct Surface {
    pub id: u32,
    pub committed: SurfaceState,
    pub pending: SurfaceState,
    pub position: (i32, i32),
    pub size: (u32, u32),
    pub dirty: bool,
    pub mapped: bool,
    pub client_id: u32,
}
Expand description

A Wayland surface representing a renderable area.

Fields§

§id: u32

Surface ID (Wayland object ID)

§committed: SurfaceState

Committed (current) state – what the compositor reads

§pending: SurfaceState

Pending state – accumulated by attach/damage before commit

§position: (i32, i32)

Position in compositor coordinate space (set by shell role)

§size: (u32, u32)

Committed size (derived from buffer dimensions)

§dirty: bool

Whether this surface has new content since last composite

§mapped: bool

Whether the surface is mapped (has a committed buffer and a role)

§client_id: u32

Owning client ID

Implementations§

Source§

impl Surface

Source

pub fn new(id: u32) -> Self

Create a new unmapped surface.

Source

pub fn with_client(id: u32, client_id: u32) -> Self

Create a new surface with a specific client ID.

Source

pub fn attach_buffer(&mut self, buffer: Buffer)

Attach a buffer to the pending state (wl_surface.attach).

Source

pub fn attach_buffer_at(&mut self, buffer: Buffer, dx: i32, dy: i32)

Attach with an explicit offset.

Source

pub fn damage(&mut self, x: i32, y: i32, width: u32, height: u32)

Mark a damage region on the pending state (wl_surface.damage).

Source

pub fn damage_full(&mut self)

Mark the entire surface as damaged.

Source

pub fn commit(&mut self) -> Result<(), KernelError>

Commit pending state to committed state (wl_surface.commit).

This is the atomic state-swap that the Wayland protocol requires.

Source

pub fn has_buffer(&self) -> bool

Check whether this surface has a committed buffer.

Source

pub fn clear_dirty(&mut self)

Clear the dirty flag after the compositor has rendered this surface.

Auto Trait Implementations§

§

impl Freeze for Surface

§

impl RefUnwindSafe for Surface

§

impl Send for Surface

§

impl Sync for Surface

§

impl Unpin for Surface

§

impl UnwindSafe for Surface

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

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

Performs the conversion.
§

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

§

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

The type returned in the event of a conversion error.
§

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

Performs the conversion.