Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notify ScreenEncoder when a folding event occurs #3979

Closed
wants to merge 3 commits into from

Conversation

AdoPi
Copy link
Contributor

@AdoPi AdoPi commented May 7, 2023

Hello 馃憢
It's been a while since my last contribution, it's a pleasure to be able to contribute again to this amazing project!

I'm a lucky owner of a foldable phone ( Z fold 4 ) and I've seen that scrcpy does not handle the fold events ( The SDL Window does not update its size when I bend my phone ).

I just fixed this issue ( it is implemented the same way as RotationWatcher ).

Btw I have a little concern about the naming of the boolean ScreenEncoder.rotationChanged which may not have a good name after this PR.

@Override
public void onFoldChanged(int displayId) {
// TODO: rename rotationChanged to something like displayChanged? To discuss with @rom1v
rotationChanged.set(true);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rom1v Here I guess this variable could be renamed? Or do we need two variables?

@rom1v
Copy link
Collaborator

rom1v commented May 7, 2023

Awesome, I didn't know there was such a fold change event.

I will review in details later (I have other things to implement/fix first). In any case, I will merge it for the next release (2.1).

Thank you.

rom1v added a commit that referenced this pull request May 29, 2023
The flag is used to reset the capture (restart the encoding) on rotation
change. It will also be used for other events (on folding change), so
rename it.

PR #3979 <#3979>
rom1v pushed a commit that referenced this pull request May 29, 2023
Handle folding event the same way as rotation events.

Fixes #3960 <#3960>
PR #3979 <#3979>

Signed-off-by: Romain Vimont <rom@rom1v.com>
@rom1v
Copy link
Collaborator

rom1v commented May 29, 2023

I rebased on current dev, fixed conflicts, and renamed rotationChanged to resetCapture in a separate commit.

I pushed to pr3979. Please review and test (to confirm I did not break anything compared to your PR).

rom1v added a commit that referenced this pull request Jun 1, 2023
The flag is used to reset the capture (restart the encoding) on rotation
change. It will also be used for other events (on folding change), so
rename it.

PR #3979 <#3979>
rom1v pushed a commit that referenced this pull request Jun 1, 2023
Handle folding event the same way as rotation events.

Fixes #3960 <#3960>
PR #3979 <#3979>

Signed-off-by: Romain Vimont <rom@rom1v.com>
@rom1v
Copy link
Collaborator

rom1v commented Jun 1, 2023

Merged: 24999d0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants