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 for mouse events propagation after capturing mouse #64492

Closed

Conversation

kubecz3k
Copy link
Contributor

@kubecz3k kubecz3k commented Aug 16, 2022

When mouse is outside the window when Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) is called, then after calling Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) gui is not propagating some of the mouse events: buttons are not highlighted when mouse is hovering over them and some signals like mouse_entered/mouse_exited are not called.

This commit fixes this issue by removing redundant check in viewport - if viewport is receiving mouse movement events that means mouse must be inside the viewport so there is no need for such check.
It also removes gui.mouse_in_viewport member variable since it's not reliable - it's not updated at the time of mouse capturing.

closes #64438

This work was kindly sponsored by The Mirror

When mouse is outside the window when Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) is called, then after calling Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) gui is not propagating some of the mouse events: buttons are not highlighted when mouse is hovering over them and some signals like mouse_entered/mouse_exited are not called.

This commit fixes this issue by removing redundant check in viewport - if viewport is receiving mouse movement events that means mouse must be inside the viewport so there is no need for such check.
It also removes gui.mouse_in_viewport member variable since it's not reliable.
@kubecz3k kubecz3k requested a review from a team as a code owner August 16, 2022 11:37
@Chaosus Chaosus added this to the 4.0 milestone Aug 16, 2022
@YuriSizov
Copy link
Contributor

cc @groud

@Sauermann
Copy link
Contributor

if viewport is receiving mouse movement events that means mouse must be inside the viewport

This assumption is unfortunately not true. The current event propagation system sends mouse-events to viewports, even if the mouse is outside of the viewport, as described in #28833.

@akien-mga
Copy link
Member

Superseded by #68482.

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