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: u32Surface ID (Wayland object ID)
committed: SurfaceStateCommitted (current) state – what the compositor reads
pending: SurfaceStatePending 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: boolWhether this surface has new content since last composite
mapped: boolWhether the surface is mapped (has a committed buffer and a role)
client_id: u32Owning client ID
Implementations§
Source§impl Surface
impl Surface
Sourcepub fn with_client(id: u32, client_id: u32) -> Self
pub fn with_client(id: u32, client_id: u32) -> Self
Create a new surface with a specific client ID.
Sourcepub fn attach_buffer(&mut self, buffer: Buffer)
pub fn attach_buffer(&mut self, buffer: Buffer)
Attach a buffer to the pending state (wl_surface.attach).
Sourcepub fn attach_buffer_at(&mut self, buffer: Buffer, dx: i32, dy: i32)
pub fn attach_buffer_at(&mut self, buffer: Buffer, dx: i32, dy: i32)
Attach with an explicit offset.
Sourcepub fn damage(&mut self, x: i32, y: i32, width: u32, height: u32)
pub fn damage(&mut self, x: i32, y: i32, width: u32, height: u32)
Mark a damage region on the pending state (wl_surface.damage).
Sourcepub fn damage_full(&mut self)
pub fn damage_full(&mut self)
Mark the entire surface as damaged.
Sourcepub fn commit(&mut self) -> Result<(), KernelError>
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.
Sourcepub fn has_buffer(&self) -> bool
pub fn has_buffer(&self) -> bool
Check whether this surface has a committed buffer.
Sourcepub fn clear_dirty(&mut self)
pub fn clear_dirty(&mut self)
Clear the dirty flag after the compositor has rendered this surface.