From 0defb514bfdf0050f9096ca8de3f74a981ee7152 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 15 Nov 2024 18:46:08 +0100 Subject: [PATCH] Use natural device orientation for --new-display If no size is provided with --new-display, the main display size is used. But the actual size depended on the current device orientation. To make it deterministic, use the size of the natural device orientation (portrait for phones, landscape for tablets). PR #5455 --- .../java/com/genymobile/scrcpy/video/NewDisplayCapture.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java index 9138022e..1148be81 100644 --- a/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java +++ b/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java @@ -80,6 +80,9 @@ public class NewDisplayCapture extends SurfaceCapture { DisplayInfo displayInfo = ServiceManager.getDisplayManager().getDisplayInfo(0); if (displayInfo != null) { mainDisplaySize = displayInfo.getSize(); + if ((displayInfo.getRotation() % 2) != 0) { + mainDisplaySize = mainDisplaySize.rotate(); // Use the natural device orientation (at rotation 0), not the current one + } mainDisplayDpi = displayInfo.getDpi(); } else { Ln.w("Main display not found, fallback to 1920x1080 240dpi");