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:
parent
5924fea0b1
commit
9e45bd2378
1 changed files with 17 additions and 4 deletions
|
|
@ -687,10 +687,23 @@ impl SctkEvent {
|
||||||
touch_id: _,
|
touch_id: _,
|
||||||
seat_id: _,
|
seat_id: _,
|
||||||
surface,
|
surface,
|
||||||
} => events.push((
|
} => {
|
||||||
surface_ids.get(&surface.id()).map(|id| id.inner()),
|
let position = match variant {
|
||||||
iced_runtime::core::Event::Touch(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::WindowEvent { .. } => {}
|
||||||
SctkEvent::LayerSurfaceEvent {
|
SctkEvent::LayerSurfaceEvent {
|
||||||
variant,
|
variant,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue