mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 22:31:30 +11:00
Fix TouchPhase::Ended
reporting on Wayland
When all the receive from the compositor is `TouchEvent::Down` and `TouchEvent::Up` for the same id, we would record the touch position in the touch_points vector the first time. On `TouchEvent::Up` we'd find it and report `TouchPhase::Ended` with that location. The next time we receive `TouchEvent::Down` for the same id, we'd however unconditionally append a new `TouchPoint` to `inner.touch_points`, with the new position. On release however we'd find the earlier point and report its location, which basically means that `TouchPhase::Ended` always and forever reported the location of the very first touch down event. Instead, this patch updates an existing touch point location with the same id on `TouchDown`. Fixes #1996
This commit is contained in:
parent
aac28d24ac
commit
a58400a82c
|
@ -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 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.
|
- 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.
|
- 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)
|
# 0.26.1 (2022-01-05)
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,16 @@ pub(super) fn handle_touch(
|
||||||
window_id,
|
window_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
|
inner
|
||||||
.touch_points
|
.touch_points
|
||||||
.push(TouchPoint::new(surface, position, id));
|
.push(TouchPoint::new(surface, position, id));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
TouchEvent::Up { id, .. } => {
|
TouchEvent::Up { id, .. } => {
|
||||||
let touch_point = match inner.touch_points.iter().find(|p| p.id == id) {
|
let touch_point = match inner.touch_points.iter().find(|p| p.id == id) {
|
||||||
Some(touch_point) => touch_point,
|
Some(touch_point) => touch_point,
|
||||||
|
|
Loading…
Reference in a new issue