Skip to content
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

Fix mouse entered notifications #88992

Merged

Conversation

Sauermann
Copy link
Contributor

Make sure, that a windows initial state is mouse_in_viewport = false. This makes sure, that the mouse entered notification is sent when the mouse hovers a window for the first time. (resolve #88942)

For embedded Windows, NOTIFICATION_WM_MOUSE_ENTER is currently sent twice in a row. Remove one of the places where it is sent. Window::_update_mouse_over() is the correct one, because there it is also called for native windows. (bug detected while investigating #88942)

Verified

This commit was created on github.com and signed with GitHub’s verified signature.
Make sure, that a windows initial state is `mouse_in_viewport = false`.
This makes sure, that the mouse entered notification is sent when the
mouse hovers a window for the first time.

For embedded Windows, `NOTIFICATION_WM_MOUSE_ENTER` is currently sent
twice in a row. Remove one of the places where it is sent.
`Window::_update_mouse_over()` is the correct one, because there it is
also called for native windows.
@Sauermann Sauermann added this to the 4.3 milestone Feb 29, 2024
@Sauermann Sauermann requested a review from a team as a code owner February 29, 2024 00:01
@akien-mga akien-mga requested a review from a team February 29, 2024 07:12
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rationale makes sense to me.

@akien-mga akien-mga merged commit 99ba251 into godotengine:master Feb 29, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@Sauermann Sauermann deleted the fix-window-mouse-notification branch February 29, 2024 17:22
@eviltrout
Copy link
Contributor

This commit broke my game, but I'm not sure if I'm doing the wrong thing or not hence me asking here rather than creating an issue.

In my game, there is a computer screen that you can interact with in a 3D world. The computer screen displays a viewport's texture, and events are proxied to it via sub_viewport.push_input(...)

Previously: my viewport was receiving InputEventMouseMotion inside it's controls via _gui_input, because the mouse_in_viewport bool was defaulting to true.

Now: InputEventMouseMotion events are not received by gui_input when push_input is used.

I found a workaround - I can call sub_viewport.notification(NOTIFICATION_VP_MOUSE_ENTER) to set the mouse_in_viewport flag from gdscript. When I do this, the mouse motion events are received as they were previously. Is this what I should be doing?

@Sauermann
Copy link
Contributor Author

@eviltrout thanks for the report. I will look into it.
If possible, a dedicated bug-report would be appreciated.

@eviltrout
Copy link
Contributor

Sure thing, here is the bug report: #89757

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Window mouse_entered signal only emits after the mouse enters and exits once the window
3 participants