From 562eca6f28005c65ee3cc6551148fc0a08c5d556 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. (cherry picked from commit f39ffefb6a754677305efab556216f99f90c778a) --- README.md | 3 +++ src/wl_window.c | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c1b9b2c4..881a7bb4 100644 --- a/README.md +++ b/README.md @@ -154,6 +154,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 ## Contact diff --git a/src/wl_window.c b/src/wl_window.c index b35b7319..e86f69b7 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -558,7 +558,13 @@ static void xdgToplevelHandleConfigure(void* userData, _glfwPlatformIconifyWindow(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, @@ -1976,18 +1982,12 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window) // There is no way to unset minimized, or even to know if we are // minimized, so there is nothing to do here. } - - window->wl.maximized = GLFW_FALSE; } void _glfwPlatformMaximizeWindow(_GLFWwindow* window) { if (window->wl.xdg.toplevel) - { xdg_toplevel_set_maximized(window->wl.xdg.toplevel); - } - - window->wl.maximized = GLFW_TRUE; } void _glfwPlatformShowWindow(_GLFWwindow* window)