Expand description
Output advertising capabilities
This module provides a type helping you to handle the advertising of your compositor’s output and their capabilities to your client, as well as mapping your clients output request to your physical outputs.
How to use it
You need to instantiate an Output
for each output global you want to advertise to clients.
Just add it to your Display using the Output::new(..)
method. You can use the returned Output
to change
the properties of your output (if the current resolution mode changes for example),
it’ll automatically forward any changes to the clients.
use smithay::wayland::output::{Output, PhysicalProperties, Mode};
use wayland_server::protocol::wl_output;
// Create the Output with given name and physical properties
let (output, _output_global) = Output::new(
&mut display, // the display
"output-0".into(), // the name of this output,
PhysicalProperties {
width: 200, // width in mm
height: 150, // height in mm,
subpixel: wl_output::Subpixel::HorizontalRgb, // subpixel information
make: "Screens Inc".into(), // make of the monitor
model: "Monitor Ultra".into(), // model of the monitor
},
None // insert a logger here
);
// Now you can configure it
output.change_current_state(
Some(Mode { width: 1902, height: 1080, refresh: 60000 }), // the resolution mode,
Some(wl_output::Transform::Normal), // global screen transformation
Some(1), // global screen scaling factor
);
// set the preferred mode
output.set_preferred(Mode { width: 1920, height: 1080, refresh: 60000 });
// add other supported modes
output.add_mode(Mode { width: 800, height: 600, refresh: 60000 });
output.add_mode(Mode { width: 1024, height: 768, refresh: 60000 });
Structs
An output mode
An output as seen by the clients
The physical properties of an output