From 6b094831c0ab74bcd26b44c6517fec702190beab Mon Sep 17 00:00:00 2001 From: Sid Date: Mon, 25 May 2026 20:27:10 +0800 Subject: [PATCH] Make layer-shell edge capture less fragile --- input-capture/src/layer_shell.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/input-capture/src/layer_shell.rs b/input-capture/src/layer_shell.rs index 698c5849c..4cadc1521 100644 --- a/input-capture/src/layer_shell.rs +++ b/input-capture/src/layer_shell.rs @@ -144,6 +144,10 @@ impl AsRawFd for Inner { pub struct LayerShellInputCapture(AsyncFd); +// A 1px layer can miss edge entry on compositors that clamp cursor +// coordinates just inside the logical output bounds. +const EDGE_CAPTURE_THICKNESS: u32 = 4; + struct Window { buffer: wl_buffer::WlBuffer, surface: WlSurface, @@ -163,8 +167,8 @@ impl Window { let g = &state.globals; let (width, height) = match pos { - Position::Left | Position::Right => (1, size.1 as u32), - Position::Top | Position::Bottom => (size.0 as u32, 1), + Position::Left | Position::Right => (EDGE_CAPTURE_THICKNESS, size.1 as u32), + Position::Top | Position::Bottom => (size.0 as u32, EDGE_CAPTURE_THICKNESS), }; let mut file = tempfile::tempfile().unwrap(); draw(&mut file, (width, height));