Merge pull request #91052 from bruvzg/ios_def_landscape

[iOS] Change default iPad landscape orientation from "left" to "right".
This commit is contained in:
Rémi Verschelde 2024-05-29 22:13:48 +02:00
commit eb6ab8f255
No known key found for this signature in database
GPG key ID: C3336907360768E1
3 changed files with 49 additions and 3 deletions

View file

@ -54,7 +54,7 @@
</array> </array>
<key>UISupportedInterfaceOrientations~ipad</key> <key>UISupportedInterfaceOrientations~ipad</key>
<array> <array>
$interface_orientations $ipad_interface_orientations
</array> </array>
$additional_plist_content $additional_plist_content
$plist_launch_screen_name $plist_launch_screen_name

View file

@ -541,6 +541,44 @@ void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_
} }
strnew += lines[i].replace("$interface_orientations", orientations); strnew += lines[i].replace("$interface_orientations", orientations);
} else if (lines[i].contains("$ipad_interface_orientations")) {
String orientations;
const DisplayServer::ScreenOrientation screen_orientation =
DisplayServer::ScreenOrientation(int(GLOBAL_GET("display/window/handheld/orientation")));
switch (screen_orientation) {
case DisplayServer::SCREEN_LANDSCAPE:
orientations += "<string>UIInterfaceOrientationLandscapeRight</string>\n";
break;
case DisplayServer::SCREEN_PORTRAIT:
orientations += "<string>UIInterfaceOrientationPortrait</string>\n";
break;
case DisplayServer::SCREEN_REVERSE_LANDSCAPE:
orientations += "<string>UIInterfaceOrientationLandscapeLeft</string>\n";
break;
case DisplayServer::SCREEN_REVERSE_PORTRAIT:
orientations += "<string>UIInterfaceOrientationPortraitUpsideDown</string>\n";
break;
case DisplayServer::SCREEN_SENSOR_LANDSCAPE:
// Allow both landscape orientations depending on sensor direction.
orientations += "<string>UIInterfaceOrientationLandscapeLeft</string>\n";
orientations += "<string>UIInterfaceOrientationLandscapeRight</string>\n";
break;
case DisplayServer::SCREEN_SENSOR_PORTRAIT:
// Allow both portrait orientations depending on sensor direction.
orientations += "<string>UIInterfaceOrientationPortrait</string>\n";
orientations += "<string>UIInterfaceOrientationPortraitUpsideDown</string>\n";
break;
case DisplayServer::SCREEN_SENSOR:
// Allow all screen orientations depending on sensor direction.
orientations += "<string>UIInterfaceOrientationLandscapeLeft</string>\n";
orientations += "<string>UIInterfaceOrientationLandscapeRight</string>\n";
orientations += "<string>UIInterfaceOrientationPortrait</string>\n";
orientations += "<string>UIInterfaceOrientationPortraitUpsideDown</string>\n";
break;
}
strnew += lines[i].replace("$ipad_interface_orientations", orientations);
} else if (lines[i].contains("$camera_usage_description")) { } else if (lines[i].contains("$camera_usage_description")) {
String description = p_preset->get("privacy/camera_usage_description"); String description = p_preset->get("privacy/camera_usage_description");
strnew += lines[i].replace("$camera_usage_description", description) + "\n"; strnew += lines[i].replace("$camera_usage_description", description) + "\n";

View file

@ -258,7 +258,11 @@
case DisplayServer::SCREEN_PORTRAIT: case DisplayServer::SCREEN_PORTRAIT:
return UIInterfaceOrientationMaskPortrait; return UIInterfaceOrientationMaskPortrait;
case DisplayServer::SCREEN_REVERSE_LANDSCAPE: case DisplayServer::SCREEN_REVERSE_LANDSCAPE:
return UIInterfaceOrientationMaskLandscapeRight; if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) {
return UIInterfaceOrientationMaskLandscapeLeft;
} else {
return UIInterfaceOrientationMaskLandscapeRight;
}
case DisplayServer::SCREEN_REVERSE_PORTRAIT: case DisplayServer::SCREEN_REVERSE_PORTRAIT:
return UIInterfaceOrientationMaskPortraitUpsideDown; return UIInterfaceOrientationMaskPortraitUpsideDown;
case DisplayServer::SCREEN_SENSOR_LANDSCAPE: case DisplayServer::SCREEN_SENSOR_LANDSCAPE:
@ -268,7 +272,11 @@
case DisplayServer::SCREEN_SENSOR: case DisplayServer::SCREEN_SENSOR:
return UIInterfaceOrientationMaskAll; return UIInterfaceOrientationMaskAll;
case DisplayServer::SCREEN_LANDSCAPE: case DisplayServer::SCREEN_LANDSCAPE:
return UIInterfaceOrientationMaskLandscapeLeft; if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) {
return UIInterfaceOrientationMaskLandscapeRight;
} else {
return UIInterfaceOrientationMaskLandscapeLeft;
}
} }
} }