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 f39ffefb6a)
This commit is contained in:
Camilla Löwy 2022-06-10 13:29:24 +02:00
parent dea602623d
commit 562eca6f28
2 changed files with 9 additions and 6 deletions

View File

@ -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: A window leaving full screen mode ignored its desired size
- [Wayland] Bugfix: `glfwSetWindowMonitor` did not update windowed mode size - [Wayland] Bugfix: `glfwSetWindowMonitor` did not update windowed mode size
- [Wayland] Bugfix: `glfwRestoreWindow` would make a full screen window windowed - [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 ## Contact

View File

@ -558,7 +558,13 @@ static void xdgToplevelHandleConfigure(void* userData,
_glfwPlatformIconifyWindow(window); _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.activated = activated;
window->wl.maximized = maximized;
} }
static void xdgToplevelHandleClose(void* userData, 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 // There is no way to unset minimized, or even to know if we are
// minimized, so there is nothing to do here. // minimized, so there is nothing to do here.
} }
window->wl.maximized = GLFW_FALSE;
} }
void _glfwPlatformMaximizeWindow(_GLFWwindow* window) void _glfwPlatformMaximizeWindow(_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);
}
window->wl.maximized = GLFW_TRUE;
} }
void _glfwPlatformShowWindow(_GLFWwindow* window) void _glfwPlatformShowWindow(_GLFWwindow* window)