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

Notify users about window size changes #8788

Open
Sauermann opened this issue Jan 3, 2024 · 2 comments · May be fixed by godotengine/godot#87210
Open

Notify users about window size changes #8788

Sauermann opened this issue Jan 3, 2024 · 2 comments · May be fixed by godotengine/godot#87210

Comments

@Sauermann
Copy link

Sauermann commented Jan 3, 2024

Describe the project you are working on

Godot

Describe the problem or limitation you are having in your project

Accessing the notification, when the size of the root window changes is very unintuitive.
This problem has been discussed in the bug report godotengine/godot#79336 which was solved by improving the documentation. However the unintuitive way could be improved.

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

The problem itself can be solved by making NOTIFICATION_WM_SIZE_CHANGED available to child nodes of the window. That allows users to easily access when the root window is changed.
Since this change could have a negative performance impact, the performance impact needs to be evaluated beforehand.

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

Implementation is likely straightforward.
Whenever a Window receives a NOTIFICATION_WM_SIZE_CHANGED, it automatically sends the notification recursively to child nodes with the exception of other Window-nodes and their children.

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

In order to access the notifcation in the root window, one has to create a GDScript, that add a GDScript to the root node, that listens to notifications. A demo project of how to do that is available in godotengine/godot#79336 (comment).

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

This is a core behavior

@wgetJane
Copy link

wgetJane commented Jan 4, 2024

i think that emitting a signal would be more straightforward to implement and doesn't require handling the case of having another window as a child node

@kubasobon kubasobon linked a pull request Jan 15, 2024 that will close this issue
@Sauermann Sauermann changed the title Make `NOTIFICATION_WM_SIZE_CHANGED´ available to child nodes of the window Notify users about window size changes Jan 15, 2024
@kubasobon
Copy link

I agree with @wgetJane and @Sauermann, so I started godotengine/godot#87210 to present sample implementation and talk implementation details.

The fact that the only way to get consistently notified about window being resized is to set /root object script is not ideal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants