-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply a patch from SDL upstream that fixes orientation settings (#2730)
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
pythonforandroid/recipes/sdl2/sdl-orientation-pr-6984.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java | ||
index 2d7d69b76a25..edb42fb55461 100644 | ||
--- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java | ||
+++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java | ||
@@ -971,15 +971,18 @@ public void setOrientationBis(int w, int h, boolean resizable, String hint) | ||
/* If set, hint "explicitly controls which UI orientations are allowed". */ | ||
if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) { | ||
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE; | ||
- } else if (hint.contains("LandscapeRight")) { | ||
- orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; | ||
} else if (hint.contains("LandscapeLeft")) { | ||
+ orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; | ||
+ } else if (hint.contains("LandscapeRight")) { | ||
orientation_landscape = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; | ||
} | ||
|
||
- if (hint.contains("Portrait") && hint.contains("PortraitUpsideDown")) { | ||
+ /* exact match to 'Portrait' to distinguish with PortraitUpsideDown */ | ||
+ boolean contains_Portrait = hint.contains("Portrait ") || hint.endsWith("Portrait"); | ||
+ | ||
+ if (contains_Portrait && hint.contains("PortraitUpsideDown")) { | ||
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT; | ||
- } else if (hint.contains("Portrait")) { | ||
+ } else if (contains_Portrait) { | ||
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; | ||
} else if (hint.contains("PortraitUpsideDown")) { | ||
orientation_portrait = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; |