diff --git a/gfx/drivers_context/cocoa_gl_ctx.m b/gfx/drivers_context/cocoa_gl_ctx.m index 75dac08ddf..af40d4a3bd 100644 --- a/gfx/drivers_context/cocoa_gl_ctx.m +++ b/gfx/drivers_context/cocoa_gl_ctx.m @@ -60,7 +60,6 @@ static enum gfx_ctx_api cocoagl_api = GFX_CTX_NONE; #if defined(HAVE_COCOATOUCH) static GLKView *g_view; -UIView *g_pause_indicator_view; #endif static GLContextClass* g_hw_ctx; @@ -157,16 +156,9 @@ static void cocoagl_gfx_ctx_set_flags(void *data, uint32_t flags) void *glkitview_init(void) { #if defined(HAVE_COCOATOUCH) -#if TARGET_OS_IOS - /* iOS Pause menu and lifecycle. */ - UINib *xib = (UINib*)[UINib nibWithNibName:BOXSTRING("PauseIndicatorView") bundle:nil]; - g_pause_indicator_view = [[xib instantiateWithOwner:[RetroArch_iOS get] options:nil] lastObject]; -#endif - g_view = [GLKView new]; #if TARGET_OS_IOS g_view.multipleTouchEnabled = YES; - [g_view addSubview:g_pause_indicator_view]; #endif g_view.enableSetNeedsDisplay = NO; diff --git a/ui/drivers/cocoa/cocoa_common.m b/ui/drivers/cocoa/cocoa_common.m index b4fc61b38a..8ae6d9e86b 100644 --- a/ui/drivers/cocoa/cocoa_common.m +++ b/ui/drivers/cocoa/cocoa_common.m @@ -30,7 +30,6 @@ #import "GCDWebUploader.h" #import "WebServer.h" -extern UIView *g_pause_indicator_view; #endif #ifdef HAVE_METAL @@ -112,7 +111,10 @@ void *glkitview_init(void); #elif defined(HAVE_COCOATOUCH) self.view = (BRIDGE GLKView*)glkitview_init(); #if TARGET_OS_IOS - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showPauseIndicator) name:UIApplicationWillEnterForegroundNotification object:nil]; + UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(showNativeMenu)]; + swipe.numberOfTouchesRequired = 4; + swipe.direction = UISwipeGestureRecognizerDirectionDown; + [self.view addGestureRecognizer:swipe]; #endif #endif @@ -178,6 +180,10 @@ void *glkitview_init(void); } #elif TARGET_OS_IOS +-(void) showNativeMenu { + [[RetroArch_iOS get] toggleUI]; +} + - (UIRectEdge)preferredScreenEdgesDeferringSystemGestures { return UIRectEdgeBottom; @@ -217,13 +223,6 @@ void *glkitview_init(void); } } -- (void)showPauseIndicator -{ - g_pause_indicator_view.alpha = 1.0f; - [NSObject cancelPreviousPerformRequestsWithTarget:g_instance]; - [g_instance performSelector:@selector(hidePauseButton) withObject:g_instance afterDelay:3.0f]; -} - - (void)viewWillLayoutSubviews { float width = 0.0f, height = 0.0f, tenpctw, tenpcth; @@ -247,21 +246,9 @@ void *glkitview_init(void); tenpctw = width / 10.0f; tenpcth = height / 10.0f; - g_pause_indicator_view.frame = CGRectMake(tenpctw * 4.0f, 0.0f, tenpctw * 2.0f, tenpcth); - [g_pause_indicator_view viewWithTag:1].frame = CGRectMake(0, 0, tenpctw * 2.0f, tenpcth); [self adjustViewFrameForSafeArea]; } -#define ALMOST_INVISIBLE (.021f) - -- (void)hidePauseButton -{ - [UIView animateWithDuration:0.2 - animations:^{ g_pause_indicator_view.alpha = ALMOST_INVISIBLE; } - completion:^(BOOL finished) { } - ]; -} - /* NOTE: This version runs on iOS6+. */ - (NSUInteger)supportedInterfaceOrientations { @@ -294,8 +281,6 @@ void *glkitview_init(void); - (void)viewDidAppear:(BOOL)animated { #if TARGET_OS_IOS - /* Pause Menus. */ - [self showPauseIndicator]; if (@available(iOS 11.0, *)) { [self setNeedsUpdateOfHomeIndicatorAutoHidden]; }