Merge branch 'master' into keyboard

This commit is contained in:
fufesou
2022-12-14 11:12:55 +08:00
19 changed files with 424 additions and 233 deletions

View File

@@ -5,6 +5,8 @@ import 'dart:ui' as ui;
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_custom_cursor/cursor_manager.dart'
as custom_cursor_manager;
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:wakelock/wakelock.dart';
@@ -109,17 +111,17 @@ class _RemotePageState extends State<RemotePage>
id: widget.id, arg: 'show-remote-cursor');
_zoomCursor.value =
bind.sessionGetToggleOptionSync(id: widget.id, arg: 'zoom-cursor');
if (!_isCustomCursorInited) {
customCursorController.registerNeedUpdateCursorCallback(
(String? lastKey, String? currentKey) async {
if (_firstEnterImage.value) {
_firstEnterImage.value = false;
return true;
}
return lastKey == null || lastKey != currentKey;
});
_isCustomCursorInited = true;
}
// if (!_isCustomCursorInited) {
// customCursorController.registerNeedUpdateCursorCallback(
// (String? lastKey, String? currentKey) async {
// if (_firstEnterImage.value) {
// _firstEnterImage.value = false;
// return true;
// }
// return lastKey == null || lastKey != currentKey;
// });
// _isCustomCursorInited = true;
// }
}
@override
@@ -366,15 +368,23 @@ class _ImagePaintState extends State<ImagePaint> {
return MouseCursor.defer;
} else {
final key = cache.updateGetKey(scale, zoomCursor.value);
cursor.addKey(key);
return FlutterCustomMemoryImageCursor(
pixbuf: cache.data,
key: key,
hotx: cache.hotx,
hoty: cache.hoty,
imageWidth: (cache.width * cache.scale).toInt(),
imageHeight: (cache.height * cache.scale).toInt(),
);
if (!cursor.cachedKeys.contains(key)) {
debugPrint("Register custom cursor with key $key");
// [Safety]
// It's ok to call async registerCursor in current synchronous context,
// because activating the cursor is also an async call and will always
// be executed after this.
custom_cursor_manager.CursorManager.instance
.registerCursor(custom_cursor_manager.CursorData()
..buffer = cache.data!
..height = (cache.height * cache.scale).toInt()
..width = (cache.width * cache.scale).toInt()
..hotX = cache.hotx
..hotY = cache.hoty
..name = key);
cursor.addKey(key);
}
return FlutterCustomMemoryImageCursor(key: key);
}
}

View File

@@ -19,7 +19,7 @@ import 'package:flutter_hbb/common/shared_state.dart';
import 'package:flutter_hbb/utils/multi_window_manager.dart';
import 'package:tuple/tuple.dart';
import 'package:image/image.dart' as img2;
import 'package:flutter_custom_cursor/flutter_custom_cursor.dart';
import 'package:flutter_custom_cursor/cursor_manager.dart';
import 'package:flutter_svg/flutter_svg.dart';
import '../common.dart';
@@ -1113,7 +1113,8 @@ class CursorModel with ChangeNotifier {
_clearCache() {
final keys = {...cachedKeys};
for (var k in keys) {
customCursorController.freeCache(k);
debugPrint("deleting cursor with key $k");
CursorManager.instance.deleteCursor(k);
}
}
}

View File

@@ -7,7 +7,7 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "49.0.0"
version: "50.0.0"
after_layout:
dependency: transitive
description:
@@ -21,7 +21,7 @@ packages:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
version: "5.2.0"
animations:
dependency: transitive
description:
@@ -352,7 +352,7 @@ packages:
name: file_picker
url: "https://pub.dartlang.org"
source: hosted
version: "5.2.1"
version: "5.2.3"
fixnum:
dependency: transitive
description:
@@ -389,12 +389,10 @@ packages:
flutter_custom_cursor:
dependency: "direct main"
description:
path: "."
ref: "74b1b314142b6775c1243067a3503ac568ebc74b"
resolved-ref: "74b1b314142b6775c1243067a3503ac568ebc74b"
url: "https://github.com/Kingtous/rustdesk_flutter_custom_cursor"
source: git
version: "0.0.1"
name: flutter_custom_cursor
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.2"
flutter_improved_scrolling:
dependency: "direct main"
description:
@@ -455,14 +453,14 @@ packages:
name: freezed
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.3.2"
freezed_annotation:
dependency: "direct main"
description:
name: freezed_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.2.0"
frontend_server_client:
dependency: transitive
description:
@@ -637,7 +635,7 @@ packages:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
version: "1.0.3"
nested:
dependency: transitive
description:
@@ -1106,7 +1104,7 @@ packages:
name: video_player
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.7"
version: "2.4.9"
video_player_android:
dependency: transitive
description:

View File

@@ -65,10 +65,7 @@ dependencies:
url: https://github.com/Kingtous/rustdesk_desktop_multi_window
ref: 82f9eab81cb2c7bfb938def7a1b399a6279bbc75
freezed_annotation: ^2.0.3
flutter_custom_cursor:
git:
url: https://github.com/Kingtous/rustdesk_flutter_custom_cursor
ref: 74b1b314142b6775c1243067a3503ac568ebc74b
flutter_custom_cursor: ^0.0.2
window_size:
git:
url: https://github.com/google/flutter-desktop-embedding.git