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.
This commit is contained in:
Marco Allegretti 2026-03-11 14:33:17 +01:00
parent ca2cc38d4d
commit 69d29ee3a8
3 changed files with 14 additions and 7 deletions

View file

@ -28,6 +28,7 @@ pub struct WeftShellWindowData {
pub app_id: String,
pub title: String,
pub role: String,
pub surface: Option<wayland_server::protocol::wl_surface::WlSurface>,
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));

View file

@ -454,6 +454,7 @@ impl Dispatch<ZweftShellManagerV1, ()> for WeftCompositorState {
app_id,
title,
role,
surface,
x,
y,
width,
@ -465,6 +466,7 @@ impl Dispatch<ZweftShellManagerV1, ()> for WeftCompositorState {
app_id,
title,
role,
surface,
closed: std::sync::atomic::AtomicBool::new(false),
},
);

View file

@ -74,6 +74,8 @@
summary="initial window title"/>
<arg name="role" type="string"
summary="window role hint (normal, dialog, panel, overlay)"/>
<arg name="surface" type="object" interface="wl_surface" allow-null="true"
summary="wl_surface backing this window slot; null for shell-owned windows"/>
<arg name="x" type="int"
summary="requested x position in compositor logical coordinates"/>
<arg name="y" type="int"