godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.15k stars 97 forks source link

Don't mark all input as handled when subwindow is focused #7743

Open 0x0ACB opened 1 year ago

0x0ACB commented 1 year ago

Describe the project you are working on

An RPG

Describe the problem or limitation you are having in your project

We ported this project from 3.x to 4.x. In 3.x we used the WindowDialog class which was removed in 4.x in favor of the Window class which extends Viewport. One of the issues we encountered with this change is that sub-windows will mark all input events as handled which kind of breaks the unhandled_input event. This means as long as you have a window open (and focused) e.g. an inventory, unhandled_input will no longer be fired. So it is impossible to, for example, move around while using the inventory or really any other window.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The change as implemented in this pr: https://github.com/godotengine/godot/pull/74592 changes this behavior to only mark actually handled input events as handled if local input handling is turned off (there is also the option of adding a separate flag for this)

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

https://github.com/godotengine/godot/pull/74592

If this enhancement will not be used often, can it be worked around with a few lines of script?

No, since this is done on the engine side. The only way to work around this is to implement a custom window manager not using the Window class.

Is there a reason why this should be core and not an add-on in the asset library?

It's part of the input handling of windows and can not be changed anywhere else.

crotron commented 1 year ago

I've been encountering this issue, or a consequence of it (if I understand it correctly). While a Window is focused, I assumed it would behave like windows in Linux/Windows, where you can give a window focus, hover the mouse over another element, and either release/transfer focus with mouse buttons besides the LMB, or turn the mouse wheel and have the other element receive that input without taking focus away from the window. The behavior seems to instead be that LMB is the only way to transfer focus or interact with any other element in this situation.