From 00aca21731cd2e73df6969b810d7ffff31e22b57 Mon Sep 17 00:00:00 2001 From: Devan <68340659+DevanMetz@users.noreply.github.com> Date: Tue, 27 Oct 2026 20:04:36 -0500 Subject: [PATCH 1/2] Gate the Linux-only X11 fallback helpers so non-Linux clippy passes Show the app's output when the own-window test cannot find its window. --- src/engine.rs | 9 ++++++++- tests/own_window.rs | 9 +++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/engine.rs b/src/engine.rs index daa0e0a..d503f3f 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -13,7 +13,9 @@ use std::time::{Duration, Instant}; #[cfg(any(not(windows), test))] use enigo::Coordinate; -use enigo::{Button, Direction, Enigo, InputResult, Mouse, Settings as EnigoSettings}; +#[cfg(target_os = "linux")] +use enigo::Settings as EnigoSettings; +use enigo::{Button, Direction, Enigo, InputResult, Mouse}; use crate::config::{ClickStyle, JitterMode, MouseButton, PositionMode, Settings, TimingMode}; @@ -236,12 +238,14 @@ fn snapshot(settings: &Settings) -> Settings { /// Display name that is not a parseable X11 display and not a Wayland socket. /// Passing it forces that one backend to fail immediately, so the other is /// the only connection enigo keeps. +#[cfg(any(target_os = "linux", test))] const ISOLATED_DISPLAY: &str = "featherclick-no-display"; /// One attempt to open an input connection. /// /// `None` leaves that server to the environment. `Some` forces the name enigo /// will try, which is how a backend is kept out of the connection. +#[cfg(any(target_os = "linux", test))] struct BackendAttempt { wayland_display: Option, x11_display: Option, @@ -270,6 +274,9 @@ fn backend_attempts(wayland_is_set: bool) -> Vec { attempts } +/// Only the Linux X11 pointer fallback opens a connection with forced +/// display names; other platforms connect through `crate::input`. +#[cfg(target_os = "linux")] fn enigo_settings(attempt: &BackendAttempt) -> EnigoSettings { EnigoSettings { // Every extra millisecond of per-event delay is a millisecond off the diff --git a/tests/own_window.rs b/tests/own_window.rs index 66b3897..be0dc2b 100644 --- a/tests/own_window.rs +++ b/tests/own_window.rs @@ -124,7 +124,7 @@ fn xdotool(display: &str, args: &[&str]) -> std::process::Output { .unwrap_or_else(|err| panic!("xdotool {args:?} failed to start: {err}")) } -fn search_window(display: &str) -> String { +fn search_window(display: &str, gui: &Gui) -> String { let output = Command::new("timeout") .args([ "15", @@ -143,7 +143,8 @@ fn search_window(display: &str) -> String { let stderr = String::from_utf8_lossy(&output.stderr); assert!( output.status.success(), - "FeatherClick window did not appear\n{stdout}{stderr}" + "FeatherClick window did not appear\n{stdout}{stderr}\n{}", + gui.output() ); let mut best_area = i64::MIN; let mut best_id = None; @@ -494,7 +495,7 @@ fn pointer_mode_waits_on_the_window_then_clicks_where_the_pointer_moves() { compile_catcher(&scratch.catcher_bin); let mut gui = Gui::spawn(&display.name, &scratch.home); - let id = search_window(&display.name); + let id = search_window(&display.name, &gui); assert!( gui.alive(), "featherclick exited before the test\n{}", @@ -586,7 +587,7 @@ fn fixed_point_away_from_the_window_still_receives_clicks() { compile_catcher(&scratch.catcher_bin); let gui = Gui::spawn(&display.name, &scratch.home); - let id = search_window(&display.name); + let id = search_window(&display.name, &gui); window_move(&display.name, &id, 40, 40); thread::sleep(Duration::from_millis(200)); let window = geometry(&display.name, &id); From 4064042dccb099ddc6b3557c64259713c2a996ab Mon Sep 17 00:00:00 2001 From: Devan <68340659+DevanMetz@users.noreply.github.com> Date: Tue, 27 Oct 2026 20:07:02 -0500 Subject: [PATCH 2/2] Install libxkbcommon-x11 for the X11 GUI test in CI The own-window test launches the GUI on Xvfb, and winit's X11 backend panics at startup when libxkbcommon-x11.so is missing, which ubuntu-22.04 runners do not ship. --- .github/workflows/ci.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c79e15..3103e90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: run: | sudo apt-get update sudo apt-get install -y --no-install-recommends \ - pkg-config libxkbcommon-dev libwayland-dev libx11-dev libxcursor-dev \ + pkg-config libxkbcommon-dev libxkbcommon-x11-0 libwayland-dev libx11-dev libxcursor-dev \ libxrandr-dev libxi-dev libgl1-mesa-dev xvfb xdotool - name: Formatting diff --git a/README.md b/README.md index 989c544..d77a39c 100644 --- a/README.md +++ b/README.md @@ -245,7 +245,7 @@ cargo test Linux needs the usual winit build dependencies: ```sh -sudo apt install pkg-config libxkbcommon-dev libwayland-dev libx11-dev \ +sudo apt install pkg-config libxkbcommon-dev libxkbcommon-x11-0 libwayland-dev libx11-dev \ libxcursor-dev libxrandr-dev libxi-dev libgl1-mesa-dev ```