From 371cc2d173f8e6145ec545c3bd7e20200f1d26b2 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Mon, 14 Aug 2023 12:49:13 -0400
Subject: [PATCH] wayland: Remove unnecessary flag and state settings
The video core applies pending minimized/maximized/restored state to windows when they transition from the hidden to shown state, so no need to handle it internally anymore.
---
src/video/wayland/SDL_waylandwindow.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index 4568ecb4d49b..0f943e4b5ad0 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -1529,12 +1529,6 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
/* Restore state that was set prior to this call */
Wayland_SetWindowTitle(_this, window);
- if (window->flags & SDL_WINDOW_MAXIMIZED) {
- Wayland_MaximizeWindow(_this, window);
- }
- if (window->flags & SDL_WINDOW_MINIMIZED) {
- Wayland_MinimizeWindow(_this, window);
- }
/* We have to wait until the surface gets a "configure" event, or use of
* this surface will fail. This is a new rule for xdg_shell.
@@ -1940,11 +1934,6 @@ void Wayland_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)
return;
}
- /* Set this flag now even if we never actually maximized, eventually
- * ShowWindow will take care of it along with the other window state.
- */
- window->flags &= ~SDL_WINDOW_MAXIMIZED;
-
#ifdef HAVE_LIBDECOR_H
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) {
if (wind->shell_surface.libdecor.frame == NULL) {
@@ -2025,11 +2014,6 @@ void Wayland_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
return;
}
- /* Set this flag now even if we don't actually maximize yet, eventually
- * ShowWindow will take care of it along with the other window state.
- */
- window->flags |= SDL_WINDOW_MAXIMIZED;
-
#ifdef HAVE_LIBDECOR_H
if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) {
if (wind->shell_surface.libdecor.frame == NULL) {
@@ -2057,6 +2041,8 @@ void Wayland_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
SDL_VideoData *viddata = _this->driverdata;
SDL_WindowData *wind = window->driverdata;
+ /* Maximized and minimized flags are mutually exclusive */
+ window->flags &= ~SDL_WINDOW_MAXIMIZED;
window->flags |= SDL_WINDOW_MINIMIZED;
#ifdef HAVE_LIBDECOR_H