From 9edd411a8315540b86fceec590dd5aa6be41f5f0 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 19 May 2022 17:15:10 -0400
Subject: [PATCH] x11: send move/resize events when waiting on fullscreen
change.
Otherwise we ignore the Configure/etc events when they come in because
the window is already in an identical state as far as SDL is concerned.
Fixes #5593.
May also fix:
Issue #5572.
Issue #5595.
---
src/video/x11/SDL_x11window.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c
index 142b5c2d05b..07fb60266fd 100644
--- a/src/video/x11/SDL_x11window.c
+++ b/src/video/x11/SDL_x11window.c
@@ -27,6 +27,7 @@
#include "../SDL_pixels_c.h"
#include "../../events/SDL_keyboard_c.h"
#include "../../events/SDL_mouse_c.h"
+#include "../../events/SDL_events_c.h"
#include "SDL_x11video.h"
#include "SDL_x11mouse.h"
@@ -1385,12 +1386,19 @@ X11_SetWindowFullscreenViaWM(_THIS, SDL_Window * window, SDL_VideoDisplay * _dis
attrs.x, attrs.y, &x, &y, &childReturn);
if (!caught_x11_error) {
- if ((x != orig_x) || (y != orig_y) || (attrs.width != orig_w) || (attrs.height != orig_h)) {
- window->x = x;
- window->y = y;
- window->w = attrs.width;
- window->h = attrs.height;
- break; /* window moved, time to go. */
+ SDL_bool window_changed = SDL_FALSE;
+ if ((x != orig_x) || (y != orig_y)) {
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED, x, y);
+ window_changed = SDL_TRUE;
+ }
+
+ if ((attrs.width != orig_w) || (attrs.height != orig_h)) {
+ SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_RESIZED, attrs.width, attrs.height);
+ window_changed = SDL_TRUE;
+ }
+
+ if (window_changed) {
+ break; /* window changed, time to go. */
}
}