mirror of
https://github.com/Genymobile/scrcpy
synced 2025-02-21 06:57:02 +00:00
Inject main display events to the original display
When mirroring a secondary display, touch and scroll events must be sent
to the mirroring virtual display id (with coordinates relative to the
virtual display size), rather than to the original display (with
coordinates relative to the original display size).
This behavior, introduced by d19396718e
,
was also applied for the main display for consistency. However, it
causes some UI elements to become unclickable.
To minimize inconveniences, restore the previous behavior when mirroring
the main display: send all events to the original display id (0) with
coordinates relative to the original display size.
Fixes #5545 <https://github.com/Genymobile/scrcpy/issues/5545>
Fixes #5605 <https://github.com/Genymobile/scrcpy/issues/5605>
Fixes #5616 <https://github.com/Genymobile/scrcpy/issues/5616>
Refs #4598 <https://github.com/Genymobile/scrcpy/issues/4598>
Refs #5137 <https://github.com/Genymobile/scrcpy/issues/5137>
Refs #5370 <https://github.com/Genymobile/scrcpy/pull/5370>
PR #5614 <https://github.com/Genymobile/scrcpy/pull/5614>
This commit is contained in:
parent
baa10ed0a3
commit
97fa77c76c
@ -129,10 +129,18 @@ public class ScreenCapture extends SurfaceCapture {
|
||||
try {
|
||||
virtualDisplay = ServiceManager.getDisplayManager()
|
||||
.createVirtualDisplay("scrcpy", inputSize.getWidth(), inputSize.getHeight(), displayId, surface);
|
||||
virtualDisplayId = virtualDisplay.getDisplay().getDisplayId();
|
||||
|
||||
// The positions are relative to the virtual display, not the original display (so use inputSize, not deviceSize!)
|
||||
positionMapper = PositionMapper.create(videoSize, transform, inputSize);
|
||||
|
||||
if (displayId == 0) {
|
||||
// Main display: send all events to the original display, relative to the device size
|
||||
Size deviceSize = displayInfo.getSize();
|
||||
positionMapper = PositionMapper.create(videoSize, transform, deviceSize);
|
||||
virtualDisplayId = 0;
|
||||
} else {
|
||||
// The positions are relative to the virtual display, not the original display (so use inputSize, not deviceSize!)
|
||||
positionMapper = PositionMapper.create(videoSize, transform, inputSize);
|
||||
virtualDisplayId = virtualDisplay.getDisplay().getDisplayId();
|
||||
}
|
||||
Ln.d("Display: using DisplayManager API");
|
||||
} catch (Exception displayManagerException) {
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user