From b81c595586046daffded40a13bd2f2b340760f9c Mon Sep 17 00:00:00 2001 From: Ferdinand Schober Date: Sat, 19 Sep 2026 10:54:52 +0200 Subject: [PATCH] disable example without wlroots --- input-emulation/Cargo.toml | 4 ++++ input-emulation/examples/keymap_fd_churn.rs | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/input-emulation/Cargo.toml b/input-emulation/Cargo.toml index 14385fd..4f67811 100644 --- a/input-emulation/Cargo.toml +++ b/input-emulation/Cargo.toml @@ -6,6 +6,10 @@ edition = "2021" license = "GPL-3.0-or-later" repository = "https://github.com/feschber/lan-mouse" +[[example]] +name = "keymap_fd_churn" +required-features = ["wlroots"] + [dependencies] async-trait = "0.1.80" futures = "0.3.28" diff --git a/input-emulation/examples/keymap_fd_churn.rs b/input-emulation/examples/keymap_fd_churn.rs index 4ea4e09..a66369f 100644 --- a/input-emulation/examples/keymap_fd_churn.rs +++ b/input-emulation/examples/keymap_fd_churn.rs @@ -24,22 +24,28 @@ //! Motion events are sent with dx and dy of zero so the example never moves the real //! cursor. +#[cfg(wlroots)] use input_emulation::{Backend, EmulationHandle, InputEmulation}; +#[cfg(wlroots)] use input_event::{Event, PointerEvent}; /// number of simulated peer reconnects +#[cfg(wlroots)] const ITERATIONS: u64 = 2000; /// how often to sample the descriptor count +#[cfg(wlroots)] const SAMPLE_EVERY: u64 = 100; /// counts open descriptors of this process. /// returns None rather than 0 when the count itself fails for lack of a descriptor, /// so an exhausted process is never reported as using none. +#[cfg(wlroots)] fn open_fds() -> Option { std::fs::read_dir("/proc/self/fd").ok().map(|d| d.count()) } +#[cfg(wlroots)] fn fds_display(fds: Option) -> String { match fds { Some(n) => n.to_string(), @@ -47,6 +53,7 @@ fn fds_display(fds: Option) -> String { } } +#[cfg(wlroots)] fn main() { let runtime = tokio::runtime::Builder::new_current_thread() .enable_all() @@ -130,3 +137,10 @@ fn main() { emulation.terminate().await; }); } + +#[cfg(not(wlroots))] +fn main() { + eprintln!("this example requires the wlroots backend, which is only built on"); + eprintln!("unix targets other than macos with the `wlroots` feature enabled"); + std::process::exit(1); +}