mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 11:06:57 +00:00
desktop mouse better control
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -741,6 +741,8 @@ class CursorModel with ChangeNotifier {
|
||||
double _displayOriginX = 0;
|
||||
double _displayOriginY = 0;
|
||||
bool got_mouse_control = true;
|
||||
DateTime _last_peer_mouse = DateTime.now()
|
||||
.subtract(Duration(milliseconds: 2 * kMouseControlTimeoutMSec));
|
||||
String id = '';
|
||||
WeakReference<FFI> parent;
|
||||
|
||||
@@ -756,6 +758,10 @@ class CursorModel with ChangeNotifier {
|
||||
double get hotx => _hotx;
|
||||
double get hoty => _hoty;
|
||||
|
||||
bool get is_peer_control_protected =>
|
||||
DateTime.now().difference(_last_peer_mouse).inMilliseconds <
|
||||
kMouseControlTimeoutMSec;
|
||||
|
||||
CursorModel(this.parent);
|
||||
|
||||
Set<String> get cachedKeys => _cacheKeys;
|
||||
@@ -917,7 +923,7 @@ class CursorModel with ChangeNotifier {
|
||||
if (parent.target?.id != pid) return;
|
||||
_image = image;
|
||||
_images[id] = Tuple3(image, _hotx, _hoty);
|
||||
await _updateCacheLinux(image, id, width, height);
|
||||
await _updateCache(image, id, width, height);
|
||||
try {
|
||||
// my throw exception, because the listener maybe already dispose
|
||||
notifyListeners();
|
||||
@@ -926,7 +932,7 @@ class CursorModel with ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
_updateCacheLinux(ui.Image image, int id, int w, int h) async {
|
||||
_updateCache(ui.Image image, int id, int w, int h) async {
|
||||
Uint8List? data;
|
||||
img2.Image? image2;
|
||||
if (Platform.isWindows) {
|
||||
@@ -981,6 +987,7 @@ class CursorModel with ChangeNotifier {
|
||||
/// Update the cursor position.
|
||||
updateCursorPosition(Map<String, dynamic> evt, String id) async {
|
||||
got_mouse_control = false;
|
||||
_last_peer_mouse = DateTime.now();
|
||||
_x = double.parse(evt['x']);
|
||||
_y = double.parse(evt['y']);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user