Remove non-platform-consistent mouse events from X11#3874
Remove non-platform-consistent mouse events from X11#3874daxpedda wants to merge 1 commit intorust-windowing:masterfrom
Conversation
| // Mouse cursor position changes when touch events are received. | ||
| // Only the first concurrently active touch ID moves the mouse cursor. | ||
| if is_first_touch(&mut self.first_touch, &mut self.num_touch, id, phase) { | ||
| let event = Event::WindowEvent { | ||
| window_id, | ||
| event: WindowEvent::CursorMoved { | ||
| device_id: mkdid(util::VIRTUAL_CORE_POINTER), | ||
| position: location.cast(), | ||
| }, | ||
| }; | ||
| callback(&self.target, event); | ||
| } | ||
|
|
There was a problem hiding this comment.
I think the point was that the touch moves the mouse pointer? In general, I'd hold it a bit until pointer overhual since it won't break things due to things being generic.
Right now I'm not sure, so I'd suggest to research why this code is here in the first place, since it's clearly fixing some not working thing.
There was a problem hiding this comment.
Its this #1261.
Which has a good use-case as well.
Will remove the removal of this part.
3504422 to
1cadba0
Compare
| let event = Event::WindowEvent { | ||
| window_id, | ||
| event: WindowEvent::CursorMoved { device_id: mkdid(pointer_id as _), position }, | ||
| }; |
There was a problem hiding this comment.
I tracked this down to #348.
While I do think this is a valid use-case, the current implementation is incorrect, because its also emits an event if the cursor is not inside the window.
For this to be solved we need to do it across all platforms and do it correctly.
My proposition would be to emit a CursorEntered when focus is gained if the cursor is inside the window.
On the other hand this might also be addressed by #2648.
Currently X11 will emit a
WindowEvent::CursorMovedwhen the window comes into focus, even if e.g. the cursor isn't inside the window.This is inconsistent with other platforms and can also be a bit misleading to users.
I believe in the future, we should use
CursorEntered/CursorLefton focus and unfocus on all backends to make this idea work properly. Emitting the cursor position in these events will be handled by #3833.The other case, is X11 emitting aWindowEvent::CursorMovedon the first touch point made in a touch interaction. I believe the idea behind this is to signify the user that the cursor has jumped to this location. However, this can again be misinterpreted by users and is not consistent between platforms.We are also unable to express this sort of pointer vs touch vs cursor with the current API, which would need its own separate discussion and motivation first.
I've encountered this while working on #3810 and #3833.