Support for automatically resizing between multiple displays
Environment
- OS: Windows 11
- scrcpy version: v2.1
- installation method: Windows release
- device model: Google Pixel Fold
- Android version: 13
Describe the bug Right now if I switch between displays on something like a foldable phone, the screen capture won't scale to the correct aspect ratio at all
Transitioning from the outer display to the inner display
Transitioning from the inner display to the outer display
@AdoPi (as the author of #3979): could you reproduce?
Sorry I can't reproduce. It works with the latest version available on master, on a Samsung Z Fold 4. Note that I'm testing on Linux, Currently I don't have Windows.
@Jnss98b Could you please add this little patch to help debugging this issue?
diff --git a/server/src/main/java/com/genymobile/scrcpy/Device.java b/server/src/main/java/com/genymobile/scrcpy/Device.java
index f817a3ce..e9da6742 100644
--- a/server/src/main/java/com/genymobile/scrcpy/Device.java
+++ b/server/src/main/java/com/genymobile/scrcpy/Device.java
@@ -103,6 +103,7 @@ public final class Device {
ServiceManager.getWindowManager().registerDisplayFoldListener(new IDisplayFoldListener.Stub() {
@Override
public void onDisplayFoldChanged(int displayId, boolean folded) {
+ Ln.i("==== onDisplayFoldChanged(" + displayId + ", " + folded + ")");
synchronized (Device.this) {
DisplayInfo displayInfo = ServiceManager.getDisplayManager().getDisplayInfo(displayId);
if (displayInfo == null) {
Thanks!
Will test it tomorrow when I get back. Currently out of town at the moment
@AdoPi Could you do me a favor and build a 64-bit windows release with the patch please? I'm having trouble building from source with msys2
@Jnss98b:
scrcpy-serverSHA-256: 783d4b65f31eb3b7162c97de6d7b1aa11b154140540b5bf2b0aadf8b210e9d05
(to be replaced in your v2.1 release)
Here's the log after I start scrcpy with the phone folded, unfolded it, and then folded it again
scrcpy 2.1 <https://github.com/Genymobile/scrcpy>
C:\Users\Anh Nguyen\Downloads\scrcpy-win64-v2.1\scrcpy-ser...file pushed, 0 skipped. 101.9 MB/s (91973 bytes in 0.001s)
[server] INFO: Device: [Google] google Pixel Fold (Android 13)
[server] INFO: ==== onDisplayFoldChanged(0, true)
INFO: Renderer: direct3d
INFO: Texture: 1080x2088
[server] INFO: ==== onDisplayFoldChanged(0, false)
[server] INFO: ==== onDisplayFoldChanged(0, true)
INFO: Texture: 2208x1840
WARN: Killing the server...
Any update on this? @AdoPi
Does your window size change when you fold your phone or not at all?
If possible for you, could you please try on Linux or Mac? I suspect it is an issue with the window and not with events sent from your device.
Does your window size change when you fold your phone or not at all?
Yeah it doesn't at all. Both when folding and unfolding
If possible for you, could you please try on Linux or Mac? I suspect it is an issue with the window and not with events sent from your device.
I could try it on linux. Does it matter if I test it on a VM?
I think you can use a VM yes!
Set up a ubuntu vm just to find out afterward that the latest packaged version for ubuntu is 1.25 lol fml
Just tested with scrcpy 2.1.1 on ubuntu 22.0.4.3 lts and I can still reproduce the issue
Looks like the window does resize automatically...but not in an intended way https://github.com/Genymobile/scrcpy/assets/24306400/36c7a1e3-185d-4991-83b2-9c6d2ba7243c
Thank you for your video! So it seems like your device sends the good fold event. @rom1v any idea of what's going on?
I can also reproduce the exact same behavior on scrcpy 2.1.1 on windows 11 22h2 too (on 2.1 the scrcpy window didn't resize automatically)
https://github.com/Genymobile/scrcpy/assets/24306400/6ced4210-666e-4ea0-af38-11d86737712b
I guess rotating your screen doesnt work too?
Actually, that works well haha. I've never had any issue with that, even with previous devices
Also, the demos I did today were on a different pc from the one I first discovered the issue on so I suppose it's reproducible on multiple hosts?
Changing display will cause the issue again tho
Outer display
https://github.com/Genymobile/scrcpy/assets/24306400/c1194a09-f525-4f24-a2f3-f91089a00163
Inner display
https://github.com/Genymobile/scrcpy/assets/24306400/3c000bf1-1e88-4acd-a37c-591fc46ab8fd
Not sure if anything changed but on v2.1.1 it seems to handle changing between displays a little bit better but still isn't really ideal. The inner display size will always be limited by the width of the outer display regardless of what display is in use when scrcpy was launched with folding events. The one time the inner display will be full size is if scrcpy was started with the inner display in use and the screen wasn't folded at all.
Starting scrcpy on the cover display:
https://github.com/Genymobile/scrcpy/assets/24306400/bd07f816-01a0-44d3-a999-be4dfa3a441f
Starting scrcpy from the inner display:
https://github.com/Genymobile/scrcpy/assets/24306400/7f37a763-e732-48b9-acea-4c28f29d67ae
Any movement on this by chance? I can also confirm the same exact issue with a Pixel Fold on macOS.