diff options
author | fogine <7884288+fogine@users.noreply.github.com> | 2019-08-21 18:55:21 +0200 |
---|---|---|
committer | fogine <7884288+fogine@users.noreply.github.com> | 2019-08-21 22:22:18 +0200 |
commit | e0df9de0cb307b415e23a5157092eb5c8334c6b0 (patch) | |
tree | 31a7d927a17358d1bf1076b5c71e0cda72cb5227 | |
parent | 3bd49dabfa909187d514e018ff7c60339e343c71 (diff) |
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
-rw-r--r-- | platform/iphone/view_controller.h | 4 | ||||
-rw-r--r-- | platform/iphone/view_controller.mm | 12 |
2 files changed, 16 insertions, 0 deletions
diff --git a/platform/iphone/view_controller.h b/platform/iphone/view_controller.h index fc18661f62..68e3bc64fc 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 0358abf9e2..e52ad92bf2 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: |