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
impl Compositor
Sourcepub fn set_output_size(&self, width: u32, height: u32)
pub fn set_output_size(&self, width: u32, height: u32)
Configure the output resolution. Allocates the back-buffer.
Sourcepub fn create_surface(&self, id: u32) -> Result<(), KernelError>
pub fn create_surface(&self, id: u32) -> Result<(), KernelError>
Register a new surface.
Sourcepub fn create_surface_for_client(
&self,
id: u32,
client_id: u32,
) -> Result<(), KernelError>
pub fn create_surface_for_client( &self, id: u32, client_id: u32, ) -> Result<(), KernelError>
Register a new surface owned by a specific client.
Sourcepub fn destroy_surface(&self, id: u32) -> Result<(), KernelError>
pub fn destroy_surface(&self, id: u32) -> Result<(), KernelError>
Destroy a surface and remove it from Z-order.
Sourcepub fn get_surface(&self, id: u32) -> Option<Surface>
pub fn get_surface(&self, id: u32) -> Option<Surface>
Get a read reference to a surface.
Sourcepub fn with_surface_mut<R, F: FnOnce(&mut Surface) -> R>(
&self,
id: u32,
f: F,
) -> Option<R>
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.
Sourcepub fn raise_surface(&self, id: u32)
pub fn raise_surface(&self, id: u32)
Raise a surface to the top of the Z-order stack.
Sourcepub fn set_surface_position(&self, id: u32, x: i32, y: i32)
pub fn set_surface_position(&self, id: u32, x: i32, y: i32)
Set a surface’s position in compositor coordinates.
Sourcepub fn request_composite(&self)
pub fn request_composite(&self)
Mark that compositing is needed.
Sourcepub fn composite(&self) -> Result<bool, KernelError>
pub fn composite(&self) -> Result<bool, KernelError>
Composite all visible, mapped surfaces in Z-order into the back-buffer.
- Clear back-buffer to desktop background color.
- For each surface (bottom to top), blit its committed buffer.
- Mark surfaces as clean.
Returns true if any pixels were actually drawn.
Sourcepub fn back_buffer(&self) -> Vec<u32>
pub fn back_buffer(&self) -> Vec<u32>
Get a snapshot of the back-buffer for presentation to hardware.
Sourcepub fn with_back_buffer<R, F: FnOnce(&[u32]) -> R>(&self, f: F) -> R
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.
Sourcepub fn with_back_buffer_mut<R, F: FnOnce(&mut [u32]) -> R>(&self, f: F) -> R
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.
Sourcepub fn set_surface_mapped(&self, id: u32, mapped: bool)
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.
Sourcepub fn output_size(&self) -> (u32, u32)
pub fn output_size(&self) -> (u32, u32)
Back-buffer dimensions.
Sourcepub fn surface_count(&self) -> usize
pub fn surface_count(&self) -> usize
Number of surfaces.