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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

screen rotation #489

Open
dude105tanki opened this issue Apr 7, 2019 · 8 comments
Open

screen rotation #489

dude105tanki opened this issue Apr 7, 2019 · 8 comments
Labels

Comments

@dude105tanki
Copy link

I have a bug on my LG device where the screen on my pc is rotated 90 degrees but still functions as if the touches were not. it is similar to this issue, #186

but the reference there doesn't help me.
sdfgsdfgsdfg

how do i fix this bug and/or rotate the screen on my pc

@rom1v
Copy link
Collaborator

rom1v commented Apr 7, 2019

Also similar to #481.

@rom1v rom1v added the rotation label Apr 7, 2019
@dude105tanki
Copy link
Author

kinda
more like this, I suck at explaining things anyways.
https://youtu.be/kVBgShD9E_w

@codeandcreate
Copy link

This also happens to the planet computers gemini.

@syockit
Copy link

syockit commented Feb 22, 2020

On Planet Computers Gemini PDA, when I modify the DisplayManager wrapper to use appWidth/Height instead of logicalWidth/Height, the correct orientation is displayed for some apps (including the home screen), but still fails for full screen application (games). The logical dimensions are 2160x1080, while the reported appWidth/Height are 2032x1080. The cropped 128 pixels correspond to the android buttons which appear to the right.

Playing around with contentRect width, I found that the correction orientation is displayed when width is ≤ 2038 pixels. There's probably something on the android side that rotates the display when requesting content above certain dimensions.

Currently, as a workaround for viewing full screen games, I hardcoded the rotation set by setDisplayProjection to 3 (taking hint from Ihttps://github.com//pull/1151).

@rom1v
Copy link
Collaborator

rom1v commented Apr 25, 2020

It seems scrcpy is incapible of rotating the screen properly when it detects a rotation with or without the keybind.

In fact, it does... when the device/ROM correctly notifies the rotation event:

https://github.com/Genymobile/scrcpy/blob/master/server/src/main/java/com/genymobile/scrcpy/Device.java#L30

@rom1v
Copy link
Collaborator

rom1v commented May 9, 2020

Clearly something wrong with the code if it can't switch between Portrait and Landscape modes interchangeably without stretching or squashing the screen proportions and render it correctly.

Of course something is wrong. To handle this properly, scrcpy restart the video encoding when the device notifies the rotation change (because the video dimension change).

It works pretty well. But some devices (apparently) do not call the onRotationChange callback, so in that case the video encoding is not restarted, and stretch the new screen surface to the old dimensions on the device side.

Because the device is correctly notifies for the rotation event.

Are you sure?

Could you add a log here:

synchronized (Device.this) {
screenInfo = screenInfo.withDeviceRotation(rotation);
// notify
if (rotationListener != null) {
rotationListener.onRotationChanged(rotation);
}
}

and verify that it is printed when you rotate your device?

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

No branches or pull requests

5 participants
@rom1v @syockit @codeandcreate @dude105tanki and others