Browse Source

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)
fogine 6 years ago
parent
commit
6a4653f41c
2 changed files with 16 additions and 0 deletions
  1. 4 0
      platform/iphone/view_controller.h
  2. 12 0
      platform/iphone/view_controller.mm

+ 4 - 0
platform/iphone/view_controller.h

@@ -39,6 +39,10 @@
 
 - (void)didReceiveMemoryWarning;
 
+- (void)viewDidLoad;
+
+- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures;
+
 - (BOOL)prefersStatusBarHidden;
 
 @end

+ 12 - 0
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: