Winit: On X11, touch events can move the cursor without CursorMoved event

Created on 5 Nov 2019  路  3Comments  路  Source: rust-windowing/winit

This is exemplified in KAS (easy to see in the calculator example):

  • cursor position is updated when a CursorMoved and CursorLeft events are received but not otherwise; other than as reported here this appears to be sufficient
  • widgets are highlighted based on the cursor position, as updated above
  • on X11, touch events (first finger only if multiple presses) move the mouse cursor; this may be because until relatively recently touch events simply emulated mouse clicks on X11
  • my app observes all touch events correctly
  • when the first touch event starts, my app observes the mouse position being moved via CursorMoved
  • when this touch moves (TouchPhase::Moved), X11 visually moves the mouse cursor, but my app does not receive CursorMoved events

Result: pressing a button with the finger and dragging off of it results in the start button being highlighted (because the app believes the mouse is hovering over it) and the button under the finger being highlighted (because the app highlights all drags).

I guess this is an X11 bug. What's your experience with issues like this?

X11 needs investigation bug

Most helpful comment

I've submitted PR #1297 to address this issue.

All 3 comments

It should be straightforward to have winit report a CursorMoved event in addition to Touch events on X11. I wonder, though, is there any possible configuration in which X11 does not move the mouse when a touch event occurs? We wouldn't want to falsely report CursorMoved in this case.

I'm not sure what the answer to that is. In theory whether touch events move the mouse should be configurable, but I haven't found out how.

I also tested Wayland where touch events do not move the mouse, thus this issue doesn't occur (probably the case on most platforms).

I've submitted PR #1297 to address this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

francesca64 picture francesca64  路  4Comments

felixrabe picture felixrabe  路  4Comments

Osspial picture Osspial  路  5Comments

k0nserv picture k0nserv  路  3Comments

ryanisaacg picture ryanisaacg  路  3Comments