From f39ffefb6a754677305efab556216f99f90c778a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 10 Jun 2022 13:29:24 +0200 Subject: [PATCH] Wayland: Fix maximization by user being ignored The internal maximization state was not updated when an event was received that the user had changed the maximization state of a window, and no maximization events were emitted. This affected both the GLFW_MAXIMIZED attribute and glfwRestoreWindow. --- README.md | 3 +++ src/wl_window.c | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 28e26261..df7cfa47 100644 --- a/README.md +++ b/README.md @@ -335,6 +335,9 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: A window leaving full screen mode ignored its desired size - [Wayland] Bugfix: `glfwSetWindowMonitor` did not update windowed mode size - [Wayland] Bugfix: `glfwRestoreWindow` would make a full screen window windowed + - [Wayland] Bugfix: A window maximized or restored by the user would enter an + inconsistent state + - [Wayland] Bugfix: Window maximization events were not emitted - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_window.c b/src/wl_window.c index 7e086461..06a922cf 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -516,7 +516,13 @@ static void xdgToplevelHandleConfigure(void* userData, _glfwIconifyWindowWayland(window); } + if (window->wl.maximized && !maximized) + _glfwInputWindowMaximize(window, GLFW_FALSE); + else if (maximized && !window->wl.maximized) + _glfwInputWindowMaximize(window, GLFW_TRUE); + window->wl.activated = activated; + window->wl.maximized = maximized; } static void xdgToplevelHandleClose(void* userData, @@ -1913,17 +1919,12 @@ void _glfwRestoreWindowWayland(_GLFWwindow* window) // There is no way to unset minimized, or even to know if we are // minimized, so there is nothing to do in this case. } - - window->wl.maximized = GLFW_FALSE; } void _glfwMaximizeWindowWayland(_GLFWwindow* window) { if (window->wl.xdg.toplevel) - { xdg_toplevel_set_maximized(window->wl.xdg.toplevel); - } - window->wl.maximized = GLFW_TRUE; } void _glfwShowWindowWayland(_GLFWwindow* window)