1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Fix check for is_maximized in x11 to require both horizontal and vertical

Fixes #103522

Persistent window state doesn't work if your window is 'tiled' in X11
gnome

3.x checks for `horz && vert`
4396e98834/platform/x11/os_x11.cpp (L1708)

4.x also checked `horz && vert` until this change where it was switched
to `horz || vert`
524f061c01 (diff-05f85bc3bf96d384f6b96260c758e63e10bbdd52b04f8ccb34649372e7bc1f48R1382)

The corrected logic is:
Check `horz && vert` for 'is_maximized'
Check `horz || vert` for 'can_maximize'
This commit is contained in:
Jamie Pate
2025-03-03 14:07:46 -08:00
parent 9f68a81659
commit 4f14f722b8

View File

@@ -2563,7 +2563,8 @@ bool DisplayServerX11::_window_maximize_check(WindowID p_window, const char *p_a
Atom *atoms = (Atom *)data;
Atom wm_act_max_horz;
Atom wm_act_max_vert;
if (strcmp(p_atom_name, "_NET_WM_STATE") == 0) {
bool checking_state = strcmp(p_atom_name, "_NET_WM_STATE") == 0;
if (checking_state) {
wm_act_max_horz = XInternAtom(x11_display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
wm_act_max_vert = XInternAtom(x11_display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
} else {
@@ -2581,11 +2582,18 @@ bool DisplayServerX11::_window_maximize_check(WindowID p_window, const char *p_a
found_wm_act_max_vert = true;
}
if (checking_state) {
if (found_wm_act_max_horz && found_wm_act_max_vert) {
retval = true;
break;
}
} else {
if (found_wm_act_max_horz || found_wm_act_max_vert) {
retval = true;
break;
}
}
}
XFree(data);
}