mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
feat, input source, win->win
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -69,8 +69,6 @@ const String kOptionOpenInTabs = "allow-open-in-tabs";
|
||||
const String kOptionOpenInWindows = "allow-open-in-windows";
|
||||
const String kOptionForceAlwaysRelay = "force-always-relay";
|
||||
|
||||
const String kOptionInputSource = "input-source";
|
||||
|
||||
const String kUniLinksPrefix = "rustdesk://";
|
||||
const String kUrlActionClose = "close";
|
||||
|
||||
|
||||
@@ -1694,23 +1694,24 @@ class _KeyboardMenu extends StatelessWidget {
|
||||
final inputSource = stateGlobal.getInputSource();
|
||||
final enabled = !ffi.ffiModel.viewOnly;
|
||||
return Column(
|
||||
children: supportedInputSourceList.map((e) {
|
||||
final d = e as List<dynamic>;
|
||||
return RdoMenuButton<String>(
|
||||
child: Text(translate(d[1] as String)),
|
||||
value: d[0] as String,
|
||||
groupValue: inputSource,
|
||||
onChanged: enabled
|
||||
? (e) {
|
||||
if (e != null) {
|
||||
stateGlobal.setInputSource(e);
|
||||
}
|
||||
}
|
||||
: null,
|
||||
ffi: ffi,
|
||||
);
|
||||
}).toList(),
|
||||
children: supportedInputSourceList.map((e) {
|
||||
final d = e as List<dynamic>;
|
||||
return RdoMenuButton<String>(
|
||||
child: Text(translate(d[1] as String)),
|
||||
value: d[0] as String,
|
||||
groupValue: inputSource,
|
||||
onChanged: enabled
|
||||
? (v) async {
|
||||
if (v != null) {
|
||||
await stateGlobal.setInputSource(ffi.sessionId, v);
|
||||
await ffi.ffiModel.checkDesktopKeyboardMode();
|
||||
}
|
||||
}
|
||||
: null,
|
||||
ffi: ffi,
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
}
|
||||
|
||||
viewMode() {
|
||||
|
||||
@@ -735,16 +735,9 @@ class FfiModel with ChangeNotifier {
|
||||
}
|
||||
|
||||
checkDesktopKeyboardMode() async {
|
||||
final curMode = await bind.sessionGetKeyboardMode(sessionId: sessionId);
|
||||
if (curMode != null) {
|
||||
if (bind.sessionIsKeyboardModeSupported(
|
||||
sessionId: sessionId, mode: curMode)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If current keyboard mode is not supported, change to another one.
|
||||
if (isInputSourceFlutter) {
|
||||
// Local side, flutter keyboard input source
|
||||
// Currently only map mode is supported, legacy mode is used for compatibility.
|
||||
for (final mode in [kKeyMapMode, kKeyLegacyMode]) {
|
||||
if (bind.sessionIsKeyboardModeSupported(
|
||||
sessionId: sessionId, mode: mode)) {
|
||||
@@ -753,6 +746,15 @@ class FfiModel with ChangeNotifier {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
final curMode = await bind.sessionGetKeyboardMode(sessionId: sessionId);
|
||||
if (curMode != null) {
|
||||
if (bind.sessionIsKeyboardModeSupported(
|
||||
sessionId: sessionId, mode: curMode)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If current keyboard mode is not supported, change to another one.
|
||||
for (final mode in [kKeyMapMode, kKeyTranslateMode, kKeyLegacyMode]) {
|
||||
if (bind.sessionIsKeyboardModeSupported(
|
||||
sessionId: sessionId, mode: mode)) {
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:desktop_multi_window/desktop_multi_window.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hbb/common.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../consts.dart';
|
||||
@@ -98,14 +99,14 @@ class StateGlobal {
|
||||
|
||||
String getInputSource({bool force = false}) {
|
||||
if (force || _inputSource.isEmpty) {
|
||||
_inputSource = bind.mainGetLocalOption(key: kOptionInputSource);
|
||||
_inputSource = bind.mainGetInputSource();
|
||||
}
|
||||
return _inputSource;
|
||||
}
|
||||
|
||||
void setInputSource(String v) async {
|
||||
await bind.mainSetLocalOption(key: kOptionInputSource, value: v);
|
||||
_inputSource = bind.mainGetLocalOption(key: kOptionInputSource);
|
||||
setInputSource(SessionID sessionId, String v) async {
|
||||
await bind.mainSetInputSource(sessionId: sessionId, value: v);
|
||||
_inputSource = bind.mainGetInputSource();
|
||||
}
|
||||
|
||||
StateGlobal._();
|
||||
|
||||
Reference in New Issue
Block a user