SDL: uikit: Send fullscreen enter/leave events

From 9c3e831e33062b605f6ee85bb790a3be99bb52e5 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Wed, 27 Dec 2023 17:08:46 -0500
Subject: [PATCH] uikit: Send fullscreen enter/leave events

Send fullscreen enter/leave events, which will implicitly update the fullscreen flag. Manually setting the flag will suppress attempts to send the events later, as the flag is used for deduplication purposes in the event code.
---
 src/video/uikit/SDL_uikitwindow.m | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m
index 7e510bf517ae..8f515e10c72e 100644
--- a/src/video/uikit/SDL_uikitwindow.m
+++ b/src/video/uikit/SDL_uikitwindow.m
@@ -309,11 +309,7 @@ void UIKit_SetWindowBordered(SDL_VideoDevice *_this, SDL_Window *window, SDL_boo
 int UIKit_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
 {
     @autoreleasepool {
-        if (fullscreen) {
-            window->flags |= SDL_WINDOW_FULLSCREEN;
-        } else {
-            window->flags &= ~SDL_WINDOW_FULLSCREEN;
-        }
+        SDL_SendWindowEvent(window, fullscreen ? SDL_EVENT_WINDOW_ENTER_FULLSCREEN : SDL_EVENT_WINDOW_LEAVE_FULLSCREEN, 0, 0);
         UIKit_UpdateWindowBorder(_this, window);
     }
     return 0;