From 2bb657e8fcaf567a6275cbc1ee35945185a45cb2 Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Wed, 11 Mar 2026 08:05:03 +0100 Subject: [PATCH] feat(servo-shell): add weft-shell-protocol client-side binding Generate client-side protocol types from weft-shell-unstable-v1.xml using wayland-scanner, following the same module structure as the compositor server side. - crates/weft-servo-shell/src/protocols/mod.rs: generate_interfaces! inside __interfaces submodule, generate_client_code! at client module level, with use wayland_client in scope. Re-exports ZweftShellManagerV1 and ZweftShellWindowV1 for use by embed_servo once the Wayland connection is established. - New deps: wayland-client, wayland-backend, wayland-scanner, bitflags (version-matched to existing workspace resolution). The binding compiles but is not yet wired into embed_servo(); that connection is deferred until the Servo embedder contract is ready. --- Cargo.lock | 4 ++++ crates/weft-servo-shell/Cargo.toml | 4 ++++ crates/weft-servo-shell/src/main.rs | 2 ++ crates/weft-servo-shell/src/protocols/mod.rs | 20 ++++++++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 crates/weft-servo-shell/src/protocols/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 88f8309..11aa6c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2274,8 +2274,12 @@ name = "weft-servo-shell" version = "0.1.0" dependencies = [ "anyhow", + "bitflags 2.11.0", "tracing", "tracing-subscriber", + "wayland-backend", + "wayland-client", + "wayland-scanner", ] [[package]] diff --git a/crates/weft-servo-shell/Cargo.toml b/crates/weft-servo-shell/Cargo.toml index 3edc4fc..0a834b8 100644 --- a/crates/weft-servo-shell/Cargo.toml +++ b/crates/weft-servo-shell/Cargo.toml @@ -12,3 +12,7 @@ path = "src/main.rs" anyhow = "1.0" tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } +wayland-client = "0.31" +wayland-backend = "0.3" +wayland-scanner = "0.31" +bitflags = "2" diff --git a/crates/weft-servo-shell/src/main.rs b/crates/weft-servo-shell/src/main.rs index c040b46..c3e120f 100644 --- a/crates/weft-servo-shell/src/main.rs +++ b/crates/weft-servo-shell/src/main.rs @@ -2,6 +2,8 @@ use std::path::PathBuf; use anyhow::Context; +mod protocols; + fn main() -> anyhow::Result<()> { tracing_subscriber::fmt() .with_env_filter( diff --git a/crates/weft-servo-shell/src/protocols/mod.rs b/crates/weft-servo-shell/src/protocols/mod.rs new file mode 100644 index 0000000..31d9d8a --- /dev/null +++ b/crates/weft-servo-shell/src/protocols/mod.rs @@ -0,0 +1,20 @@ +#[allow(dead_code, non_camel_case_types, unused_unsafe, unused_variables)] +#[allow(non_upper_case_globals, non_snake_case, unused_imports)] +#[allow(missing_docs, clippy::all)] +pub mod client { + use wayland_client; + use wayland_client::protocol::*; + + pub mod __interfaces { + use wayland_client::protocol::__interfaces::*; + wayland_scanner::generate_interfaces!("../../protocol/weft-shell-unstable-v1.xml"); + } + use self::__interfaces::*; + + wayland_scanner::generate_client_code!("../../protocol/weft-shell-unstable-v1.xml"); +} + +#[allow(unused_imports)] +pub use client::zweft_shell_manager_v1::ZweftShellManagerV1; +#[allow(unused_imports)] +pub use client::zweft_shell_window_v1::ZweftShellWindowV1;