mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 02:57:22 +00:00
fix, flutter, keyboard mode
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -159,7 +159,7 @@ class ToReleaseKeys {
|
||||
|
||||
class InputModel {
|
||||
final WeakReference<FFI> parent;
|
||||
String keyboardMode = "legacy";
|
||||
String keyboardMode = '';
|
||||
|
||||
// keyboard
|
||||
var shift = false;
|
||||
@@ -194,6 +194,24 @@ class InputModel {
|
||||
|
||||
InputModel(this.parent) {
|
||||
sessionId = parent.target!.sessionId;
|
||||
|
||||
// It is ok to call updateKeyboardMode() directly.
|
||||
// Because `bind` is initialized in `PlatformFFI.init()` which is called very early.
|
||||
// But we still wrap it in a Future.delayed() to make it more clear.
|
||||
Future.delayed(Duration(milliseconds: 100), () {
|
||||
updateKeyboardMode();
|
||||
});
|
||||
}
|
||||
|
||||
updateKeyboardMode() async {
|
||||
// * Currently mobile does not enable map mode
|
||||
if (isDesktop) {
|
||||
if (keyboardMode.isEmpty) {
|
||||
keyboardMode =
|
||||
await bind.sessionGetKeyboardMode(sessionId: sessionId) ??
|
||||
kKeyLegacyMode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KeyEventResult handleRawKeyEvent(RawKeyEvent e) {
|
||||
@@ -201,13 +219,6 @@ class InputModel {
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
|
||||
// * Currently mobile does not enable map mode
|
||||
if (isDesktop) {
|
||||
bind.sessionGetKeyboardMode(sessionId: sessionId).then((result) {
|
||||
keyboardMode = result.toString();
|
||||
});
|
||||
}
|
||||
|
||||
final key = e.logicalKey;
|
||||
if (e is RawKeyDownEvent) {
|
||||
if (!e.repeat) {
|
||||
|
||||
Reference in New Issue
Block a user