-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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
Improve button behavior when multiple mouse buttons are used at the same time #93500
Conversation
Achievement unlocked: Break first unit test ^^;; Fixing. |
c81ab66
to
e2dce45
Compare
I fixed the test failing in Windows, but I can't reproduce the linux Linux failure on I wonder if I could somehow make the segfault happen on my machine... Maybe a VM similar to the cloud build or something? Is there a feasible way to do that? |
e2dce45
to
f388ef0
Compare
f388ef0
to
560dccb
Compare
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.
Tested locally, it works as expected.
Before
Notice how the hover stylebox lingers until I move the mouse again, even though the mouse is being blocked by the translucent control.
click_hover_before.mp4
After
click_hover_after.mp4
560dccb
to
f49dc5e
Compare
f49dc5e
to
818a2b7
Compare
I'm keeping this for 4.4 as changes to BaseButton and Viewport are historically prone to regressions, as this impacts a lot of the UI, both for the Godot editor and for games. We definitely need more unit and integration testing there to be able to make such changes with confidence. So the change is probably good, but it can use a full dev cycle to confirm that, hence 4.4. |
Thanks for the review! I'll look at this next week, when I'm no longer consumed by Godot Wild Jam. |
818a2b7
to
470ee29
Compare
Is there still something needed for this? |
Ref<InputEventMouseButton> mouse_button = p_event; | ||
if (mouse_button.is_valid()) { | ||
if (!has_point(mouse_button->get_position())) { | ||
status.hovering = false; | ||
} | ||
} |
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 don't see, how this removal has an impact on the MRPs of the initial issue description and of this PR.
Also wouldn't this removal create for certain projects situations, where the hovering status is kept true
, while it should be false
?
Perhaps this change could be investigated in a separate PR. The other two modifications are sufficient to resolve this problem in the issue description.
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.
See #93500 (comment)
This is because when clicking on a child with mouse filter pass, this can make the hovering state incorrect and then the button can no longer be clicked the second time.
So I think this should still be removed for this PR.
- I have also tested to make sure that Button flashing "hover" style after releasing away from it #33553 doesn't reappear with this removed.
The appearance when pressed and hovering over child is also incorrect, but this can be looked into later.
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 had forgotten about the MOUSE_FILTER_PASS case, I'll re-remove this.
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.
Thanks for the explanation. I agree.
5515d42
to
d389c88
Compare
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.
Code looks good.
Have tested with both available MRPs and didn't find any obvious problems.
…ame time - To emit `pressed`, buttons require that the press was initiated while hovering. - Controls can't grab focus from a mouse click if they're not hovered. - Hovers are updated both before and after a handled mouse button event.
d389c88
to
2033510
Compare
Thanks! |
pressed
, buttons require that the press was initiated while hovering.Fixes #93395.
An updated MRP that makes testing this even easier: button_mrp.zip