1
0
Fork 0
forked from wry/wry

virtual-output: add support for virtual outputs

This commit is contained in:
Julian Orth 2026-03-17 18:42:49 +01:00
parent c25d17514d
commit 530e66ef78
27 changed files with 1480 additions and 9 deletions

View file

@ -1236,6 +1236,14 @@ impl ConfigClient {
self.send(&ClientMessage::SetTearingMode { connector, mode })
}
pub fn create_virtual_output(&self, name: &str) {
self.send(&ClientMessage::CreateVirtualOutput { name })
}
pub fn remove_virtual_output(&self, name: &str) {
self.send(&ClientMessage::RemoveVirtualOutput { name })
}
pub fn drm_devices(&self) -> Vec<DrmDevice> {
let res = self.send_with_response(&ClientMessage::GetDrmDevices);
get_response!(res, vec![], GetDrmDevices { devices });

View file

@ -852,6 +852,12 @@ pub enum ClientMessage<'a> {
GetConnectorByName {
name: &'a str,
},
CreateVirtualOutput {
name: &'a str,
},
RemoveVirtualOutput {
name: &'a str,
},
}
#[derive(Serialize, Deserialize, Debug)]

View file

@ -539,6 +539,7 @@ pub mod connector_type {
pub const CON_SPI: ConnectorType = ConnectorType(19);
pub const CON_USB: ConnectorType = ConnectorType(20);
pub const CON_EMBEDDED_WINDOW: ConnectorType = ConnectorType(u32::MAX);
pub const CON_VIRTUAL_OUTPUT: ConnectorType = ConnectorType(u32::MAX - 1);
}
/// A *Direct Rendering Manager* (DRM) device.
@ -730,6 +731,25 @@ pub fn set_tearing_mode(mode: TearingMode) {
get!().set_tearing_mode(None, mode)
}
/// Creates a virtual output with the given name.
///
/// This is a no-op if a virtual output with that name already exists.
///
/// The created connector can be accessed with [`get_connector_by_name("VO-{name}")`].
///
/// A newly created connector is initially disabled. When a connector is destroyed and
/// later recreated, its previous state is restored.
pub fn create_virtual_output(name: &str) {
get!().create_virtual_output(name);
}
/// Removes the virtual output with the given name.
///
/// This is a no-op if a virtual output with that name does not exist.
pub fn remove_virtual_output(name: &str) {
get!().remove_virtual_output(name);
}
/// A graphics format.
#[derive(Serialize, Deserialize, Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub struct Format(pub u32);