SDL: wayland: Send exposure events when showing or resizing the window (d3218)

From d32189918ba065b86ee5afec6b8bd217fdca7dc2 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Tue, 10 Sep 2024 10:07:55 -0400
Subject: [PATCH] wayland: Send exposure events when showing or resizing the
 window

Clients may rely on this event to signal when they should redraw themselves, so send it when appropriate.

(cherry picked from commit 8fa99993af4e50d41a7c5f0927fd4a6d04639004)
---
 src/video/wayland/SDL_waylandwindow.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index ad89748465f2a..cec81d00c9f4e 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -1481,6 +1481,9 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
      * HideWindow was called immediately before ShowWindow.
      */
     WAYLAND_wl_display_roundtrip(c->display);
+
+    /* Send an exposure event to signal that the client should draw. */
+    SDL_SendWindowEvent(window, SDL_WINDOWEVENT_EXPOSED, 0, 0);
 }
 
 static void Wayland_ReleasePopup(_THIS, SDL_Window *popup)
@@ -2147,6 +2150,7 @@ static void Wayland_HandleResize(SDL_Window *window, int width, int height, floa
         window->w = 0;
         window->h = 0;
         SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, width, height);
+        SDL_SendWindowEvent(window, SDL_WINDOWEVENT_EXPOSED, 0, 0);
         window->w = width;
         window->h = height;
         data->needs_resize_event = SDL_FALSE;