diff --git a/Cargo.lock b/Cargo.lock index e519b5c..b53338f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1946,7 +1946,6 @@ dependencies = [ "libadwaita", "log", "thiserror 2.0.12", - "wayland-client", ] [[package]] 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() {