-
Notifications
You must be signed in to change notification settings - Fork 927
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
No mouse events when unfocused on macOS #942
Comments
I'm pretty sure this is unintentional. Windows, at least, does indeed report mouse motion above unfocused windows. |
And X11 reports everything, including keyboard events to other programs (RIP security). |
This fixes an issue on macOS where a mouse click would be generated, without ever getting a mouse motion to the position before the click. This leads to the application thinking the mouse click occurred at a position other than the actual mouse location. This happens due to mouse motion above the window not automatically giving focus to the window, unless it is actually clicked, making it possible to move the window without motion events. Fixes rust-windowing#942.
This fixes an issue on macOS where a mouse click would be generated, without ever getting a mouse motion to the position before the click. This leads to the application thinking the mouse click occurred at a position other than the actual mouse location. This happens due to mouse motion above the window not automatically giving focus to the window, unless it is actually clicked, making it possible to move the window without motion events. Fixes rust-windowing#942.
This fixes an issue on macOS where a mouse click would be generated, without ever getting a mouse motion to the position before the click. This leads to the application thinking the mouse click occurred at a position other than the actual mouse location. This happens due to mouse motion above the window not automatically giving focus to the window, unless it is actually clicked, making it possible to move the window without motion events. Fixes rust-windowing#942.
* Report mouse motion before click This fixes an issue on macOS where a mouse click would be generated, without ever getting a mouse motion to the position before the click. This leads to the application thinking the mouse click occurred at a position other than the actual mouse location. This happens due to mouse motion above the window not automatically giving focus to the window, unless it is actually clicked, making it possible to move the window without motion events. Fixes #942. * Add additional mouse motion events Co-authored-by: Ryan Goldstein <[email protected]>
What if I want to change something in my window after just mouse move? E.g. highlight item on hover. It will work on unfocused window on linux but will not on macos. So I think this issue need more general fix. |
I don't think there's any intention to report mouse reports on unfocused windows on all platforms. In fact, some platforms like Wayland will do their best to prevent you from getting that information. If you want the user to interact with the window in any way, it has to be focused. |
* Report mouse motion before click This fixes an issue on macOS where a mouse click would be generated, without ever getting a mouse motion to the position before the click. This leads to the application thinking the mouse click occurred at a position other than the actual mouse location. This happens due to mouse motion above the window not automatically giving focus to the window, unless it is actually clicked, making it possible to move the window without motion events. Fixes rust-windowing#942. * Add additional mouse motion events Co-authored-by: Ryan Goldstein <[email protected]>
This has been reported to Alacritty in alacritty/alacritty#2475.
It looks like winit does not report mouse movements inside the window if it is currently unfocused. This makes it difficult to track mouse click positions since the mouse can "teleport" into position without being able to track it.
If this is an intentional design decision, I think that there's no way around reporting mouse position on click events, since a click might come in without any previous motion events at all.
This could be resolved with #883, but it might still make sense to report motions above the unfocused window, since I'm pretty sure other platforms do that?
The text was updated successfully, but these errors were encountered: