pub struct OutputManager { /* private fields */ }Expand description
Manages all display outputs and their configuration.
The output manager tracks the global coordinate layout, handles hotplug events, and provides queries for surface-to-output mapping.
Implementations§
Source§impl OutputManager
impl OutputManager
Sourcepub fn new_with_framebuffer(width: u32, height: u32) -> Self
pub fn new_with_framebuffer(width: u32, height: u32) -> Self
Create an output manager with a single virtual output matching the framebuffer dimensions.
Sourcepub fn add_output(&mut self, output: Output) -> u32
pub fn add_output(&mut self, output: Output) -> u32
Add a new output to the manager. Returns the assigned output ID.
Sourcepub fn remove_output(&mut self, id: u32) -> Option<Output>
pub fn remove_output(&mut self, id: u32) -> Option<Output>
Remove an output by ID.
If the removed output was primary, the next available output becomes primary. Returns the removed output if it existed.
Sourcepub fn get_output(&self, id: u32) -> Option<&Output>
pub fn get_output(&self, id: u32) -> Option<&Output>
Get a reference to an output by ID.
Sourcepub fn get_output_mut(&mut self, id: u32) -> Option<&mut Output>
pub fn get_output_mut(&mut self, id: u32) -> Option<&mut Output>
Get a mutable reference to an output by ID.
Sourcepub fn get_primary(&self) -> Option<&Output>
pub fn get_primary(&self) -> Option<&Output>
Get the primary output.
Sourcepub fn get_primary_id(&self) -> Option<u32>
pub fn get_primary_id(&self) -> Option<u32>
Get the primary output ID.
Sourcepub fn set_primary(&mut self, id: u32) -> Result<(), KernelError>
pub fn set_primary(&mut self, id: u32) -> Result<(), KernelError>
Set the primary output.
Sourcepub fn get_all_outputs(&self) -> Vec<&Output>
pub fn get_all_outputs(&self) -> Vec<&Output>
Get all outputs as a list of references.
Sourcepub fn output_count(&self) -> usize
pub fn output_count(&self) -> usize
Get the number of active outputs.
Sourcepub fn get_total_area(&self) -> (i32, i32, u32, u32)
pub fn get_total_area(&self) -> (i32, i32, u32, u32)
Calculate the total bounding rectangle across all outputs.
Returns (min_x, min_y, total_width, total_height) in global coords.
Sourcepub fn get_output_at_point(&self, x: i32, y: i32) -> Option<u32>
pub fn get_output_at_point(&self, x: i32, y: i32) -> Option<u32>
Find the output at a given point in global coordinates.
Returns the output ID if found.
Sourcepub fn set_scale(&mut self, id: u32, scale: u32) -> Result<(), KernelError>
pub fn set_scale(&mut self, id: u32, scale: u32) -> Result<(), KernelError>
Set the scale factor for an output.
Sourcepub fn set_position(
&mut self,
id: u32,
x: i32,
y: i32,
) -> Result<(), KernelError>
pub fn set_position( &mut self, id: u32, x: i32, y: i32, ) -> Result<(), KernelError>
Set the position of an output in global coordinates.
Sourcepub fn set_transform(
&mut self,
id: u32,
transform: OutputTransform,
) -> Result<(), KernelError>
pub fn set_transform( &mut self, id: u32, transform: OutputTransform, ) -> Result<(), KernelError>
Set the transform for an output.
Sourcepub fn handle_hotplug(&mut self, output: Output) -> u32
pub fn handle_hotplug(&mut self, output: Output) -> u32
Handle a hotplug event: add a new output to the right of existing outputs.
Returns the assigned output ID.
Sourcepub fn arrange_horizontal(&mut self)
pub fn arrange_horizontal(&mut self)
Arrange outputs side by side (left to right) in the order they were added.
Sourcepub fn arrange_vertical(&mut self)
pub fn arrange_vertical(&mut self)
Arrange outputs vertically (top to bottom).
Sourcepub fn set_enabled(&mut self, id: u32, enabled: bool) -> Result<(), KernelError>
pub fn set_enabled(&mut self, id: u32, enabled: bool) -> Result<(), KernelError>
Enable or disable an output.
Sourcepub fn scale_at_point(&self, x: i32, y: i32) -> u32
pub fn scale_at_point(&self, x: i32, y: i32) -> u32
Get the effective scale for a point in global coordinates.
Returns the scale factor of the output containing the point, or 1 if no output contains the point.
Sourcepub fn outputs_for_rect(&self, x: i32, y: i32, w: u32, h: u32) -> Vec<u32>
pub fn outputs_for_rect(&self, x: i32, y: i32, w: u32, h: u32) -> Vec<u32>
Get all outputs that overlap with a given rectangle.