fix(input): keep waking while a finger is down so the lift arrives on time (Issue #28)

On Wayland the touch-up event could already sit in winit's queue, read
from the socket by the graphics driver, without waking the event loop.
It then only arrived together with the next touch, which stopped the
glide right away: Pia's log showed every lift handled 200-1000 ms late
while the compositor timestamps were 10 ms apart, and her screencast
shows the page stop dead after each swipe. The loop now wakes every
8 ms while a finger is on the screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
haraldandClaude Opus 5.5 committed 2026-10-30 09:42:34 +01:00
1 parent 19fc8dd3ca
commit 127bc8d730
1 file changed
+8
+8
View File
@@ -2471,6 +2471,11 @@ pub fn run_with(
|| is_stylus_drawing || is_stylus_drawing
|| is_stylus_in_proximity || is_stylus_in_proximity
|| fling.is_active() || fling.is_active()
// While a finger is down: on Wayland, the lift can already sit in winit's
// queue (read from the socket by the graphics driver) without waking the
// loop, and then only arrives with the next touch, which stops the glide
// right away (Issue #28)
|| !active_touches.is_empty()
{ {
target.set_control_flow(ControlFlow::wait_duration(Duration::from_millis(8))); target.set_control_flow(ControlFlow::wait_duration(Duration::from_millis(8)));
} else if let Some(at) = [ } else if let Some(at) = [
@@ -3710,6 +3715,9 @@ pub fn run_with(
match touch.phase { match touch.phase {
TouchPhase::Started => { TouchPhase::Started => {
// Jede neue Berührung hält ein gleitendes Blatt an // Jede neue Berührung hält ein gleitendes Blatt an
if debug_fling && fling.is_active() {
eprintln!("[Nachgleiten] Neuer Finger hält das Gleiten an");
}
fling.stop(); fling.stop();
// Event-Isolation für Touch-Eingaben // Event-Isolation für Touch-Eingaben
let is_touch_in_ui = ui::is_screen_point_in_ui( let is_touch_in_ui = ui::is_screen_point_in_ui(