summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
765 // If we have API access, calculate the safe area to draw the overlay 765 // If we have API access, calculate the safe area to draw the overlay
766 var cutoutLeft = 0 766 var cutoutLeft = 0
767 var cutoutBottom = 0 767 var cutoutBottom = 0
768 val insets = context.windowManager.currentWindowMetrics.windowInsets.displayCutout 768 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
769 if (insets != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { 769 val insets = context.windowManager.currentWindowMetrics.windowInsets.displayCutout
770 if (insets.boundingRectTop.bottom != 0 && insets.boundingRectTop.bottom > maxY / 2) 770 if (insets != null) {
771 insets.boundingRectTop.bottom.toFloat() else maxY 771 if (insets.boundingRectTop.bottom != 0 && insets.boundingRectTop.bottom > maxY / 2)
772 if (insets.boundingRectRight.left != 0 && insets.boundingRectRight.left > maxX / 2) 772 insets.boundingRectTop.bottom.toFloat() else maxY
773 insets.boundingRectRight.left.toFloat() else maxX 773 if (insets.boundingRectRight.left != 0 && insets.boundingRectRight.left > maxX / 2)
774 774 insets.boundingRectRight.left.toFloat() else maxX
775 minX = insets.boundingRectLeft.right - insets.boundingRectLeft.left 775
776 minY = insets.boundingRectBottom.top - insets.boundingRectBottom.bottom 776 minX = insets.boundingRectLeft.right - insets.boundingRectLeft.left
777 777 minY = insets.boundingRectBottom.top - insets.boundingRectBottom.bottom
778 cutoutLeft = insets.boundingRectRight.right - insets.boundingRectRight.left 778
779 cutoutBottom = insets.boundingRectTop.top - insets.boundingRectTop.bottom 779 cutoutLeft = insets.boundingRectRight.right - insets.boundingRectRight.left
780 cutoutBottom = insets.boundingRectTop.top - insets.boundingRectTop.bottom
781 }
780 } 782 }
781 783
782 // This makes sure that if we have an inset on one side of the screen, we mirror it on 784 // This makes sure that if we have an inset on one side of the screen, we mirror it on