Repository: godotengine/godot (language: cpp)

Issue:
Moving floating game window to screen edge overlapping issue
### Tested versions

Godot v4.4.beta2

### System information

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

### Issue description

When moving the game window down towards the task bar, the game view will overlap the game window menu. The game view is also changing size (similar thing happens when moving to the left edge)

https://github.com/user-attachments/assets/38e166e0-103b-4377-b4a4-f3aee66b4179


_First mentioned this in https://github.com/godotengine/godot/issues/102239#issuecomment-2627548322_



### Steps to reproduce

Move the game window to screen edge.

### Minimal reproduction project (MRP)

N/A


Discussion / hints:
I'll check to offset issue, that is not normal.
Unfortunately, the problem where the window resize is a workaround because x11 does not allow to move window outside the screen area. That is a known issue. Maybe there's a solution for that, but I'm not aware of it.
I'm not able to reproduce on my system with Fedora 40 KDE Plasma 6.2.3

My guess is that I don't have exactly the same settings. Do you have a bar on top or something like that? I don't use Fedora usually and KDE, I don't know the possible settings. Usually the offset is caused by an error in the calculated screen area.

What is your resolution? Do you have multiple monitors with different resolution? Does the error occurs on both monitor? Do you have a similar problem when moving the window on the right or left of the screen?

https://github.com/user-attachments/assets/f108065e-d777-401e-90cd-0575886e6183
Cannot reproduce it either on 6.2.3 
Happens on Plasma 6.2.5
Oh!! Thanks for that detail! I'll try on this version!!
> Oh!! Thanks for that detail! I'll try on this version!!

Turned my second monitor and now it doesn't trigger either on 6.2.5
Or it happens but not as visible as before, here is a video:

https://github.com/user-attachments/assets/c4529b92-e103-4e37-87b9-d12e914a1b4a
> Turned my second monitor and now it doesn't trigger either on 6.2.5

Does both your monitors have the same resolution?
> Does both your monitors have the same resolution?

No
And the problem also happens on the other monitor
Pretty sure the issue is caused by the two monitor having different resolution. The method to calculate the available area is a bit complex in this scenario. Can you give me your screen resolution, scale and disposition (which one is on left/right/top/bottom and if they have some offset? I'll try to replicate on my side. Thanks.
Nevermind, just connecting a second monitor causes the issue!!

Fix patch:
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp
index cbd3662986c7..620f1bf30b1f 100644
--- a/platform/linuxbsd/x11/display_server_x11.cpp
+++ b/platform/linuxbsd/x11/display_server_x11.cpp
@@ -1364,8 +1364,6 @@ Rect2i DisplayServerX11::screen_get_usable_rect(int p_screen) const {
 					}
 
 					if (desktop_valid) {
-						use_simple_method = false;
-
 						// Handle bad window errors silently because there's no other way to check
 						// that one of the windows has been destroyed in the meantime.
 						int (*oldHandler)(Display *, XErrorEvent *) = XSetErrorHandler(&bad_window_error_handler);
@@ -1393,6 +1391,8 @@ Rect2i DisplayServerX11::screen_get_usable_rect(int p_screen) const {
 								}
 							}
 							if (!g_bad_window && strut_found && (format == 32) && (strut_len >= 4) && strut_data) {
+								use_simple_method = false;
+
 								long *struts = (long *)strut_data;
 
 								long left = struts[0];


Test patch: