From 3166eee3f0f434b71519cd1a7de6bfbee31add0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 21 May 2024 14:20:42 +0200 Subject: [PATCH] iOS ViewController: Move external methods to a protocol --- ios/ViewController.h | 19 ++++++++++++------- ios/ViewController.mm | 5 +++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ios/ViewController.h b/ios/ViewController.h index 36c1db7f8b..a4898964b5 100644 --- a/ios/ViewController.h +++ b/ios/ViewController.h @@ -9,17 +9,22 @@ #import "CameraHelper.h" #import "LocationHelper.h" -@interface ViewController : GLKViewController - -- (void)shareText:(NSString *)text; -- (void)shutdown; +@protocol PPSSPPViewController +@optional - (void)hideKeyboard; - (void)showKeyboard; - +- (void)shareText:(NSString *)text; +- (void)shutdown; +- (void)bindDefaultFBO; @end -extern __unsafe_unretained ViewController* sharedViewController; +@interface ViewController : GLKViewController < + iCadeEventDelegate, LocationHandlerDelegate, CameraFrameDelegate, + UIGestureRecognizerDelegate, UIKeyInput, PPSSPPViewController> +@end + +extern id sharedViewController; + void setCameraSize(int width, int height); void startVideo(); void stopVideo(); diff --git a/ios/ViewController.mm b/ios/ViewController.mm index 8bbaaa85e3..4a0ebfdd7d 100644 --- a/ios/ViewController.mm +++ b/ios/ViewController.mm @@ -98,7 +98,7 @@ static bool threadEnabled = true; static bool threadStopped = false; static UITouch *g_touches[10]; -__unsafe_unretained ViewController* sharedViewController; +id sharedViewController; static GraphicsContext *graphicsContext; static CameraHelper *cameraHelper; static LocationHelper *locationHelper; @@ -181,7 +181,6 @@ extern float g_safeInsetBottom; - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; - [self hideKeyboard]; } - (void)viewDidLoad { @@ -240,6 +239,8 @@ extern float g_safeInsetBottom; locationHelper = [[LocationHelper alloc] init]; [locationHelper setDelegate:self]; + [self hideKeyboard]; + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ NativeInitGraphics(graphicsContext);