Properly post lost_focus and got_focus notifications when iOS app resigns active state and gains active state. Fixes #7758

This commit is contained in:
Karen Tsai 2015-05-27 02:35:09 -04:00
parent 64f20033d4
commit dbd15420f5
3 changed files with 23 additions and 20 deletions

View File

@ -738,7 +738,7 @@ if(ANDROID)
elseif(IOS) elseif(IOS)
set(nativeExtra ${nativeExtra} set(nativeExtra ${nativeExtra}
ios/main.mm ios/main.mm
ios/AppDelegate.m ios/AppDelegate.mm
ios/AppDelegate.h ios/AppDelegate.h
ios/ViewController.mm ios/ViewController.mm
ios/ViewController.h ios/ViewController.h
@ -752,7 +752,7 @@ elseif(IOS)
set(nativeExtraLibs ${nativeExtraLibs} "-weak_framework GameController") set(nativeExtraLibs ${nativeExtraLibs} "-weak_framework GameController")
endif() endif()
set_source_files_properties(ios/AppDelegate.m PROPERTIES COMPILE_FLAGS -fobjc-arc) set_source_files_properties(ios/AppDelegate.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/ViewController.mm PROPERTIES COMPILE_FLAGS -fobjc-arc) set_source_files_properties(ios/ViewController.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
set(TargetBin PPSSPP) set(TargetBin PPSSPP)

View File

@ -1,18 +0,0 @@
// AppDelegate.m boilerplate
#import "AppDelegate.h"
#import "ViewController.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[ViewController alloc] init];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
@end

21
ios/AppDelegate.mm Normal file
View File

@ -0,0 +1,21 @@
#import "AppDelegate.h"
#import "ViewController.h"
#import "base/NativeApp.h"
@implementation AppDelegate
-(BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[ViewController alloc] init];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
-(void) applicationWillResignActive:(UIApplication *)application {
NativeMessageReceived("lost_focus", "");
}
-(void) applicationDidBecomeActive:(UIApplication *)application {
NativeMessageReceived("got_focus", "");
}
@end