winit/sctk: Update cursor position on touch event

Ideally pointer should be seperate from touch, but this should match how
Iced handles input in normal winit windows.

d475ae5b45/winit/src/window/state.rs (L165-L170)

With this, touch input for applets seems to work as expected in general.
This commit is contained in:
Ian Douglas Scott 2025-07-30 13:12:05 -07:00 committed by Ashley Wulber
parent 5924fea0b1
commit 9e45bd2378
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820

View file

@ -687,10 +687,23 @@ impl SctkEvent {
touch_id: _,
seat_id: _,
surface,
} => events.push((
surface_ids.get(&surface.id()).map(|id| id.inner()),
iced_runtime::core::Event::Touch(variant),
)),
} => {
let position = match variant {
touch::Event::FingerPressed { position, .. } => position,
touch::Event::FingerMoved { position, .. } => position,
touch::Event::FingerLifted { position, .. } => position,
touch::Event::FingerLost { position, .. } => position,
};
let id = surface_ids.get(&surface.id()).map(|id| id.inner());
if let Some(w) =
id.clone().and_then(|id| window_manager.get_mut(id))
{
w.state.set_logical_cursor_pos(
(position.x, position.y).into(),
);
}
events.push((id, iced_runtime::core::Event::Touch(variant)))
}
SctkEvent::WindowEvent { .. } => {}
SctkEvent::LayerSurfaceEvent {
variant,