mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-01-19 00:13:01 +08:00
Merge pull request #1658 from fufesou/fix_linux_cursor_image
flutter_desktop: fix cursor image when cursor moved in from other window
This commit is contained in:
commit
46613397e6
@ -1113,3 +1113,12 @@ Future<Map<String, String>> getHttpHeaders() async {
|
||||
'Bearer ${await bind.mainGetLocalOption(key: 'access_token')}'
|
||||
};
|
||||
}
|
||||
|
||||
// Simple wrapper of built-in types for refrence use.
|
||||
class SimpleWrapper<T> {
|
||||
T t;
|
||||
SimpleWrapper(this.t);
|
||||
|
||||
T get value => t;
|
||||
set value(T t) => this.t = t;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import '../../models/platform_model.dart';
|
||||
import '../../common/shared_state.dart';
|
||||
|
||||
bool _isCustomCursorInited = false;
|
||||
final SimpleWrapper<bool> _firstEnterImage = SimpleWrapper(false);
|
||||
|
||||
class RemotePage extends StatefulWidget {
|
||||
const RemotePage({
|
||||
@ -102,6 +103,10 @@ class _RemotePageState extends State<RemotePage>
|
||||
if (!_isCustomCursorInited) {
|
||||
customCursorController.registerNeedUpdateCursorCallback(
|
||||
(String? lastKey, String? currentKey) async {
|
||||
if (_firstEnterImage.value) {
|
||||
_firstEnterImage.value = false;
|
||||
return true;
|
||||
}
|
||||
return lastKey == null || lastKey != currentKey;
|
||||
});
|
||||
_isCustomCursorInited = true;
|
||||
@ -172,6 +177,7 @@ class _RemotePageState extends State<RemotePage>
|
||||
_rawKeyFocusNode.requestFocus();
|
||||
}
|
||||
_cursorOverImage.value = true;
|
||||
_firstEnterImage.value = true;
|
||||
if (_onEnterOrLeaveImage4Menubar != null) {
|
||||
try {
|
||||
_onEnterOrLeaveImage4Menubar!(true);
|
||||
@ -184,6 +190,7 @@ class _RemotePageState extends State<RemotePage>
|
||||
|
||||
void leaveView(PointerExitEvent evt) {
|
||||
_cursorOverImage.value = false;
|
||||
_firstEnterImage.value = false;
|
||||
if (_onEnterOrLeaveImage4Menubar != null) {
|
||||
try {
|
||||
_onEnterOrLeaveImage4Menubar!(false);
|
||||
|
Loading…
Reference in New Issue
Block a user