SDL: x11: Force window back to expected size after SDL_SetWindowBordered.

From b75cd2b36dd742b956a225087dad39d14884f581 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Fri, 10 Jun 2022 14:12:03 -0400
Subject: [PATCH] x11: Force window back to expected size after
 SDL_SetWindowBordered.

This helps if the window manager decided to let it fill the space that
an existing border was using before its removal.

Fixes #5718.
---
 src/video/x11/SDL_x11window.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c
index 8fb5ae92bf8..6a1e299959a 100644
--- a/src/video/x11/SDL_x11window.c
+++ b/src/video/x11/SDL_x11window.c
@@ -1074,6 +1074,10 @@ X11_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
     X11_XSync(display, False);
     X11_XCheckIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow);
     X11_XCheckIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow);
+
+    /* Make sure the window manager didn't resize our window for the difference. */
+    X11_XResizeWindow(display, data->xwindow, window->w, window->h);
+    X11_XSync(display, False);
 }
 
 void