-
-
Notifications
You must be signed in to change notification settings - Fork 21k
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
Window.size_changed and NOTIFICATION_WM_SIZE_CHANGED are not triggered when "window.content_scale_mode == Window.ContentScaleMode.CONTENT_SCALE_MODE_VIEWPORT" #79336
Comments
Technically this works as expected, because the signal is only sent, when the size of the viewport changes Line 968 in 23318e8
Please try instead to watch for the notification |
After digging into this deeper, `NOTIFICATION_WM_SIZE_CHANGED´ is only sent to the Window, but not to the nodes inside the window. In your script, you listen for that notification in a node, that is inside the window. So in order to achieve your goal, you need to listen on the root node for that notification. Here is a demo project, how this can be done: RootSizeChange.zip Does this solve your problem? |
That's clever but what on earth ... is there really no way to simply be told, "Hey, the window was resized"? That seems like baseline functionality. |
Yes there is a way, @Sauermann demoed it for you |
Your definition of "simply" differs from mine. But sure, yeah ... |
It's very common in Godot to have to go up/down the node tree for certain things specific to certain node types. |
I'm sure you're right, I'll get used to doing things this way. |
The current behavior should be documented better. |
This is very confusing, please correct me if I didn't get this:
The only alternative is to follow the example above which consists of loading another script to the root node by running in some different script the following:
Where rw.gd contains the following:
If I got this right, this should not be considered a documentation issue only. If making the signals respond as most people would expect is for some reason not desired, maybe we should have some other signal to use instead. |
why not add a signal to Window (not Viewport) called something like i don't think one can argue that the current solution is elegant or intuitive at all |
While this is solved for now by adjusting the documentation, we should continue the discussion about improving the situation in the form of a proposal: godotengine/godot-proposals#8788 |
Godot version
v4.1.stable.official [9704596]
System information
Godot v4.1.stable - Windows 10.0.19044 - Vulkan (Compatibility) - NVIDIA GeForce GTX 1050 Ti (NVIDIA; 31.0.15.2647) - Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz (8 Threads)
Issue description
When using a ContentScaleMode equal to CONTENT_SCALE_MODE_VIEWPORT, the size_changed signal of the root window is not emited regardless of changing the size via code or resizing the window manually. not only the signal is not emited, but the notification is also not triggered. Look at output log:
Steps to reproduce
On a new project, on a new scene, create a script in the scene root, paste this script and run it
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: