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 <noreply@anthropic.com>
This commit is contained in:
1 parent
055e39c24e
commit
38b860bc32
2 files changed
+9
-4
No files matched your search
Vendored
+4
@@ -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
|
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
|
for gliding with the real event times and not with the time it got around to handling them
|
||||||
(Issue #28).
|
(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
|
- `Cargo.toml`: `[lints.rust] warnings = "allow"`, because a path dependency is not built with
|
||||||
capped lints like a crates.io dependency.
|
capped lints like a crates.io dependency.
|
||||||
|
|
||||||
|
|||||||
@@ -105,10 +105,11 @@ impl<T: 'static> EventLoop<T> {
|
|||||||
let wayland_dispatcher =
|
let wayland_dispatcher =
|
||||||
calloop::Dispatcher::new(wayland_source, |_, queue, winit_state: &mut WinitState| {
|
calloop::Dispatcher::new(wayland_source, |_, queue, winit_state: &mut WinitState| {
|
||||||
let result = queue.dispatch_pending(winit_state);
|
let result = queue.dispatch_pending(winit_state);
|
||||||
if result.is_ok()
|
// ink-notes patch: wake the app for every read from the socket, not only for
|
||||||
&& (!winit_state.events_sink.is_empty()
|
// winit's own events. Events for other queues on the same connection (pen
|
||||||
|| !winit_state.window_compositor_updates.is_empty())
|
// 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;
|
winit_state.dispatched_events = true;
|
||||||
}
|
}
|
||||||
result
|
result
|
||||||
|
|||||||
Reference in new issue
Block a user