fix: web, reset cursor on disconn, back to main page (#9192)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou 2024-08-27 23:58:04 +08:00 committed by GitHub
parent fd178a7b6c
commit cf06d1028f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 1 deletions

View File

@ -784,7 +784,7 @@ class InputModel {
if (!isInputSourceFlutter) { if (!isInputSourceFlutter) {
bind.sessionEnterOrLeave(sessionId: sessionId, enter: enter); bind.sessionEnterOrLeave(sessionId: sessionId, enter: enter);
} }
if (enter) { if (!isWeb && enter) {
bind.setCurSessionId(sessionId: sessionId); bind.setCurSessionId(sessionId: sessionId);
} }
} }

View File

@ -2183,6 +2183,7 @@ class CursorModel with ChangeNotifier {
debugPrint("deleting cursor with key $k"); debugPrint("deleting cursor with key $k");
deleteCustomCursor(k); deleteCustomCursor(k);
} }
resetSystemCursor();
} }
trySetRemoteWindowCoords() { trySetRemoteWindowCoords() {

View File

@ -9,6 +9,7 @@ import 'package:flutter_hbb/models/model.dart';
deleteCustomCursor(String key) => deleteCustomCursor(String key) =>
custom_cursor_manager.CursorManager.instance.deleteCursor(key); custom_cursor_manager.CursorManager.instance.deleteCursor(key);
resetSystemCursor() {}
MouseCursor buildCursorOfCache( MouseCursor buildCursorOfCache(
CursorModel cursor, double scale, CursorData? cache) { CursorModel cursor, double scale, CursorData? cache) {

View File

@ -58,6 +58,11 @@ class CursorManager {
]); ]);
} }
} }
Future<void> resetSystemCursor() async {
latestKey = '';
js.context.callMethod('setByName', ['cursor', 'auto']);
}
} }
class FlutterCustomMemoryImageCursor extends MouseCursor { class FlutterCustomMemoryImageCursor extends MouseCursor {
@ -92,6 +97,7 @@ class _FlutterCustomMemoryImageCursorSession extends MouseCursorSession {
} }
deleteCustomCursor(String key) => CursorManager.instance.deleteCursor(key); deleteCustomCursor(String key) => CursorManager.instance.deleteCursor(key);
resetSystemCursor() => CursorManager.instance.resetSystemCursor();
MouseCursor buildCursorOfCache( MouseCursor buildCursorOfCache(
model.CursorModel cursor, double scale, model.CursorData? cache) { model.CursorModel cursor, double scale, model.CursorData? cache) {