Skip to content

winit: Fix cursor_position for touch events - #280

Merged
wash2 merged 1 commit into
masterfrom
touch
Mar 10, 2026
Merged

winit: Fix cursor_position for touch events#280
wash2 merged 1 commit into
masterfrom
touch

Conversation

@ids1024

@ids1024 ids1024 commented Mar 10, 2026

Copy link
Copy Markdown
Member

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.

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.

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.
@ids1024
ids1024 requested a review from wash2 March 10, 2026 01:27
@wash2
wash2 merged commit 4fb3ba2 into master Mar 10, 2026
4 of 30 checks passed
@wash2
wash2 deleted the touch branch March 10, 2026 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants