-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Drop physics mouseover as soon as the mouse moves over a Control #68019
Drop physics mouseover as soon as the mouse moves over a Control #68019
Conversation
It should be safe to cherry-pick this for Godot 3. |
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 there's something fishy in all this, but for the time being I can't propose anything better than this patch. I hope at some point I can really look deeply into some of the corner cases and hard edges of input handling that don't quite settle as robust enough to me.
@RandomShaper diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 43a2c9473e..ddf9cac7dd 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1669,6 +1669,9 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
_gui_cancel_tooltip();
if (over) {
+ if (!gui.mouse_over) {
+ _drop_physics_mouseover();
+ }
_gui_call_notification(over, Control::NOTIFICATION_MOUSE_ENTER);
gui.mouse_over = over;
}
@@ -3039,8 +3042,6 @@ bool Viewport::gui_is_drag_successful() const {
}
void Viewport::set_input_as_handled() {
- _drop_physics_mouseover();
-
if (!handle_input_locally) {
ERR_FAIL_COND(!is_inside_tree());
Viewport *vp = this; |
e3e2887
to
5cf6ebc
Compare
I have updated this patch with the mentioned change. This is a better method, because
That way the previously reported issue #29575 doesn't get reintroduced, while #61924 still gets solved. This kind of reverts #29579. |
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.
Looks good.
Thanks! |
fix #61924
alternative to #68018
_drop_physics_mouseover()
was added intoset_input_as_handled
as a fix for #29575 to drop physics mouseover when the mouse is over a control.The current implementation however doesn't check, if the mouse is actually over a Control, which leads to #61924, where physics-mouseover is dropped even if the mouse is not over a Control.
This patch changes the behavior, so that it is verified that the mouse is actually over a Control, before dropping physics mouseover.This patch doesn't call
_drop_physics_mouseover()
inset_input_as_handled
but as soon as the mouse enters the area of aControl
.