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 app_id: String,
pub title: String, pub title: String,
pub role: String, pub role: String,
pub surface: Option<wayland_server::protocol::wl_surface::WlSurface>,
pub closed: std::sync::atomic::AtomicBool, pub closed: std::sync::atomic::AtomicBool,
} }
@ -55,6 +56,7 @@ mod tests {
app_id: "com.example.test".into(), app_id: "com.example.test".into(),
title: "Test Window".into(), title: "Test Window".into(),
role: "normal".into(), role: "normal".into(),
surface: None,
closed: std::sync::atomic::AtomicBool::new(false), closed: std::sync::atomic::AtomicBool::new(false),
}; };
assert_eq!(d.app_id, "com.example.test"); assert_eq!(d.app_id, "com.example.test");
@ -69,6 +71,7 @@ mod tests {
app_id: String::new(), app_id: String::new(),
title: String::new(), title: String::new(),
role: String::new(), role: String::new(),
surface: None,
closed: std::sync::atomic::AtomicBool::new(false), closed: std::sync::atomic::AtomicBool::new(false),
}; };
assert!(!d.closed.load(Ordering::Relaxed)); assert!(!d.closed.load(Ordering::Relaxed));

View file

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

View file

@ -68,19 +68,21 @@
</description> </description>
<arg name="id" type="new_id" interface="zweft_shell_window_v1" <arg name="id" type="new_id" interface="zweft_shell_window_v1"
summary="new window object"/> summary="new window object"/>
<arg name="app_id" type="string" <arg name="app_id" type="string"
summary="application identifier, reverse-DNS format"/> summary="application identifier, reverse-DNS format"/>
<arg name="title" type="string" <arg name="title" type="string"
summary="initial window title"/> summary="initial window title"/>
<arg name="role" type="string" <arg name="role" type="string"
summary="window role hint (normal, dialog, panel, overlay)"/> summary="window role hint (normal, dialog, panel, overlay)"/>
<arg name="x" type="int" <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"/> summary="requested x position in compositor logical coordinates"/>
<arg name="y" type="int" <arg name="y" type="int"
summary="requested y position in compositor logical coordinates"/> summary="requested y position in compositor logical coordinates"/>
<arg name="width" type="int" <arg name="width" type="int"
summary="requested width in compositor logical coordinates"/> summary="requested width in compositor logical coordinates"/>
<arg name="height" type="int" <arg name="height" type="int"
summary="requested height in compositor logical coordinates"/> summary="requested height in compositor logical coordinates"/>
</request> </request>