SDL: wayland: Send exposure events when deferring resize events

From 2212c4f0851bfcbf5be0336eef633e465ca009ab Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Mon, 12 Jan 2026 19:06:02 -0500
Subject: [PATCH] wayland: Send exposure events when deferring resize events

Clients that defer repainting may hang in SDL_WaitEvent() while interactively resizing if they only redraw when an appropriate event is received, as resizing defers the new state until a frame callback is received, and if too much time elapsed since the last redraw, the last frame callback may have already occurred. Send an exposure event when deferring resizes so the client will make forward progress and trigger a frame callback to ack the pending configure state.
---
 src/video/wayland/SDL_waylandwindow.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index ef2e3743e5d5f..5dac6f22a84c5 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -752,6 +752,9 @@ static void handle_xdg_surface_configure(void *data, struct xdg_surface *xdg, ui
         xdg_surface_ack_configure(xdg, serial);
     } else {
         wind->pending_config_ack = true;
+
+        // Send an exposure event so that clients doing deferred updates will trigger a frame callback and make guaranteed forward progress when resizing.
+        SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
     }
 
     if (wind->shell_surface_status == WAYLAND_SHELL_SURFACE_STATUS_WAITING_FOR_CONFIGURE) {