Repository: godotengine/godot (language: cpp)

Issue:
Opening floating game window after minimizing results in missing window frame
### Tested versions

Godot v4.4.beta2 

### System information

Fedora Linux 40 (KDE Plasma) on Wayland - X11 display driver, Multi-window

### Issue description

Thought the editor was crashing. I had maximized the floating game window, then minimized it. Opened it again from the task bar. Pressed the window close button. But that was actually the main editor close button.

https://github.com/user-attachments/assets/94129c91-563b-43c6-93ab-ea39d314dc21




### Steps to reproduce

Launch with F6
Minimize window
Open window from task bar


### Minimal reproduction project (MRP)

N/A


Discussion / hints:
Thanks for reporting this issue.
I'm not able to reproduce on Ubuntu 24.04, Fedora 40 KDE Plasma 6.1.5 and Kubuntu 22.04 KDE Plasma 5.24.7. But from from video we really don't have the same Window Manager on Fedora. I'm really not an expert on Linux and Fedora version.

From what I see, you were able to select the game window and not the floating window from your taskbar.

Can you give us the exact version number of your KDE Plasma and a video/screenshot of your taskbar when the floating game window is minimized and when it's not minimized. That would be of great help! My hypothesis is that your Window Manager addeds the embedded game window in your taskbar which it's should not.
Happens on both Fedora 40 KDE Plasma 6.2.3, Fedora 41 KDE Plasma 6.2.5

This video is from Fedora 40:

https://github.com/user-attachments/assets/4778c000-3ce9-4f6f-849b-d8b4f027232f


Ok, thanks, I'm now able to reproduce on Fedora 40 KDE Plasma.

Fix patch:
diff --git a/editor/window_wrapper.cpp b/editor/window_wrapper.cpp
index a680dd79c673..4d82df70db96 100644
--- a/editor/window_wrapper.cpp
+++ b/editor/window_wrapper.cpp
@@ -261,6 +261,11 @@ void WindowWrapper::restore_window_from_saved_position(const Rect2 p_window_rect
 	window_rect = Rect2i(window_rect.position * screen_ratio, window_rect.size * screen_ratio);
 	window_rect.position += real_screen_rect.position;
 
+	// Make sure to restore the window if the user minimized it the last time it was displayed.
+	if (window->get_mode() == Window::MODE_MINIMIZED) {
+		window->set_mode(Window::MODE_WINDOWED);
+	}
+
 	// All good, restore the window.
 	window->set_current_screen(p_screen);
 	if (window->is_visible()) {
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp
index cbd3662986c7..e73cb4376dd5 100644
--- a/platform/linuxbsd/x11/display_server_x11.cpp
+++ b/platform/linuxbsd/x11/display_server_x11.cpp
@@ -4727,6 +4727,13 @@ void DisplayServerX11::process_events() {
 
 				// Have we failed to set fullscreen while the window was unmapped?
 				_validate_mode_on_map(window_id);
+
+				// On KDE Plasma, when the parent window of an embedded process is restored after being minimized,
+				// only the embedded window receives the Map notification, causing it to
+				// appear without its parent.
+				if (wd.embed_parent) {
+					XMapWindow(x11_display, wd.embed_parent);
+				}
 			} break;
 
 			case Expose: {


Test patch: