From 281494676a4ff6ef3aaa1a47ab960a06e16ce910 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Thu, 3 Apr 2025 17:02:17 -0400
Subject: [PATCH] x11: Send a restored event before entering fullscreen
Ensures that the maximized flag is cleared on fullscreen windows.
(cherry picked from commit ca613b9d8f62e29641c3910ab44f789c967c2b59)
---
src/video/x11/SDL_x11events.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c
index 2c5fb0dd0e2be..43d6dd72833d8 100644
--- a/src/video/x11/SDL_x11events.c
+++ b/src/video/x11/SDL_x11events.c
@@ -1813,6 +1813,8 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
if (!(flags & SDL_WINDOW_MINIMIZED)) {
const bool commit = SDL_memcmp(&data->window->current_fullscreen_mode, &data->requested_fullscreen_mode, sizeof(SDL_DisplayMode)) != 0;
+ // Ensure the maximized flag is cleared before entering fullscreen.
+ SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_ENTER_FULLSCREEN, 0, 0);
if (commit) {
/* This was initiated by the compositor, or the mode was changed between the request and the window