Some widgets check the cursor position when handling the touch down
event, so we need to make sure `cursor_position` is set then, and not
only when there is a touch move event. Simply always setting it for
`WindowEvent::PointerButton` (for touch or mouse input) seems
reasonable.
We also need to avoid clearing `cursor_position` for `PointerLeft`
with a touch device. Do that only for mouse input.
Ideally Iced would handle touch input without tying to
`cursor_position`, but this should match the behavior of upstream Iced.
This seems to fix regressions since the Iced rebase in the `tour`
example, and in `cosmic-files`. `cosmic-files` seems to have some
issue using the menus with a touch device, but that doesn't seem to be a
regression.
- Should test `!= 0`, not `> 0`; can scroll in either direction
- Test both vertical and horizontal
- Use `value120` scroll if present (in which case, discrete is 0)
I guess events should really have both line and pixel scroll, since some
widgets want to use the pixel scroll values for input devices that have
both? But I guess winit and Iced both need to be changed for that...
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 reverts commit 15547dec8f83af1ea6dbed1964302400fc17c257 from
https://github.com/pop-os/iced/pull/227.
This is causing issues in `cosmic-workspaces`. It seems I didn't test it
properly outside the examples here... and this misinterpreted exactly
what the (undocumented) `viewport` argument means (Iced's `image` widget also
needed a fix to handle viewports properly since our fork:
https://github.com/iced-rs/iced/pull/2752).
It should be possible to fix, but revert for now.