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
@@ -105,10 +105,11 @@ impl<T: 'static> EventLoop<T> {
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user