diff --git a/CHANGELOG.md b/CHANGELOG.md index 82ce7aee..2235fa83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ And please only add new entries to the top of this list, right below the `# Unre - On Windows, fix race issue creating fullscreen windows with `WindowBuilder::with_fullscreen` - On Android, `virtual_keycode` for `KeyboardInput` events is now filled in where a suitable match is found. - Added helper methods on `ControlFlow` to set its value. +- On Wayland, fix `TouchPhase::Ended` always reporting the location of the first touch down, unless the compositor + sent a cancel or frame event. # 0.26.1 (2022-01-05) diff --git a/src/platform_impl/linux/wayland/seat/touch/handlers.rs b/src/platform_impl/linux/wayland/seat/touch/handlers.rs index 8a17b393..d8790944 100644 --- a/src/platform_impl/linux/wayland/seat/touch/handlers.rs +++ b/src/platform_impl/linux/wayland/seat/touch/handlers.rs @@ -44,9 +44,15 @@ pub(super) fn handle_touch( window_id, ); - inner - .touch_points - .push(TouchPoint::new(surface, position, id)); + // For `TouchEvent::Up` we don't receive a position, so we're tracking active + // touch points. Update either a known touch id or register a new one. + if let Some(i) = inner.touch_points.iter().position(|p| p.id == id) { + inner.touch_points[i].position = position; + } else { + inner + .touch_points + .push(TouchPoint::new(surface, position, id)); + } } TouchEvent::Up { id, .. } => { let touch_point = match inner.touch_points.iter().find(|p| p.id == id) {