From 38b860bc32ae3a93d3ade9f3b72e5a33934866bf Mon Sep 17 00:00:00 2001 From: Harald Date: Mon, 9 Nov 2026 09:10:42 +0100 Subject: [PATCH] fix(pen): wake the app for pen events on Wayland (Issue #53) octotablet reads pen events from its own queue on winit's Wayland connection and only dispatches what is already there. winit read them from the socket but, finding none of its own events, went back to sleep without AboutToWait, so pen strokes waited until something else woke the loop: they showed up late or only after touching the screen. Until 0.39.3 the app redrew continuously, which hid this; the battery fix there exposed it. Every read from the socket now wakes the app. Idle CPU under a headless Wayland compositor stays at 0. Co-Authored-By: Claude Opus 5.5 --- vendor/winit/README.ink-notes.md | 4 ++++ .../src/platform_impl/linux/wayland/event_loop/mod.rs | 9 +++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/vendor/winit/README.ink-notes.md b/vendor/winit/README.ink-notes.md index f002643..0ffaf53 100644 --- a/vendor/winit/README.ink-notes.md +++ b/vendor/winit/README.ink-notes.md @@ -18,6 +18,10 @@ docs of the original crate were removed. timestamp of each touch event (Started, Moved, Ended), so ink-notes measures the swipe speed for gliding with the real event times and not with the time it got around to handling them (Issue #28). +- `src/platform_impl/linux/wayland/event_loop/mod.rs`: every read from the Wayland socket wakes + the app (`AboutToWait`), also when the events belong to another queue on the same connection. + octotablet's pen events live on such a queue and only `dispatch_pending` it, so before, pen + strokes waited until something else woke the loop (Issue #53). - `Cargo.toml`: `[lints.rust] warnings = "allow"`, because a path dependency is not built with capped lints like a crates.io dependency. diff --git a/vendor/winit/src/platform_impl/linux/wayland/event_loop/mod.rs b/vendor/winit/src/platform_impl/linux/wayland/event_loop/mod.rs index 6a42547..eaafc12 100644 --- a/vendor/winit/src/platform_impl/linux/wayland/event_loop/mod.rs +++ b/vendor/winit/src/platform_impl/linux/wayland/event_loop/mod.rs @@ -105,10 +105,11 @@ impl EventLoop { let wayland_dispatcher = calloop::Dispatcher::new(wayland_source, |_, queue, winit_state: &mut WinitState| { let result = queue.dispatch_pending(winit_state); - if result.is_ok() - && (!winit_state.events_sink.is_empty() - || !winit_state.window_compositor_updates.is_empty()) - { + // ink-notes patch: wake the app for every read from the socket, not only for + // winit's own events. Events for other queues on the same connection (pen + // input from octotablet's queue) would otherwise wait until something else + // wakes the loop, so pen strokes appeared late or not at all (Issue #53). + if result.is_ok() { winit_state.dispatched_events = true; } result