Improve mismatching event size warning
Include both the event size and the current size in the warning message.
This commit is contained in:
parent
9f3b5ce5c6
commit
c7ec3e95c5
@ -8,6 +8,7 @@ import com.genymobile.scrcpy.device.Device;
|
||||
import com.genymobile.scrcpy.device.DeviceApp;
|
||||
import com.genymobile.scrcpy.device.Point;
|
||||
import com.genymobile.scrcpy.device.Position;
|
||||
import com.genymobile.scrcpy.device.Size;
|
||||
import com.genymobile.scrcpy.util.Ln;
|
||||
import com.genymobile.scrcpy.util.LogUtils;
|
||||
import com.genymobile.scrcpy.video.SurfaceCapture;
|
||||
@ -359,7 +360,9 @@ public class Controller implements AsyncProcessor, VirtualDisplayListener {
|
||||
|
||||
Point point = displayData.positionMapper.map(position);
|
||||
if (point == null) {
|
||||
Ln.w("Ignore touch event, it was generated for a different device size");
|
||||
Size eventSize = position.getScreenSize();
|
||||
Size currentSize = displayData.positionMapper.getVideoSize();
|
||||
Ln.w("Ignore touch event generated for size " + eventSize + " (current size is " + currentSize + ")");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -473,7 +476,9 @@ public class Controller implements AsyncProcessor, VirtualDisplayListener {
|
||||
|
||||
Point point = displayData.positionMapper.map(position);
|
||||
if (point == null) {
|
||||
Ln.w("Ignore scroll event, it was generated for a different device size");
|
||||
Size eventSize = position.getScreenSize();
|
||||
Size currentSize = displayData.positionMapper.getVideoSize();
|
||||
Ln.w("Ignore scroll event generated for size " + eventSize + " (current size is " + currentSize + ")");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,10 @@ public final class PositionMapper {
|
||||
return new PositionMapper(videoSize, transform);
|
||||
}
|
||||
|
||||
public Size getVideoSize() {
|
||||
return videoSize;
|
||||
}
|
||||
|
||||
public Point map(Position position) {
|
||||
Size clientVideoSize = position.getScreenSize();
|
||||
if (!videoSize.equals(clientVideoSize)) {
|
||||
|
@ -103,6 +103,6 @@ public final class Size {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Size{" + width + 'x' + height + '}';
|
||||
return width + "x" + height;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user