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

Compositor

Struct Compositor 

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

Wayland compositor state.

Owns all surfaces and the software back-buffer used for compositing.

Implementations§

Source§

impl Compositor

Source

pub fn new() -> Self

Create a new compositor. Dimensions default to 0 until set_output_size.

Source

pub fn set_output_size(&self, width: u32, height: u32)

Configure the output resolution. Allocates the back-buffer.

Source

pub fn create_surface(&self, id: u32) -> Result<(), KernelError>

Register a new surface.

Source

pub fn create_surface_for_client( &self, id: u32, client_id: u32, ) -> Result<(), KernelError>

Register a new surface owned by a specific client.

Source

pub fn destroy_surface(&self, id: u32) -> Result<(), KernelError>

Destroy a surface and remove it from Z-order.

Source

pub fn get_surface(&self, id: u32) -> Option<Surface>

Get a read reference to a surface.

Source

pub fn with_surface_mut<R, F: FnOnce(&mut Surface) -> R>( &self, id: u32, f: F, ) -> Option<R>

Execute a closure with mutable access to a surface.

Source

pub fn raise_surface(&self, id: u32)

Raise a surface to the top of the Z-order stack.

Source

pub fn set_surface_position(&self, id: u32, x: i32, y: i32)

Set a surface’s position in compositor coordinates.

Source

pub fn request_composite(&self)

Mark that compositing is needed.

Source

pub fn composite(&self) -> Result<bool, KernelError>

Composite all visible, mapped surfaces in Z-order into the back-buffer.

  1. Clear back-buffer to desktop background color.
  2. For each surface (bottom to top), blit its committed buffer.
  3. Mark surfaces as clean.

Returns true if any pixels were actually drawn.

Source

pub fn back_buffer(&self) -> Vec<u32>

Get a snapshot of the back-buffer for presentation to hardware.

Source

pub fn with_back_buffer<R, F: FnOnce(&[u32]) -> R>(&self, f: F) -> R

Execute a closure with a read-only reference to the back-buffer.

Avoids the 4MB clone that back_buffer() performs each call.

Source

pub fn with_back_buffer_mut<R, F: FnOnce(&mut [u32]) -> R>(&self, f: F) -> R

Execute a closure with a mutable reference to the back-buffer.

Used for overlay rendering (app switcher, launcher, notifications, screen lock) that draws directly into the composited back-buffer after composite() runs and before the hardware framebuffer blit.

Source

pub fn set_surface_mapped(&self, id: u32, mapped: bool)

Set whether a surface is mapped (visible during compositing).

The compositor skips unmapped surfaces during composite(). Used for virtual workspace switching to hide/show window surfaces.

Source

pub fn output_size(&self) -> (u32, u32)

Back-buffer dimensions.

Source

pub fn surface_count(&self) -> usize

Number of surfaces.

Trait Implementations§

Source§

impl Default for Compositor

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for Compositor

§

impl !RefUnwindSafe for Compositor

§

impl Send for Compositor

§

impl Sync for Compositor

§

impl Unpin for Compositor

§

impl UnwindSafe for Compositor

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.