-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
Pointer up event is ignored when screen rotating, causing touch pointer to stay #4925
Comments
Thank you for the report. I will think about it. |
Looking at #5894 I'm thinking how about sending all pointer events in portrait orientation. When device rotates, the (effective) screen size (in portrait orientation) won't change, so the event can still be accepted. As long as the client's orientation information matches what it displays, the pointer positions are still correct even if orientations on client and server don't match. However this would still not work when screen resolution really changes (like |
Semantically, it would probably be wrong. If you click on the scrcpy window while the device is in portrait mode, but you inject the event when the actual device is in landscape mode, the click will occur at a "wrong" location (the activity window will have already rotated). Better to ignore the click in that case I think. |
When the client is in portrait mode, it sends touch coordinates as-is, but when server receives those events, it knows the device is in landscape mode, so it will transform (rotate) those coordinates before injecting to system. The coordinates will reflect where the user touches on the screen, it doesn't care whether it's the correct UI element the user want. For example in this case, when user taps the fullscreen button and the screen rotates to landscape, the fullscreen button moves to another location and now the video player is under the finger, but the app will still receive several touch events to that location, before the user release their finger. |
This is true: typically, even without any rotation, if there's a high delay between the scrcpy window and the device, the click has been performed on a content "in the past". But for the specific case where the device rotation has changed, the click performed on the old orientation are almost always "unexpected" if we inject them in the new orientation. That's why I think these should be ignored (even if in theory that can cause minor disagreements, like a click pressed but not released, but I think the state is reset by Android on rotation anyway). In any case, that was the reason why I decided ignored it in the first place. |
Environment
Describe the bug
When device screen is rotating, there is a time window when the client sends touch events with incorrect screen size. These touch events are ignored by the server due to the incorrect screen size.
Normally this is fine, although the pointer stays on device screen, next time the mouse button is pressed, it's replaced by the new state. Except when the client side has a touch screen, because each finger has a different ID, the finger with ignored touch up event will stay permanently on device screen, causing incorrect behavior in apps. The only solution is to restart Scrcpy.
This can happen for example when user taps the full screen button in a video player, causing the screen to rotate. Or by releasing finger while using Alt + R to rotate the screen.
The text was updated successfully, but these errors were encountered: