[Scummvm-git-logs] scummvm master -> 3dc7a7ec09a17fba5b582aeab333b5d28d2b5355

larsamannen noreply at scummvm.org
Mon Aug 25 20:25:27 UTC 2025


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
e8c249cb34 IOS7: Factor out setting of keyWindow to static function
3dc7a7ec09 IOS7: Migrate to the UIKit scene-based life cycle


Commit: e8c249cb34ee8012cfdb1d83c18462de368c3589
    https://github.com/scummvm/scummvm/commit/e8c249cb34ee8012cfdb1d83c18462de368c3589
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2025-08-25T22:25:24+02:00

Commit Message:
IOS7: Factor out setting of keyWindow to static function

ScummVM is a single window application. This window contains a
reference to a view controller, which has one view which is the
OpenGL frame.

>From iOS 13 and later the concept of UIScene was introduced by
Apple to add support for multiple windows in iOS applications.
A UIScene can have one or multiple windows.

Prepare for implementation of UIScene by moving the making of
a window a keyWindow to a static function accessible by other
classes.

Changed paths:
    backends/platform/ios7/ios7_app_delegate.h
    backends/platform/ios7/ios7_app_delegate.mm


diff --git a/backends/platform/ios7/ios7_app_delegate.h b/backends/platform/ios7/ios7_app_delegate.h
index ec84e505516..fb5ac997c7d 100644
--- a/backends/platform/ios7/ios7_app_delegate.h
+++ b/backends/platform/ios7/ios7_app_delegate.h
@@ -34,6 +34,7 @@
 
 #if TARGET_OS_IOS
 + (UIInterfaceOrientation)currentOrientation;
++ (void)setKeyWindow:(UIWindow *)window;
 #endif
 
 @end
diff --git a/backends/platform/ios7/ios7_app_delegate.mm b/backends/platform/ios7/ios7_app_delegate.mm
index ce2db9de605..ba1aa1271ed 100644
--- a/backends/platform/ios7/ios7_app_delegate.mm
+++ b/backends/platform/ios7/ios7_app_delegate.mm
@@ -51,9 +51,6 @@
 		[fm createDirectoryAtPath:savePath withIntermediateDirectories:YES attributes:nil error:nil];
 	}
 
-	_window = [[UIWindow alloc] initWithFrame:rect];
-	[_window retain];
-
 	_controller = [[iOS7ScummVMViewController alloc] init];
 
 	_view = [[iPhoneView alloc] initWithFrame:rect];
@@ -64,8 +61,7 @@
 #endif
 	_controller.view = _view;
 
-	[_window setRootViewController:_controller];
-	[_window makeKeyAndVisible];
+	[iOS7AppDelegate setKeyWindow:[[UIWindow alloc] initWithFrame:rect]];
 
 	// Force creation of the shared instance on the main thread
 	iOS7_buildSharedOSystemInstance();
@@ -149,6 +145,14 @@
 	iOS7AppDelegate *appDelegate = [self iOS7AppDelegate];
 	return [appDelegate->_controller currentOrientation];
 }
+
++ (void)setKeyWindow:(UIWindow *)window {
+	iOS7AppDelegate *appDelegate = [self iOS7AppDelegate];
+	appDelegate->_window = window;
+	[appDelegate->_window retain];
+	[appDelegate->_window setRootViewController:appDelegate->_controller];
+	[appDelegate->_window makeKeyAndVisible];
+}
 #endif
 
 @end


Commit: 3dc7a7ec09a17fba5b582aeab333b5d28d2b5355
    https://github.com/scummvm/scummvm/commit/3dc7a7ec09a17fba5b582aeab333b5d28d2b5355
Author: Lars Sundström (l.sundstrom at gmail.com)
Date: 2025-08-25T22:25:24+02:00

Commit Message:
IOS7: Migrate to the UIKit scene-based life cycle

UIScene is Apple's solution to support multiple windows for an iOS
application. A scene represents an instance of the applications UI.

ScummVM is a single window application and does not make use of the
scene concept. It is however mandatory to implement it since the next
major release following iOS 26 will require it.
https://developer.apple.com/documentation/technotes/tn3187-migrating-to-the-uikit-scene-based-life-cycle

The application life cycle delegate functions are handled as following
by the iOS versions::
version < iOS 13
applicationDidBecomeActive(_:)
applicationWillResignActive(_:)
applicationDidEnterBackground(_:)
applicationWillEnterForeground(_:)

version >= iOS 13
UISceneDelegate
sceneDidBecomeActive(_:)
sceneWillResignActive(_:)
sceneDidEnterBackground(_:)
sceneWillEnterForeground(_:)

Implement the scene-based life cycle in the class iOS7SceneDelegate.
This fulfills the requirements from Apple.

Changed paths:
  A backends/platform/ios7/ios7_scene_delegate.h
  A backends/platform/ios7/ios7_scene_delegate.mm
    backends/platform/ios7/ios7_app_delegate.mm
    backends/platform/ios7/module.mk


diff --git a/backends/platform/ios7/ios7_app_delegate.mm b/backends/platform/ios7/ios7_app_delegate.mm
index ba1aa1271ed..da8f8385be5 100644
--- a/backends/platform/ios7/ios7_app_delegate.mm
+++ b/backends/platform/ios7/ios7_app_delegate.mm
@@ -61,7 +61,12 @@
 #endif
 	_controller.view = _view;
 
-	[iOS7AppDelegate setKeyWindow:[[UIWindow alloc] initWithFrame:rect]];
+	if (@available(iOS 13.0, *)) {
+		// iOS13 and later uses of UIScene.
+		// The keyWindow is setup by iOS7SceneDelegate
+	} else {
+		[iOS7AppDelegate setKeyWindow:[[UIWindow alloc] initWithFrame:rect]];
+	}
 
 	// Force creation of the shared instance on the main thread
 	iOS7_buildSharedOSystemInstance();
@@ -117,6 +122,21 @@
 }
 #endif
 
+#ifdef __IPHONE_13_0
+- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options API_AVAILABLE(ios(13.0)) {
+	// Called when a new scene session is being created.
+	UISceneConfiguration *config = [[UISceneConfiguration alloc] initWithName:@"ScummVM Scene Configuration" sessionRole:connectingSceneSession.role];
+	[config setDelegateClass:NSClassFromString(@"iOS7SceneDelegate")];
+	return config;
+}
+
+- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions API_AVAILABLE(ios(13.0)) {
+	// Called when the user discards a scene session.
+	// Use this method to release any resources that were
+	// specific to the discarded scenes, as they will not return.
+}
+#endif
+
 - (void)application:(UIApplication *)application didDecodeRestorableStateWithCoder:(NSCoder *)coder {
 	_restoreState = YES;
 }
diff --git a/backends/platform/ios7/ios7_scene_delegate.h b/backends/platform/ios7/ios7_scene_delegate.h
new file mode 100644
index 00000000000..167d35bf9a0
--- /dev/null
+++ b/backends/platform/ios7/ios7_scene_delegate.h
@@ -0,0 +1,32 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef BACKENDS_PLATFORM_IOS7_IOS7_SCENE_DELEGATE_H
+#define BACKENDS_PLATFORM_IOS7_IOS7_SCENE_DELEGATE_H
+
+#include <UIKit/UIKit.h>
+
+API_AVAILABLE(ios(13.0))
+ at interface iOS7SceneDelegate : NSObject<UIWindowSceneDelegate>
+
+ at end
+
+#endif
diff --git a/backends/platform/ios7/ios7_scene_delegate.mm b/backends/platform/ios7/ios7_scene_delegate.mm
new file mode 100644
index 00000000000..07ab3a8fa26
--- /dev/null
+++ b/backends/platform/ios7/ios7_scene_delegate.mm
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "backends/platform/ios7/ios7_scene_delegate.h"
+#include "backends/platform/ios7/ios7_app_delegate.h"
+#include "backends/platform/ios7/ios7_video.h"
+
+API_AVAILABLE(ios(13.0))
+ at implementation iOS7SceneDelegate
+
+- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
+
+	UIWindowScene *windowScene = (UIWindowScene *)scene;
+	[iOS7AppDelegate setKeyWindow:[[UIWindow alloc] initWithWindowScene:windowScene]];
+}
+
+- (void)sceneDidDisconnect:(UIScene *)scene {
+}
+
+- (void)sceneDidBecomeActive:(UIScene *)scene {
+	[[iOS7AppDelegate iPhoneView] applicationResume];
+}
+
+- (void)sceneWillResignActive:(UIScene *)scene {
+	[[iOS7AppDelegate iPhoneView] applicationSuspend];
+}
+
+- (void)sceneDidEnterBackground:(UIScene *)scene {
+	// Start the background task before sending the application entered background event.
+	// This is because this event will be handled in a separate thread and it will likely
+	// no be started before we return from this function.
+	[[iOS7AppDelegate iPhoneView] beginBackgroundSaveStateTask];
+
+	[[iOS7AppDelegate iPhoneView] saveApplicationState];
+}
+
+- (void)sceneWillEnterForeground:(UIScene *)scene {
+}
+
+ at end
diff --git a/backends/platform/ios7/module.mk b/backends/platform/ios7/module.mk
index cd50f30a8cb..979543d63ef 100644
--- a/backends/platform/ios7/module.mk
+++ b/backends/platform/ios7/module.mk
@@ -16,7 +16,8 @@ MODULE_OBJS := \
 	ios7_game_controller.o \
 	ios7_touch_controller.o \
 	ios7_mouse_controller.o \
-	ios7_gamepad_controller.o
+	ios7_gamepad_controller.o \
+	ios7_scene_delegate.o
 
 # We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
 MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))




More information about the Scummvm-git-logs mailing list