From cb2caa7ef1cd9716ab04a6141778dbc1ea43289e Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Mon, 5 Aug 2019 22:58:59 -0700 Subject: [PATCH] Replaces screen edge gesture hack with preferredScreenEdgesDeferringSystemGestures We want priority over system gestures when tapping near edges of screen. Previously, we needed to access the private screen edge gesture recognizer, but now we can use preferredScreenEdgesDeferringSystemGestures. --- Delta/AppDelegate.swift | 6 ------ Delta/Emulation/GameViewController.swift | 4 ++++ Delta/Launch/LaunchViewController.swift | 4 ++++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Delta/AppDelegate.swift b/Delta/AppDelegate.swift index 1c72c92..564841a 100644 --- a/Delta/AppDelegate.swift +++ b/Delta/AppDelegate.swift @@ -33,12 +33,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate self.configureAppearance() - // Disable system gestures that delay touches on left edge of screen - for gestureRecognizer in self.window?.gestureRecognizers ?? [] where NSStringFromClass(type(of: gestureRecognizer)).contains("GateGesture") - { - gestureRecognizer.delaysTouchesBegan = false - } - // Controllers ExternalGameControllerManager.shared.startMonitoring() diff --git a/Delta/Emulation/GameViewController.swift b/Delta/Emulation/GameViewController.swift index edb8d81..f2a936e 100644 --- a/Delta/Emulation/GameViewController.swift +++ b/Delta/Emulation/GameViewController.swift @@ -131,6 +131,10 @@ class GameViewController: DeltaCore.GameViewController return !self.isGyroActive } + override var preferredScreenEdgesDeferringSystemGestures: UIRectEdge { + return .all + } + required init() { super.init() diff --git a/Delta/Launch/LaunchViewController.swift b/Delta/Launch/LaunchViewController.swift index 58204e7..7a561cb 100644 --- a/Delta/Launch/LaunchViewController.swift +++ b/Delta/Launch/LaunchViewController.swift @@ -34,6 +34,10 @@ class LaunchViewController: RSTLaunchViewController return self.gameViewController } + override var childForScreenEdgesDeferringSystemGestures: UIViewController? { + return self.gameViewController + } + override var shouldAutorotate: Bool { return self.gameViewController?.shouldAutorotate ?? true }