Wayland: Fix maximized state lost while hidden

If a window was created as maximized, or created as hidden and then
iconified or maximized before first being shown, that state was lost and
the window was shown as restored.
This commit is contained in:
Camilla Löwy 2022-06-15 18:20:16 +02:00
parent e52046955d
commit 77819c0c54
2 changed files with 10 additions and 2 deletions

View File

@ -357,6 +357,8 @@ information on what to include when reporting a bug.
scale changed scale changed
- [Wayland] Bugfix: `glfwSetWindowAspectRatio` reported an error instead of - [Wayland] Bugfix: `glfwSetWindowAspectRatio` reported an error instead of
applying the specified ratio applying the specified ratio
- [Wayland] Bugfix: `GLFW_MAXIMIZED` window hint had no effect
- [Wayland] Bugfix: `glfwRestoreWindow` had no effect before first show
- [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Removed use of deprecated function `gettimeofday`
- [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled
- [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072)

View File

@ -702,6 +702,8 @@ static GLFWbool createNativeSurface(_GLFWwindow* window,
window->wl.scale = 1; window->wl.scale = 1;
window->wl.title = _glfw_strdup(wndconfig->title); window->wl.title = _glfw_strdup(wndconfig->title);
window->wl.maximized = wndconfig->maximized;
window->wl.transparent = fbconfig->transparent; window->wl.transparent = fbconfig->transparent;
if (!window->wl.transparent) if (!window->wl.transparent)
setOpaqueRegion(window); setOpaqueRegion(window);
@ -2003,10 +2005,12 @@ void _glfwRestoreWindowWayland(_GLFWwindow* window)
{ {
// We assume we are not minimized and acto only on maximization // We assume we are not minimized and acto only on maximization
if (window->wl.xdg.toplevel) if (window->wl.maximized)
{ {
if (window->wl.maximized) if (window->wl.xdg.toplevel)
xdg_toplevel_unset_maximized(window->wl.xdg.toplevel); xdg_toplevel_unset_maximized(window->wl.xdg.toplevel);
else
window->wl.maximized = GLFW_FALSE;
} }
} }
} }
@ -2015,6 +2019,8 @@ void _glfwMaximizeWindowWayland(_GLFWwindow* window)
{ {
if (window->wl.xdg.toplevel) if (window->wl.xdg.toplevel)
xdg_toplevel_set_maximized(window->wl.xdg.toplevel); xdg_toplevel_set_maximized(window->wl.xdg.toplevel);
else
window->wl.maximized = GLFW_TRUE;
} }
void _glfwShowWindowWayland(_GLFWwindow* window) void _glfwShowWindowWayland(_GLFWwindow* window)