I’m playing with Godot 4.4.1, trying to make a desktop tool. What I’d like to do is make it so that if the window is resized, the contents do not scale, there’s just more space for stuff.
I’ve set the stretch mode to disabled, and I can resize the window without scaling the contents, so that much works. The problem I’m having is resizing the controls inside the window.
It doesn’t seem like you can tell a container to just “be the size of the window”, though that would be the ideal solution. I’ve done:
func _ready() -> void:
get_window().size_changed.connect(_handle_resized)
func _handle_resized() -> void:
var w: Node = get_window()
print("%d %d" % [w.size.x, w.size.y])
This works if it winds up scaling the viewport inside the window, but if the window gets bigger than the viewport, the viewport just centers in the window and no size_changed signal is sent.
I guess I could just poll DisplayServer.window_get_size(), but it feels like there ought to be a better way. How should I do this?
EDIT: Apparently DisplayServer.window_get_size() has the same problem; it returns the size of the viewport, not the window client area, despite what the docs say.