From 3f3e2269e6f18d486ea5bf038986315fe14ef024 Mon Sep 17 00:00:00 2001 From: ghKoty <99099427+ghKoty@users.noreply.github.com> Date: Mon, 1 Jun 2026 18:02:59 +0300 Subject: [PATCH] Expose Window.clamp_to_embedder property --- doc/classes/AcceptDialog.xml | 1 + doc/classes/Window.xml | 4 ++++ scene/main/window.cpp | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/doc/classes/AcceptDialog.xml b/doc/classes/AcceptDialog.xml index 9468bab64bf2..12061f5da08d 100644 --- a/doc/classes/AcceptDialog.xml +++ b/doc/classes/AcceptDialog.xml @@ -60,6 +60,7 @@ + Sets autowrapping for the text in the dialog. diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml index eed95211d638..7ee9ef8cf3e8 100644 --- a/doc/classes/Window.xml +++ b/doc/classes/Window.xml @@ -644,6 +644,10 @@ If [code]true[/code], the window will have no borders. + + If [code]true[/code], the [Window] position will be clamped so it cannot be dragged outside of the parent viewport. + [b]Note:[/b] This property only works with embedded windows. + Specifies how the content's aspect behaves when the [Window] is resized. The base aspect is determined by [member content_scale_size]. diff --git a/scene/main/window.cpp b/scene/main/window.cpp index bc56ddbd7b17..333d5179053e 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -3422,6 +3422,9 @@ void Window::_bind_methods() { ClassDB::bind_method(D_METHOD("set_exclusive", "exclusive"), &Window::set_exclusive); ClassDB::bind_method(D_METHOD("is_exclusive"), &Window::is_exclusive); + ClassDB::bind_method(D_METHOD("set_clamp_to_embedder", "clamp_to_embedder"), &Window::set_clamp_to_embedder); + ClassDB::bind_method(D_METHOD("is_clamped_to_embedder"), &Window::is_clamped_to_embedder); + ClassDB::bind_method(D_METHOD("set_unparent_when_invisible", "unparent"), &Window::set_unparent_when_invisible); ClassDB::bind_method(D_METHOD("can_draw"), &Window::can_draw); @@ -3570,6 +3573,7 @@ void Window::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "transient"), "set_transient", "is_transient"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "transient_to_focused"), "set_transient_to_focused", "is_transient_to_focused"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "exclusive"), "set_exclusive", "is_exclusive"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "clamp_to_embedder"), "set_clamp_to_embedder", "is_clamped_to_embedder"); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "unresizable"), "set_flag", "get_flag", FLAG_RESIZE_DISABLED); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "borderless"), "set_flag", "get_flag", FLAG_BORDERLESS); ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "always_on_top"), "set_flag", "get_flag", FLAG_ALWAYS_ON_TOP);