-
Notifications
You must be signed in to change notification settings - Fork 920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove non-platform-consistent mouse events from X11 #3874
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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::CursorMoved
when 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/CursorLeft
on 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::CursorMoved
on 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.