diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml index 618a774aae16..ab14f64aa1c4 100644 --- a/doc/classes/Window.xml +++ b/doc/classes/Window.xml @@ -675,7 +675,7 @@ If [code]true[/code], the [Window]'s background can be transparent. This is best used with embedded windows. [b]Note:[/b] Transparency support is implemented on Linux, macOS and Windows, but availability might vary depending on GPU driver, display manager, and compositor capabilities. - [b]Note:[/b] This property has no effect if either [member ProjectSettings.display/window/per_pixel_transparency/allowed], or the window's [member Viewport.transparent_bg] is set to [code]false[/code]. + [b]Note:[/b] This property has no effect if [member ProjectSettings.display/window/per_pixel_transparency/allowed] is set to [code]false[/code]. If [code]true[/code], the [Window] can't be focused nor interacted with. It can still be visible. diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 99f9e11b1f57..fd64220c2c34 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -484,9 +484,12 @@ void Window::set_flag(Flags p_flag, bool p_enabled) { ERR_FAIL_INDEX(p_flag, FLAG_MAX); flags[p_flag] = p_enabled; + if (p_flag == FLAG_TRANSPARENT) { + set_transparent_background(p_enabled); + } + if (embedder) { embedder->_sub_window_update(this); - } else if (window_id != DisplayServer::INVALID_WINDOW_ID) { if (!is_in_edited_scene_root()) { DisplayServer::get_singleton()->window_set_flag(DisplayServer::WindowFlags(p_flag), p_enabled, window_id); @@ -1285,6 +1288,9 @@ void Window::_notification(int p_what) { _update_viewport_size(); // Then feed back to the viewport. _update_window_callbacks(); RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_WHEN_VISIBLE); + if (DisplayServer::get_singleton()->window_get_flag(DisplayServer::WindowFlags(FLAG_TRANSPARENT), window_id)) { + set_transparent_background(true); + } } else { // Create. if (visible) {