diff --git a/Cargo.lock b/Cargo.lock index 33a721e..73048a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1078,6 +1078,30 @@ dependencies = [ "system-deps", ] +[[package]] +name = "gdk4-wayland" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd34518488cd624a85e75e82540bc24c72cfeb0aea6bad7faed683ca3977dba0" +dependencies = [ + "gdk4", + "gdk4-wayland-sys", + "gio", + "glib", + "libc", +] + +[[package]] +name = "gdk4-wayland-sys" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c7a0f2332c531d62ee3f14f5e839ac1abac59e9b052adf1495124c00d89a34b" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -1837,6 +1861,7 @@ name = "lan-mouse-gtk" version = "0.2.0" dependencies = [ "async-channel", + "gdk4-wayland", "glib-build-tools", "gtk4", "hostname", diff --git a/lan-mouse-gtk/Cargo.toml b/lan-mouse-gtk/Cargo.toml index 81aa4c1..c656cce 100644 --- a/lan-mouse-gtk/Cargo.toml +++ b/lan-mouse-gtk/Cargo.toml @@ -8,14 +8,20 @@ repository = "https://github.com/feschber/lan-mouse" [dependencies] gtk = { package = "gtk4", version = "0.9.0", features = ["v4_2"] } -gdk4_wayland = { package = "gdk4-wayland", version="0.9.6" } adw = { package = "libadwaita", version = "0.7.0", features = ["v1_1"] } async-channel = { version = "2.1.1" } hostname = "0.4.0" log = "0.4.20" lan-mouse-ipc = { path = "../lan-mouse-ipc", version = "0.2.0" } thiserror = "2.0.0" -wayland-client = "0.31.12" + +[target.'cfg(all(unix, not(target_os="macos")))'.dependencies] +gdk4_wayland = { package = "gdk4-wayland", version="0.9.6", optional=true } [build-dependencies] glib-build-tools = { version = "0.20.0" } + + +[features] +default = ["wayland_window_identifier"] +wayland_window_identifier = ["dep:gdk4_wayland"] diff --git a/lan-mouse-gtk/src/lib.rs b/lan-mouse-gtk/src/lib.rs index d11dd9b..063811c 100644 --- a/lan-mouse-gtk/src/lib.rs +++ b/lan-mouse-gtk/src/lib.rs @@ -19,6 +19,7 @@ use gtk::{gio, glib, prelude::ApplicationExt}; use self::client_object::ClientObject; use self::key_object::KeyObject; +#[cfg(all(unix, feature = "wayland_window_identifier", not(target_os = "macos")))] use gdk4_wayland::WaylandToplevel; use thiserror::Error; @@ -128,6 +129,7 @@ fn build_ui(app: &Application) { // export TopLevel handle and send it to the service so that it can put the InpuCapture / RemoteDesktop // windows on top of it using xdg-foreign. + #[cfg(all(unix, feature = "wayland_window_identifier", not(target_os = "macos")))] window.connect_show(|window| { // needs the surface so we have to present first! if let Some(surface) = window.surface() {