Fix native cursor display selection during local movement

This commit is contained in:
fufesou
2026-09-12 21:46:28 +08:00
parent 4d064a8445
commit 371e5e8f2d
3 changed files with 285 additions and 4 deletions

View File

@@ -449,6 +449,8 @@ class InputModel {
final isPhysicalMouse = false.obs;
int _lastButtons = 0;
Offset lastMousePos = Offset.zero;
// Host position echoes may be absent; keep locally mapped input separately.
final remotePointerPosition = Rxn<Offset>();
int _lastWheelTsUs = 0;
// Wheel acceleration thresholds.
@@ -1954,7 +1956,7 @@ class InputModel {
canvasModel.updateLocalCursor(x, y);
}
return _handlePointerDevicePos(
final point = _handlePointerDevicePos(
kind,
x,
y,
@@ -1965,6 +1967,20 @@ class InputModel {
onExit: onExit,
buttons: buttons,
);
_rememberRemotePointer(point, isMove);
return point;
}
void _rememberRemotePointer(Point? point, bool isMove) {
final peer = parent.target!.ffiModel;
if (point == null ||
!isMove ||
!(isDesktop || isWebDesktop) ||
peer.pi.currentDisplay != kAllDisplayValue ||
!peer.isPeerLinux) {
return;
}
remotePointerPosition.value = Offset(point.x.toDouble(), point.y.toDouble());
}
bool _isInCurrentWindow(double x, double y) {