Просмотр исходного кода

Set window controller interaction on all windows

We should update all windows, not just the ones in the active scene
Sam Lantinga 10 месяцев назад
Родитель
Сommit
54b15532d3
1 измененных файлов с 9 добавлено и 6 удалено
  1. 9 6
      src/video/uikit/SDL_uikitvideo.m

+ 9 - 6
src/video/uikit/SDL_uikitvideo.m

@@ -294,13 +294,16 @@ UIWindowScene *UIKit_GetActiveWindowScene(void)
 void UIKit_SetGameControllerInteraction(bool enabled)
 void UIKit_SetGameControllerInteraction(bool enabled)
 {
 {
     if (@available(iOS 13.0, tvOS 13.0, *)) {
     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);
+            }
         }
         }
     }
     }
 }
 }