Android: Use SCREEN_ORIENTATION_FULL_USER instead of SCREEN_ORIENTATION_FULL_SENSOR for resizable window.

The former will respect user orientation lock setting while the latter does not.

(cherry picked from commit 3373667faa)
(cherry picked from commit 77285b6c3f)
This commit is contained in:
Miku AuahDark 2024-06-17 19:17:37 +08:00 committed by Sam Lantinga
parent 325465935d
commit f8943854fd

View file

@ -995,8 +995,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
/* No valid hint, nothing is explicitly allowed */ /* No valid hint, nothing is explicitly allowed */
if (!is_portrait_allowed && !is_landscape_allowed) { if (!is_portrait_allowed && !is_landscape_allowed) {
if (resizable) { if (resizable) {
/* All orientations are allowed */ /* All orientations are allowed, respecting user orientation lock setting */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR; req = ActivityInfo.SCREEN_ORIENTATION_FULL_USER;
} else { } else {
/* Fixed window and nothing specified. Get orientation from w/h of created window */ /* Fixed window and nothing specified. Get orientation from w/h of created window */
req = (w > h ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); req = (w > h ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
@ -1005,8 +1005,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
/* At least one orientation is allowed */ /* At least one orientation is allowed */
if (resizable) { if (resizable) {
if (is_portrait_allowed && is_landscape_allowed) { if (is_portrait_allowed && is_landscape_allowed) {
/* hint allows both landscape and portrait, promote to full sensor */ /* hint allows both landscape and portrait, promote to full user */
req = ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR; req = ActivityInfo.SCREEN_ORIENTATION_FULL_USER;
} else { } else {
/* Use the only one allowed "orientation" */ /* Use the only one allowed "orientation" */
req = (is_landscape_allowed ? orientation_landscape : orientation_portrait); req = (is_landscape_allowed ? orientation_landscape : orientation_portrait);