Skip to content

Fix push_input events not going through after first pressed mouse event - #77730

Merged
YuriSizov merged 1 commit into
godotengine:masterfrom
Jummit:fix-subviewport-1
Jan 22, 2024
Merged

Fix push_input events not going through after first pressed mouse event#77730
YuriSizov merged 1 commit into
godotengine:masterfrom
Jummit:fix-subviewport-1

Conversation

@Jummit

@Jummit Jummit commented Jun 1, 2023

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

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

@AThousandShips AThousandShips left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Simplification suggestion

Comment thread scene/main/viewport.cpp Outdated
Subviewports didn't update their parent's local_input_handled correctly.

Fixes godotengine#76439.
@Jummit
Jummit force-pushed the fix-subviewport-1 branch from a4aa6d7 to 7957354 Compare December 2, 2023 19:30

@Sauermann Sauermann left a comment

Copy link
Copy Markdown
Contributor

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
@YuriSizov

Copy link
Copy Markdown
Contributor

Thanks!

@Jummit
Jummit deleted the fix-subviewport-1 branch January 23, 2024 08:34
BendyLand pushed a commit to BendyLand/voltaire that referenced this pull request Aug 2, 2026
Fix `push_input` events not going through after first pressed mouse event
BendyLand pushed a commit to BendyLand/voltaire that referenced this pull request Aug 2, 2026
Fix `push_input` events not going through after first pressed mouse event
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.

SubViewports inside SubViewportContainers don't receive events after using push_input with pressed InputEventMouseButton

6 participants