SDL: Set window controller interaction on all windows

From 54b15532d3cfb7a06175baba02a717e522e30e74 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 26 Nov 2025 11:50:54 -0800
Subject: [PATCH] Set window controller interaction on all windows

We should update all windows, not just the ones in the active scene
---
 src/video/uikit/SDL_uikitvideo.m | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/video/uikit/SDL_uikitvideo.m b/src/video/uikit/SDL_uikitvideo.m
index 2cca9bc0c27f9..ce729de6866e3 100644
--- a/src/video/uikit/SDL_uikitvideo.m
+++ b/src/video/uikit/SDL_uikitvideo.m
@@ -294,13 +294,16 @@ CGRect UIKit_ComputeViewFrame(SDL_Window *window, UIScreen *screen)
 void UIKit_SetGameControllerInteraction(bool enabled)
 {
     if (@available(iOS 13.0, tvOS 13.0, *)) {
-        UIWindowScene *scene = UIKit_GetActiveWindowScene();
-        if (scene == nil) {
-            return;
-        }
+        NSSet<UIScene *> *connectedScenes = [UIApplication sharedApplication].connectedScenes;
+        for (UIScene *scene in connectedScenes) {
+            if (![scene isKindOfClass:[UIWindowScene class]]) {
+                continue;
+            }
 
-        for (UIWindow *window in scene.windows) {
-            UIKit_SetViewGameControllerInteraction(window, enabled);
+            UIWindowScene *windowScene = (UIWindowScene *)scene;
+            for (UIWindow *window in windowScene.windows) {
+                UIKit_SetViewGameControllerInteraction(window, enabled);
+            }
         }
     }
 }

1 Like