From 69d29ee3a80bc3a355520ee839d1fd23731a926a Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Wed, 11 Mar 2026 14:33:17 +0100 Subject: [PATCH] feat(protocol): add wl_surface arg to create_window in weft-shell-unstable-v1 Adds an optional (allow-null) wl_surface argument to zweft_shell_manager_v1::create_window. Shell-owned windows pass null; app-backed windows pass the backing wl_surface so the compositor can correlate the surface with a session_id from weft-appd. Updates WeftShellWindowData to store the surface, and updates the CreateWindow handler in state.rs and the two protocol unit tests. --- crates/weft-compositor/src/protocols/mod.rs | 3 +++ crates/weft-compositor/src/state.rs | 2 ++ protocol/weft-shell-unstable-v1.xml | 16 +++++++++------- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/crates/weft-compositor/src/protocols/mod.rs b/crates/weft-compositor/src/protocols/mod.rs index 860015a..a5d9ea1 100644 --- a/crates/weft-compositor/src/protocols/mod.rs +++ b/crates/weft-compositor/src/protocols/mod.rs @@ -28,6 +28,7 @@ pub struct WeftShellWindowData { pub app_id: String, pub title: String, pub role: String, + pub surface: Option, pub closed: std::sync::atomic::AtomicBool, } @@ -55,6 +56,7 @@ mod tests { app_id: "com.example.test".into(), title: "Test Window".into(), role: "normal".into(), + surface: None, closed: std::sync::atomic::AtomicBool::new(false), }; assert_eq!(d.app_id, "com.example.test"); @@ -69,6 +71,7 @@ mod tests { app_id: String::new(), title: String::new(), role: String::new(), + surface: None, closed: std::sync::atomic::AtomicBool::new(false), }; assert!(!d.closed.load(Ordering::Relaxed)); diff --git a/crates/weft-compositor/src/state.rs b/crates/weft-compositor/src/state.rs index 6aeaf75..33ab910 100644 --- a/crates/weft-compositor/src/state.rs +++ b/crates/weft-compositor/src/state.rs @@ -454,6 +454,7 @@ impl Dispatch for WeftCompositorState { app_id, title, role, + surface, x, y, width, @@ -465,6 +466,7 @@ impl Dispatch for WeftCompositorState { app_id, title, role, + surface, closed: std::sync::atomic::AtomicBool::new(false), }, ); diff --git a/protocol/weft-shell-unstable-v1.xml b/protocol/weft-shell-unstable-v1.xml index e7e6150..6281ac4 100644 --- a/protocol/weft-shell-unstable-v1.xml +++ b/protocol/weft-shell-unstable-v1.xml @@ -68,19 +68,21 @@ - - - - + - - -