浏览代码

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 年之前
父节点
当前提交
6a4653f41c
共有 2 个文件被更改,包括 16 次插入0 次删除
  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: