Merge branch 'rustdesk:master' into feat/list_view

This commit is contained in:
Sahil Yeole 2023-10-26 05:32:00 +05:30 committed by GitHub
commit 6113d1e3eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 62 additions and 34 deletions

View File

@ -49,7 +49,7 @@ Go through [DEVCONTAINER.md](docs/DEVCONTAINER.md) for more info.
## Dependencies ## Dependencies
Desktop versions use [Sciter](https://sciter.com/) or Flutter for GUI, this tutorial is for Sciter only. Desktop versions use Flutter or Sciter (deprecated) for GUI, this tutorial is for Sciter only, since it is easier and more friendly to starter. Check out our [CI](https://github.com/rustdesk/rustdesk/blob/master/.github/workflows/flutter-build.yml) for building Flutter version.
Please download Sciter dynamic library yourself. Please download Sciter dynamic library yourself.
@ -170,12 +170,12 @@ Please ensure that you are running these commands from the root of the RustDesk
- **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)**: video codec, config, tcp/udp wrapper, protobuf, fs functions for file transfer, and some other utility functions - **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)**: video codec, config, tcp/udp wrapper, protobuf, fs functions for file transfer, and some other utility functions
- **[libs/scrap](https://github.com/rustdesk/rustdesk/tree/master/libs/scrap)**: screen capture - **[libs/scrap](https://github.com/rustdesk/rustdesk/tree/master/libs/scrap)**: screen capture
- **[libs/enigo](https://github.com/rustdesk/rustdesk/tree/master/libs/enigo)**: platform specific keyboard/mouse control - **[libs/enigo](https://github.com/rustdesk/rustdesk/tree/master/libs/enigo)**: platform specific keyboard/mouse control
- **[src/ui](https://github.com/rustdesk/rustdesk/tree/master/src/ui)**: GUI - **[src/ui](https://github.com/rustdesk/rustdesk/tree/master/src/ui)**: obsolete Sciter UI (deprecated)
- **[src/server](https://github.com/rustdesk/rustdesk/tree/master/src/server)**: audio/clipboard/input/video services, and network connections - **[src/server](https://github.com/rustdesk/rustdesk/tree/master/src/server)**: audio/clipboard/input/video services, and network connections
- **[src/client.rs](https://github.com/rustdesk/rustdesk/tree/master/src/client.rs)**: start a peer connection - **[src/client.rs](https://github.com/rustdesk/rustdesk/tree/master/src/client.rs)**: start a peer connection
- **[src/rendezvous_mediator.rs](https://github.com/rustdesk/rustdesk/tree/master/src/rendezvous_mediator.rs)**: Communicate with [rustdesk-server](https://github.com/rustdesk/rustdesk-server), wait for remote direct (TCP hole punching) or relayed connection - **[src/rendezvous_mediator.rs](https://github.com/rustdesk/rustdesk/tree/master/src/rendezvous_mediator.rs)**: Communicate with [rustdesk-server](https://github.com/rustdesk/rustdesk-server), wait for remote direct (TCP hole punching) or relayed connection
- **[src/platform](https://github.com/rustdesk/rustdesk/tree/master/src/platform)**: platform specific code - **[src/platform](https://github.com/rustdesk/rustdesk/tree/master/src/platform)**: platform specific code
- **[flutter](https://github.com/rustdesk/rustdesk/tree/master/flutter)**: Flutter code for mobile - **[flutter](https://github.com/rustdesk/rustdesk/tree/master/flutter)**: Flutter code for desktop and mobile
- **[flutter/web/js](https://github.com/rustdesk/rustdesk/tree/master/flutter/web/js)**: JavaScript for Flutter web client - **[flutter/web/js](https://github.com/rustdesk/rustdesk/tree/master/flutter/web/js)**: JavaScript for Flutter web client
## Snapshots ## Snapshots

View File

@ -2024,6 +2024,10 @@ connect(
final idController = Get.find<IDTextEditingController>(); final idController = Get.find<IDTextEditingController>();
idController.text = formatID(id); idController.text = formatID(id);
} }
if (Get.isRegistered<TextEditingController>()){
final fieldTextEditingController = Get.find<TextEditingController>();
fieldTextEditingController.text = formatID(id);
}
} catch (_) {} } catch (_) {}
} }
id = id.replaceAll(' ', ''); id = id.replaceAll(' ', '');

View File

@ -11,6 +11,10 @@ const int kMainWindowId = 0;
const kAllDisplayValue = -1; const kAllDisplayValue = -1;
const kKeyLegacyMode = 'legacy';
const kKeyMapMode = 'map';
const kKeyTranslateMode = 'translate';
const String kPeerPlatformWindows = "Windows"; const String kPeerPlatformWindows = "Windows";
const String kPeerPlatformLinux = "Linux"; const String kPeerPlatformLinux = "Linux";
const String kPeerPlatformMacOS = "Mac OS"; const String kPeerPlatformMacOS = "Mac OS";

View File

@ -81,6 +81,9 @@ class _ConnectionPageState extends State<ConnectionPage>
if (Get.isRegistered<IDTextEditingController>()) { if (Get.isRegistered<IDTextEditingController>()) {
Get.delete<IDTextEditingController>(); Get.delete<IDTextEditingController>();
} }
if (Get.isRegistered<TextEditingController>()){
Get.delete<TextEditingController>();
}
super.dispose(); super.dispose();
} }
@ -235,6 +238,7 @@ class _ConnectionPageState extends State<ConnectionPage>
VoidCallback onFieldSubmitted, VoidCallback onFieldSubmitted,
) { ) {
fieldTextEditingController.text = _idController.text; fieldTextEditingController.text = _idController.text;
Get.put<TextEditingController>(fieldTextEditingController);
fieldFocusNode.addListener(() async { fieldFocusNode.addListener(() async {
_idInputFocused.value = fieldFocusNode.hasFocus; _idInputFocused.value = fieldFocusNode.hasFocus;
if (fieldFocusNode.hasFocus && !isPeersLoading){ if (fieldFocusNode.hasFocus && !isPeersLoading){
@ -271,18 +275,6 @@ class _ConnectionPageState extends State<ConnectionPage>
onChanged: (v) { onChanged: (v) {
_idController.id = v; _idController.id = v;
}, },
onSubmitted: (s) {
if (s == '') {
return;
}
try {
final id = int.parse(s);
_idController.id = s;
onConnect();
} catch (_) {
return;
}
},
)); ));
}, },
optionsViewBuilder: (BuildContext context, AutocompleteOnSelected<Peer> onSelected, Iterable<Peer> options) { optionsViewBuilder: (BuildContext context, AutocompleteOnSelected<Peer> onSelected, Iterable<Peer> options) {

View File

@ -26,10 +26,6 @@ import '../../common/shared_state.dart';
import './popup_menu.dart'; import './popup_menu.dart';
import './kb_layout_type_chooser.dart'; import './kb_layout_type_chooser.dart';
const _kKeyLegacyMode = 'legacy';
const _kKeyMapMode = 'map';
const _kKeyTranslateMode = 'translate';
class ToolbarState { class ToolbarState {
final kStoreKey = 'remoteMenubarState'; final kStoreKey = 'remoteMenubarState';
late RxBool show; late RxBool show;
@ -1406,18 +1402,16 @@ class _KeyboardMenu extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
var ffiModel = Provider.of<FfiModel>(context); var ffiModel = Provider.of<FfiModel>(context);
if (!ffiModel.keyboard) return Offstage(); if (!ffiModel.keyboard) return Offstage();
// If use flutter to grab keys, we can only use one mode.
// Map mode and Legacy mode, at least one of them is supported.
String? modeOnly; String? modeOnly;
if (stateGlobal.grabKeyboard) { if (stateGlobal.grabKeyboard) {
if (bind.sessionIsKeyboardModeSupported( if (bind.sessionIsKeyboardModeSupported(
sessionId: ffi.sessionId, mode: _kKeyMapMode)) { sessionId: ffi.sessionId, mode: kKeyMapMode)) {
bind.sessionSetKeyboardMode( modeOnly = kKeyMapMode;
sessionId: ffi.sessionId, value: _kKeyMapMode);
modeOnly = _kKeyMapMode;
} else if (bind.sessionIsKeyboardModeSupported( } else if (bind.sessionIsKeyboardModeSupported(
sessionId: ffi.sessionId, mode: _kKeyLegacyMode)) { sessionId: ffi.sessionId, mode: kKeyLegacyMode)) {
bind.sessionSetKeyboardMode( modeOnly = kKeyLegacyMode;
sessionId: ffi.sessionId, value: _kKeyLegacyMode);
modeOnly = _kKeyLegacyMode;
} }
} }
return _IconSubmenuButton( return _IconSubmenuButton(
@ -1439,13 +1433,13 @@ class _KeyboardMenu extends StatelessWidget {
keyboardMode(String? modeOnly) { keyboardMode(String? modeOnly) {
return futureBuilder(future: () async { return futureBuilder(future: () async {
return await bind.sessionGetKeyboardMode(sessionId: ffi.sessionId) ?? return await bind.sessionGetKeyboardMode(sessionId: ffi.sessionId) ??
_kKeyLegacyMode; kKeyLegacyMode;
}(), hasData: (data) { }(), hasData: (data) {
final groupValue = data as String; final groupValue = data as String;
List<InputModeMenu> modes = [ List<InputModeMenu> modes = [
InputModeMenu(key: _kKeyLegacyMode, menu: 'Legacy mode'), InputModeMenu(key: kKeyLegacyMode, menu: 'Legacy mode'),
InputModeMenu(key: _kKeyMapMode, menu: 'Map mode'), InputModeMenu(key: kKeyMapMode, menu: 'Map mode'),
InputModeMenu(key: _kKeyTranslateMode, menu: 'Translate mode'), InputModeMenu(key: kKeyTranslateMode, menu: 'Translate mode'),
]; ];
List<RdoMenuButton> list = []; List<RdoMenuButton> list = [];
final enabled = !ffi.ffiModel.viewOnly; final enabled = !ffi.ffiModel.viewOnly;
@ -1463,12 +1457,12 @@ class _KeyboardMenu extends StatelessWidget {
continue; continue;
} }
if (pi.isWayland && mode.key != _kKeyMapMode) { if (pi.isWayland && mode.key != kKeyMapMode) {
continue; continue;
} }
var text = translate(mode.menu); var text = translate(mode.menu);
if (mode.key == _kKeyTranslateMode) { if (mode.key == kKeyTranslateMode) {
text = '$text beta'; text = '$text beta';
} }
list.add(RdoMenuButton<String>( list.add(RdoMenuButton<String>(

View File

@ -703,6 +703,10 @@ class FfiModel with ChangeNotifier {
_pi.isSet.value = true; _pi.isSet.value = true;
stateGlobal.resetLastResolutionGroupValues(peerId); stateGlobal.resetLastResolutionGroupValues(peerId);
if (isDesktop) {
checkDesktopKeyboardMode();
}
notifyListeners(); notifyListeners();
if (!isCache) { if (!isCache) {
@ -710,6 +714,36 @@ 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 (stateGlobal.grabKeyboard) {
for (final mode in [kKeyMapMode, kKeyLegacyMode]) {
if (bind.sessionIsKeyboardModeSupported(
sessionId: sessionId, mode: mode)) {
bind.sessionSetKeyboardMode(sessionId: sessionId, value: mode);
break;
}
}
} else {
for (final mode in [kKeyMapMode, kKeyTranslateMode, kKeyLegacyMode]) {
if (bind.sessionIsKeyboardModeSupported(
sessionId: sessionId, mode: mode)) {
bind.sessionSetKeyboardMode(sessionId: sessionId, value: mode);
break;
}
}
}
}
tryUseAllMyDisplaysForTheRemoteSession(String peerId) async { tryUseAllMyDisplaysForTheRemoteSession(String peerId) async {
if (bind.sessionGetUseAllMyDisplaysForTheRemoteSession( if (bind.sessionGetUseAllMyDisplaysForTheRemoteSession(
sessionId: sessionId) != sessionId: sessionId) !=

View File

@ -565,6 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Open in new window", "Abrir en una nueva ventana"), ("Open in new window", "Abrir en una nueva ventana"),
("Show displays as individual windows", "Mostrar pantallas como ventanas individuales"), ("Show displays as individual windows", "Mostrar pantallas como ventanas individuales"),
("Use all my displays for the remote session", "Usar todas mis pantallas para la sesión remota"), ("Use all my displays for the remote session", "Usar todas mis pantallas para la sesión remota"),
("selinux_tip", ""), ("selinux_tip", "SELinux está activado en tu dispositivo, lo que puede hacer que RustDesk no se ejecute correctamente como lado controlado."),
].iter().cloned().collect(); ].iter().cloned().collect();
} }