فهرست منبع

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
fogine 6 سال پیش
والد
کامیت
e0df9de0cb
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: