You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the project settings, if stretch mode (display/window/stretch/mode) is set to viewport, the root window (get_tree().root) will not emit its size_changed signal.
This doesn't happen when stretch mode is set to disabled or canvas_items. It also only happens to the root window specifically, as children windows will still emit their size_changed signal normally even when their content_scale_mode is set to viewport.
Tested and reproducible in v4.3.beta3, v4.2.2.stable, and v4.0.stable.
Recording-2024-07-18_13.03.01.mp4
Steps to reproduce
Create a new project
Make a new script that connects with get_tree().root.size_changed signal. For example:
if stretch mode (display/window/stretch/mode) is set to viewport, the root window (get_tree().root) will not emit its size_changed signal.
This only happens when display/window/stretch/mode is set to viewportanddisplay/window/stretch/aspect is set to ignore or keep (but I assume this also happens with keep_width/keep_height when the height/width isn't being changed). When aspect is set to expand, the size_changed signal will be emitted when the window is resized through the window manager.
only happens to the root window
This does also happen for child windows with the same attributes, although both components of the content_scale_size vector need to be non-zero, otherwise the viewport will be resized. Also, setting content_scale_size on a window will emit the size_changed signal, even with the attributes set as above.
I'm wondering if this is technically a bug or if it's actually "working as intended" since the stretch mode tooltip mentions that "the size of the root Viewport is set precisely to the base size" and "finally, this viewport is scaled to fit the screen", so I guess the base size (I assume that means content_scale_size) of the viewport never really changes when the aspect ratio is kept. But the size attribute changes, so it would make sense that the size_changed signal is emitted, unless it really is only supposed to emit when the base size is changed, but then there should be two signals imo, size_changed for the size and content_scale_size_changed for the content_scale_size.
EDIT: I just saw that this is probably a duplicate of #79336
Thanks for the report! Consolidating in godotengine/godot-proposals#8788, as this is intended behavior (the viewport size does not actually change when resizing the window). Therefore, implementing a notification for this is feature proposal territory.
Tested versions
System information
Godot v4.3.beta3 - Linux Mint 21.3 (Virginia) - X11 - GLES3 (Compatibility) - KABINI (, LLVM 15.0.7, DRM 2.50, 5.15.0-112-generic) - AMD E2-7015 APU with AMD Radeon R2 Graphics (2 Threads)
Issue description
In the project settings, if stretch mode (display/window/stretch/mode) is set to viewport, the root window (get_tree().root) will not emit its size_changed signal.
This doesn't happen when stretch mode is set to disabled or canvas_items. It also only happens to the root window specifically, as children windows will still emit their size_changed signal normally even when their content_scale_mode is set to viewport.
Tested and reproducible in v4.3.beta3, v4.2.2.stable, and v4.0.stable.
Recording-2024-07-18_13.03.01.mp4
Steps to reproduce
Minimal reproduction project (MRP)
window-signal-mrp.zip
The text was updated successfully, but these errors were encountered: