From 6a4653f41cc8010734124c5791ec1011c1e19283 Mon Sep 17 00:00:00 2001 From: fogine <7884288+fogine@users.noreply.github.com> Date: Wed, 21 Aug 2019 18:55:21 +0200 Subject: [PATCH] iOS>=11 platform - when handling gestures on screen edges, godot apps should have priority over OS Solves an issue where iOS would steal InputEventTouch events when near screen edges in order to handle system wide gestures. Fixes #31503 (cherry picked from commit e0df9de0cb307b415e23a5157092eb5c8334c6b0) --- platform/iphone/view_controller.h | 4 ++++ platform/iphone/view_controller.mm | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/platform/iphone/view_controller.h b/platform/iphone/view_controller.h index fc18661f621..68e3bc64fc7 100644 --- a/platform/iphone/view_controller.h +++ b/platform/iphone/view_controller.h @@ -39,6 +39,10 @@ - (void)didReceiveMemoryWarning; +- (void)viewDidLoad; + +- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures; + - (BOOL)prefersStatusBarHidden; @end diff --git a/platform/iphone/view_controller.mm b/platform/iphone/view_controller.mm index 0358abf9e23..e52ad92bf2a 100644 --- a/platform/iphone/view_controller.mm +++ b/platform/iphone/view_controller.mm @@ -83,6 +83,18 @@ int add_cmdline(int p_argc, char **p_args) { printf("*********** did receive memory warning!\n"); }; +- (void)viewDidLoad { + [super viewDidLoad]; + + if (@available(iOS 11.0, *)) { + [self setNeedsUpdateOfScreenEdgesDeferringSystemGestures]; + } +} + +- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures { + return UIRectEdgeAll; +} + - (BOOL)shouldAutorotate { switch (OS::get_singleton()->get_screen_orientation()) { case OS::SCREEN_SENSOR: