summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2023-06-10 00:27:21 +0200
committerGitHub <noreply@github.com>2023-06-10 00:27:21 +0200
commit55b543f466b61ed5450afdd0a23317bcacccf4e1 (patch)
tree991ca203f150c4d598d9d05c9ebd0bbd5f4928c3
parentMerge pull request #10614 from xcfrg/shader-backend-status-bar (diff)
parentandroid: Fix input overlay version check (diff)
downloadyuzu-55b543f466b61ed5450afdd0a23317bcacccf4e1.tar
yuzu-55b543f466b61ed5450afdd0a23317bcacccf4e1.tar.gz
yuzu-55b543f466b61ed5450afdd0a23317bcacccf4e1.tar.bz2
yuzu-55b543f466b61ed5450afdd0a23317bcacccf4e1.tar.lz
yuzu-55b543f466b61ed5450afdd0a23317bcacccf4e1.tar.xz
yuzu-55b543f466b61ed5450afdd0a23317bcacccf4e1.tar.zst
yuzu-55b543f466b61ed5450afdd0a23317bcacccf4e1.zip
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt
index c9f5797ac..aa424c768 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt
@@ -765,18 +765,20 @@ class InputOverlay(context: Context, attrs: AttributeSet?) : SurfaceView(context
// If we have API access, calculate the safe area to draw the overlay
var cutoutLeft = 0
var cutoutBottom = 0
- val insets = context.windowManager.currentWindowMetrics.windowInsets.displayCutout
- if (insets != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
- if (insets.boundingRectTop.bottom != 0 && insets.boundingRectTop.bottom > maxY / 2)
- insets.boundingRectTop.bottom.toFloat() else maxY
- if (insets.boundingRectRight.left != 0 && insets.boundingRectRight.left > maxX / 2)
- insets.boundingRectRight.left.toFloat() else maxX
-
- minX = insets.boundingRectLeft.right - insets.boundingRectLeft.left
- minY = insets.boundingRectBottom.top - insets.boundingRectBottom.bottom
-
- cutoutLeft = insets.boundingRectRight.right - insets.boundingRectRight.left
- cutoutBottom = insets.boundingRectTop.top - insets.boundingRectTop.bottom
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
+ val insets = context.windowManager.currentWindowMetrics.windowInsets.displayCutout
+ if (insets != null) {
+ if (insets.boundingRectTop.bottom != 0 && insets.boundingRectTop.bottom > maxY / 2)
+ insets.boundingRectTop.bottom.toFloat() else maxY
+ if (insets.boundingRectRight.left != 0 && insets.boundingRectRight.left > maxX / 2)
+ insets.boundingRectRight.left.toFloat() else maxX
+
+ minX = insets.boundingRectLeft.right - insets.boundingRectLeft.left
+ minY = insets.boundingRectBottom.top - insets.boundingRectBottom.bottom
+
+ cutoutLeft = insets.boundingRectRight.right - insets.boundingRectRight.left
+ cutoutBottom = insets.boundingRectTop.top - insets.boundingRectTop.bottom
+ }
}
// This makes sure that if we have an inset on one side of the screen, we mirror it on