Skip to content

Commit

Permalink
Use up-to-date values on display fold change
Browse files Browse the repository at this point in the history
When a display is folded or unfolded, the maxSize may have been updated
since the option was passed, and deviceSize must be updated.

Refs #4469 <#4469>
  • Loading branch information
rom1v committed Dec 4, 2023
1 parent 1beec99 commit c9a4d2b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/src/main/java/com/genymobile/scrcpy/Device.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ public interface ClipboardListener {
void onClipboardTextChanged(String text);
}

private final Size deviceSize;
private final Rect crop;
private int maxSize;
private final int lockVideoOrientation;

private Size deviceSize;
private ScreenInfo screenInfo;
private RotationListener rotationListener;
private FoldListener foldListener;
Expand Down Expand Up @@ -116,8 +116,8 @@ public void onDisplayFoldChanged(int displayId, boolean folded) {
return;
}

screenInfo = ScreenInfo.computeScreenInfo(displayInfo.getRotation(), displayInfo.getSize(), options.getCrop(),
options.getMaxSize(), options.getLockVideoOrientation());
deviceSize = displayInfo.getSize();
screenInfo = ScreenInfo.computeScreenInfo(displayInfo.getRotation(), deviceSize, crop, maxSize, lockVideoOrientation);
// notify
if (foldListener != null) {
foldListener.onFoldChanged(displayId, folded);
Expand Down

0 comments on commit c9a4d2b

Please sign in to comment.