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 push_input events not going through after first pressed mouse event #77730

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

Jummit
Copy link
Contributor

@Jummit Jummit commented Jun 1, 2023

Subviewports didn't update their parent's local_input_handled correctly.

The patch is basically the inverse of set_input_as_handled.

There is a small chance that this change is not the way to fix the issue, but it didn't create any problems in my case.

Fixes #76439.

Off-topic: Wow, that's some fast CI! Thanks Akien!

@Jummit Jummit requested a review from a team as a code owner June 1, 2023 13:28
@Chaosus Chaosus added this to the 4.1 milestone Jun 1, 2023
@akien-mga akien-mga modified the milestones: 4.1, 4.2 Jun 23, 2023
@YuriSizov YuriSizov modified the milestones: 4.2, 4.3 Oct 30, 2023
@YuriSizov YuriSizov requested a review from a team October 30, 2023 14:52
@Sauermann
Copy link
Contributor

This PR was discussed in a recent Input-PR review meeting together with #77926.
We ended up with asking Reduz for his opinion.

@Sauermann
Copy link
Contributor

This PR should be considered for 4.2 as a non-compatibility breaking alternative to #77926.

Copy link
Member

@AThousandShips AThousandShips left a comment

Choose a reason for hiding this comment

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

Simplification suggestion

scene/main/viewport.cpp Outdated Show resolved Hide resolved
Subviewports didn't update their parent's local_input_handled correctly.

Fixes godotengine#76439.
Copy link
Contributor

@Sauermann Sauermann left a comment

Choose a reason for hiding this comment

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

I have verified the problem of the linked issue and verified, that the MRP accurately represents the problem.
The MRP is still a problem in current master and this PR (rebased on [b9a3bd2]) solves the problem.

The code is in alignment with preexisting code

godot/scene/main/viewport.cpp

Lines 3657 to 3673 in d76c1d0

if (!handle_input_locally) {
ERR_FAIL_COND(!is_inside_tree());
Viewport *vp = this;
while (true) {
if (Object::cast_to<Window>(vp)) {
break;
}
if (!vp->get_parent()) {
break;
}
vp = vp->get_parent()->get_viewport();
}
if (vp != this) {
vp->set_input_as_handled();
return;
}
}
and it is looking good to me.

While I believe that #77926 (removal of handle_input_locally) is a better solution in the long term, I consider it unlikely that it will get reviews in the near future, so at the moment the best approach to fix the linked issue is this PR.

@YuriSizov YuriSizov merged commit e0f8cf4 into godotengine:master Jan 22, 2024
15 checks passed
@YuriSizov
Copy link
Contributor

Thanks!

@Jummit Jummit deleted the fix-subviewport-1 branch January 23, 2024 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants