From a0259b94264f9d267c7f5da56f63632c26562c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 15 Jun 2022 18:20:16 +0200 Subject: [PATCH] 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. (cherry picked from commit 77819c0c549fa9c1aa40ff74289bd7cfae61f296) --- README.md | 2 ++ src/wl_window.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bd3c4fc0..d83c4b50 100644 --- a/README.md +++ b/README.md @@ -176,6 +176,8 @@ information on what to include when reporting a bug. scale changed - [Wayland] Bugfix: `glfwSetWindowAspectRatio` reported an error instead of applying the specified ratio + - [Wayland] Bugfix: `GLFW_MAXIMIZED` window hint had no effect + - [Wayland] Bugfix: `glfwRestoreWindow` had no effect before first show ## Contact diff --git a/src/wl_window.c b/src/wl_window.c index bb65e2b3..187e9c36 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -745,6 +745,8 @@ static GLFWbool createNativeSurface(_GLFWwindow* window, window->wl.scale = 1; window->wl.title = _glfw_strdup(wndconfig->title); + window->wl.maximized = wndconfig->maximized; + window->wl.transparent = fbconfig->transparent; if (!window->wl.transparent) setOpaqueRegion(window); @@ -2068,10 +2070,12 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window) { // 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); + else + window->wl.maximized = GLFW_FALSE; } } } @@ -2080,6 +2084,8 @@ void _glfwPlatformMaximizeWindow(_GLFWwindow* window) { if (window->wl.xdg.toplevel) xdg_toplevel_set_maximized(window->wl.xdg.toplevel); + else + window->wl.maximized = GLFW_TRUE; } void _glfwPlatformShowWindow(_GLFWwindow* window)