From 00fdaf5b9f9883ae0f3e296b8a50ba8cb94efc1b Mon Sep 17 00:00:00 2001 From: Nova Date: Fri, 11 Jul 2025 16:37:52 -0700 Subject: [PATCH] feat(wayland): virtual output --- src/wayland/core/output.rs | 27 ++++++++++++++++++++++++--- src/wayland/core/registry.rs | 3 ++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/wayland/core/output.rs b/src/wayland/core/output.rs index e890254..4f2e87b 100644 --- a/src/wayland/core/output.rs +++ b/src/wayland/core/output.rs @@ -5,12 +5,33 @@ use waynest::{ pub use waynest::server::protocol::core::wayland::wl_output::*; -#[derive(Debug, Dispatcher, Default)] -pub struct Output; +#[derive(Debug, Dispatcher)] +pub struct Output(pub ObjectId); +impl Output { + pub async fn advertise_outputs(&self, client: &mut Client) -> Result<()> { + self.geometry( + client, + self.0, + 2048, + 2048, + 0, + 0, + Subpixel::None, + "Stardust Virtual Display".to_string(), + "Stardust Virtual Display".to_string(), + Transform::Normal, + ) + .await?; + self.mode(client, self.0, Mode::Current, 2048, 2048, 0) + .await?; + + self.done(client, self.0).await + } +} impl WlOutput for Output { /// https://wayland.app/protocols/wayland#wl_output:request:release async fn release(&self, _client: &mut Client, _sender_id: ObjectId) -> Result<()> { - todo!() + Ok(()) } } diff --git a/src/wayland/core/registry.rs b/src/wayland/core/registry.rs index ddcd62b..4c14d46 100644 --- a/src/wayland/core/registry.rs +++ b/src/wayland/core/registry.rs @@ -128,7 +128,8 @@ impl WlRegistry for Registry { } RegistryGlobals::OUTPUT => { tracing::info!("Binding output"); - client.insert(new_id.object_id, Output); + let output = client.insert(new_id.object_id, Output(new_id.object_id)); + output.advertise_outputs(client).await?; } RegistryGlobals::DMABUF => { tracing::info!("Binding dmabuf");