-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Deprecate Viewport::handle_input_locally
#77926
base: master
Are you sure you want to change the base?
Conversation
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 (rebased on top of master
329652b), it works. With this PR, I get the following output when running the MRP from #76439:
InputEventMouseButton: button_index=0, mods=none, pressed=false, canceled=false, position=((0, 0)), button_mask=0, double_click=false
InputEventMouseButton: button_index=0, mods=none, pressed=true, canceled=false, position=((0, 0)), button_mask=0, double_click=false
InputEventMouseButton: button_index=0, mods=none, pressed=false, canceled=false, position=((0, 0)), button_mask=0, double_click=false
InputEventKey: keycode=(Unset), mods=none, physical=false, pressed=false, echo=false
That said, since the existing behavior is removed entirely (the property no longer does anything), this is a compatibility-breaking change. I would prefer keeping the existing behavior available if at all possible. If this can't be done, this is not necessarily a blocker, but it needs further discussion on communicating this change to users.
If you want to keep the existing behavior of However I believe, that this PR is the better alternative, because: I did ask on RC, what the intention of As #56502 shows, the current behavior of
This PR is in accordance to the "Prefer local solutions"-best practice by replacing a core-solution with a peripheral-solution, while #77730 extends the complexity of the current core-solution. A bonus is, that the peripheral-solution of this PR requires much less code, than the current core-solution. |
I just wanted to chime in since I opened #77730: I agree with Sauermann that the API is confusing and that this PR is a more sustainable solution. I doubt that many users are consciously using the |
Viewport::handle_input_locally
Moving to 4.2 as this doesn't seem urgent, and might be a bit rushed to deprecate an API just before 4.1 RC 1. Note that deprecating usually means keep the functionality working, but recommending not to use it (and recommending an alternative). This actually makes the API a no-op so it might as well remove it and break compatibility fully, if that's what we decide to do. Otherwise we could keep the local input handling functionality as deprecated and opt-in. |
3d70b97
to
9788937
Compare
8aabc0d
to
1840709
Compare
46b6b00
to
948c29e
Compare
7576cdb
to
78e6dc6
Compare
3a09109
to
1039be4
Compare
What confuses me is that the description of this API in the documentation is "when it's false, the current viewport doesn't mark this input as processed, but the parent viewport with this flag set to do so", but the viewport's code only sees this code (picture) for the handle_input_locally part of the inspection, it only checks the root viewport or window, and doesn't check the handle_input_locally of the parent viewport |
@L2750558108 I have noticed this inconsistency as well, but since this is such a negligible behavior, that apparently no user has noticed yet, my intention was to remove the whole thing instead of consolidating the code with the documentation. |
I agree. This feature is unknown-significance. Wholely remove it maybe better. |
Deprecate `Viewport::handle_input_locally` in favor of - an automatism in `SubViewportContainer`, that propagates the event handled state to the parent viewport - a parameter in `SubViewportContainer`, that decides, if input events should be sent to additional child SubViewports, when the event is set to handled in one of the SubViewports.
1039be4
to
93e1873
Compare
Deprecate
Viewport::handle_input_locally
in favor of:SubViewportContainer
, that propagates the event handled state to the parent viewportSubViewportContainer
, that decides, if input events should be sent to additional child SubViewports, when the event is set to handled in one of the SubViewports.The use-case, that
SubViewport.handle_input_locally = true
achieves, is to allow a single input event to be handled in multiple SubViewports of aSubViewportContainer
. However, this functionality is very inaccessible.This PR implements a different method to allow this functionality by adding
SubViewportContainer.send_input_to_all_viewports
.This change solves the problem of the automatic change of
SubViewport.handle_input_locally
(resolve #56502 (#46982))By doing this, it makes the mentioned functionality more reliable and accessible (resolve #89073)
revert #77730 and make sure, that #76439 is not reintroduced
revert #87385 and make sure, that #84258 is not reintroduced
takes ideas of #46994
Updated 2023-09-02: Changes to documentation.
Updated 2024-01-24: Fix merge conflict with #77730
Updated 2024-01-25: Fix merge conflict with #87385
Updated 2024-03-07: Rebase after pre-commit-hook changes, Implement a replacement for the
handle_input_locally
use-case.Updated 2024-09-15: Fix merge conflict