mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-13 03:28:03 +00:00
@@ -141,14 +141,16 @@ class RemoteMenuEntry {
|
||||
],
|
||||
curOptionGetter: () async {
|
||||
// null means peer id is not found, which there's no need to care about
|
||||
final viewStyle = await bind.sessionGetViewStyle(id: remoteId) ?? '';
|
||||
final viewStyle =
|
||||
await bind.sessionGetViewStyle(sessionId: ffi.sessionId) ?? '';
|
||||
if (rxViewStyle != null) {
|
||||
rxViewStyle.value = viewStyle;
|
||||
}
|
||||
return viewStyle;
|
||||
},
|
||||
optionSetter: (String oldValue, String newValue) async {
|
||||
await bind.sessionSetViewStyle(id: remoteId, value: newValue);
|
||||
await bind.sessionSetViewStyle(
|
||||
sessionId: ffi.sessionId, value: newValue);
|
||||
if (rxViewStyle != null) {
|
||||
rxViewStyle.value = newValue;
|
||||
}
|
||||
@@ -165,6 +167,7 @@ class RemoteMenuEntry {
|
||||
|
||||
static MenuEntrySwitch2<String> showRemoteCursor(
|
||||
String remoteId,
|
||||
SessionID sessionId,
|
||||
EdgeInsets padding, {
|
||||
DismissFunc? dismissFunc,
|
||||
DismissCallback? dismissCallback,
|
||||
@@ -178,9 +181,9 @@ class RemoteMenuEntry {
|
||||
return state;
|
||||
},
|
||||
setter: (bool v) async {
|
||||
await bind.sessionToggleOption(id: remoteId, value: optKey);
|
||||
await bind.sessionToggleOption(sessionId: sessionId, value: optKey);
|
||||
state.value =
|
||||
bind.sessionGetToggleOptionSync(id: remoteId, arg: optKey);
|
||||
bind.sessionGetToggleOptionSync(sessionId: sessionId, arg: optKey);
|
||||
if (dismissFunc != null) {
|
||||
dismissFunc();
|
||||
}
|
||||
@@ -192,13 +195,13 @@ class RemoteMenuEntry {
|
||||
}
|
||||
|
||||
static MenuEntrySwitch<String> disableClipboard(
|
||||
String remoteId,
|
||||
SessionID sessionId,
|
||||
EdgeInsets? padding, {
|
||||
DismissFunc? dismissFunc,
|
||||
DismissCallback? dismissCallback,
|
||||
}) {
|
||||
return createSwitchMenuEntry(
|
||||
remoteId,
|
||||
sessionId,
|
||||
'Disable clipboard',
|
||||
'disable-clipboard',
|
||||
padding,
|
||||
@@ -208,7 +211,7 @@ class RemoteMenuEntry {
|
||||
}
|
||||
|
||||
static MenuEntrySwitch<String> createSwitchMenuEntry(
|
||||
String remoteId,
|
||||
SessionID sessionId,
|
||||
String text,
|
||||
String option,
|
||||
EdgeInsets? padding,
|
||||
@@ -220,10 +223,11 @@ class RemoteMenuEntry {
|
||||
switchType: SwitchType.scheckbox,
|
||||
text: translate(text),
|
||||
getter: () async {
|
||||
return bind.sessionGetToggleOptionSync(id: remoteId, arg: option);
|
||||
return bind.sessionGetToggleOptionSync(
|
||||
sessionId: sessionId, arg: option);
|
||||
},
|
||||
setter: (bool v) async {
|
||||
await bind.sessionToggleOption(id: remoteId, value: option);
|
||||
await bind.sessionToggleOption(sessionId: sessionId, value: option);
|
||||
if (dismissFunc != null) {
|
||||
dismissFunc();
|
||||
}
|
||||
@@ -235,7 +239,7 @@ class RemoteMenuEntry {
|
||||
}
|
||||
|
||||
static MenuEntryButton<String> insertLock(
|
||||
String remoteId,
|
||||
SessionID sessionId,
|
||||
EdgeInsets? padding, {
|
||||
DismissFunc? dismissFunc,
|
||||
DismissCallback? dismissCallback,
|
||||
@@ -246,7 +250,7 @@ class RemoteMenuEntry {
|
||||
style: style,
|
||||
),
|
||||
proc: () {
|
||||
bind.sessionLockScreen(id: remoteId);
|
||||
bind.sessionLockScreen(sessionId: sessionId);
|
||||
if (dismissFunc != null) {
|
||||
dismissFunc();
|
||||
}
|
||||
@@ -258,7 +262,7 @@ class RemoteMenuEntry {
|
||||
}
|
||||
|
||||
static insertCtrlAltDel(
|
||||
String remoteId,
|
||||
SessionID sessionId,
|
||||
EdgeInsets? padding, {
|
||||
DismissFunc? dismissFunc,
|
||||
DismissCallback? dismissCallback,
|
||||
@@ -269,7 +273,7 @@ class RemoteMenuEntry {
|
||||
style: style,
|
||||
),
|
||||
proc: () {
|
||||
bind.sessionCtrlAltDel(id: remoteId);
|
||||
bind.sessionCtrlAltDel(sessionId: sessionId);
|
||||
if (dismissFunc != null) {
|
||||
dismissFunc();
|
||||
}
|
||||
@@ -329,7 +333,8 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
|
||||
|
||||
Future.delayed(Duration.zero, () async {
|
||||
_fractionX.value = double.tryParse(await bind.sessionGetOption(
|
||||
id: widget.id, arg: 'remote-menubar-drag-x') ??
|
||||
sessionId: widget.ffi.sessionId,
|
||||
arg: 'remote-menubar-drag-x') ??
|
||||
'0.5') ??
|
||||
0.5;
|
||||
});
|
||||
@@ -387,7 +392,7 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
|
||||
elevation: _MenubarTheme.elevation,
|
||||
shadowColor: MyTheme.color(context).shadow,
|
||||
child: _DraggableShowHide(
|
||||
id: widget.id,
|
||||
sessionId: widget.ffi.sessionId,
|
||||
dragging: _dragging,
|
||||
fractionX: _fractionX,
|
||||
show: show,
|
||||
@@ -621,7 +626,7 @@ class _MonitorMenu extends StatelessWidget {
|
||||
_menuDismissCallback(ffi);
|
||||
RxInt display = CurrentDisplayState.find(id);
|
||||
if (display.value != i) {
|
||||
bind.sessionSwitchDisplay(id: id, value: i);
|
||||
bind.sessionSwitchDisplay(sessionId: ffi.sessionId, value: i);
|
||||
}
|
||||
},
|
||||
));
|
||||
@@ -763,7 +768,8 @@ class ScreenAdjustor {
|
||||
}
|
||||
|
||||
Future<bool> isWindowCanBeAdjusted() async {
|
||||
final viewStyle = await bind.sessionGetViewStyle(id: id) ?? '';
|
||||
final viewStyle =
|
||||
await bind.sessionGetViewStyle(sessionId: ffi.sessionId) ?? '';
|
||||
if (viewStyle != kRemoteViewStyleOriginal) {
|
||||
return false;
|
||||
}
|
||||
@@ -885,9 +891,11 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
|
||||
scrollStyle() {
|
||||
return futureBuilder(future: () async {
|
||||
final viewStyle = await bind.sessionGetViewStyle(id: id) ?? '';
|
||||
final viewStyle =
|
||||
await bind.sessionGetViewStyle(sessionId: ffi.sessionId) ?? '';
|
||||
final visible = viewStyle == kRemoteViewStyleOriginal;
|
||||
final scrollStyle = await bind.sessionGetScrollStyle(id: widget.id) ?? '';
|
||||
final scrollStyle =
|
||||
await bind.sessionGetScrollStyle(sessionId: ffi.sessionId) ?? '';
|
||||
return {'visible': visible, 'scrollStyle': scrollStyle};
|
||||
}(), hasData: (data) {
|
||||
final visible = data['visible'] as bool;
|
||||
@@ -895,7 +903,8 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
final groupValue = data['scrollStyle'] as String;
|
||||
onChange(String? value) async {
|
||||
if (value == null) return;
|
||||
await bind.sessionSetScrollStyle(id: widget.id, value: value);
|
||||
await bind.sessionSetScrollStyle(
|
||||
sessionId: ffi.sessionId, value: value);
|
||||
widget.ffi.canvasModel.updateScrollStyle();
|
||||
}
|
||||
|
||||
@@ -1007,6 +1016,7 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> {
|
||||
late final TextEditingController _customHeight =
|
||||
TextEditingController(text: display.height.toString());
|
||||
|
||||
FFI get ffi => widget.ffi;
|
||||
PeerInfo get pi => widget.ffi.ffiModel.pi;
|
||||
FfiModel get ffiModel => widget.ffi.ffiModel;
|
||||
Display get display => ffiModel.display;
|
||||
@@ -1101,7 +1111,7 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> {
|
||||
|
||||
_changeResolution(int w, int h) async {
|
||||
await bind.sessionChangeResolution(
|
||||
id: widget.id,
|
||||
sessionId: ffi.sessionId,
|
||||
display: pi.currentDisplay,
|
||||
width: w,
|
||||
height: h,
|
||||
@@ -1254,12 +1264,15 @@ class _KeyboardMenu extends StatelessWidget {
|
||||
if (!ffiModel.keyboard) return Offstage();
|
||||
String? modeOnly;
|
||||
if (stateGlobal.grabKeyboard) {
|
||||
if (bind.sessionIsKeyboardModeSupported(id: id, mode: _kKeyMapMode)) {
|
||||
bind.sessionSetKeyboardMode(id: id, value: _kKeyMapMode);
|
||||
if (bind.sessionIsKeyboardModeSupported(
|
||||
sessionId: ffi.sessionId, mode: _kKeyMapMode)) {
|
||||
bind.sessionSetKeyboardMode(
|
||||
sessionId: ffi.sessionId, value: _kKeyMapMode);
|
||||
modeOnly = _kKeyMapMode;
|
||||
} else if (bind.sessionIsKeyboardModeSupported(
|
||||
id: id, mode: _kKeyLegacyMode)) {
|
||||
bind.sessionSetKeyboardMode(id: id, value: _kKeyLegacyMode);
|
||||
sessionId: ffi.sessionId, mode: _kKeyLegacyMode)) {
|
||||
bind.sessionSetKeyboardMode(
|
||||
sessionId: ffi.sessionId, value: _kKeyLegacyMode);
|
||||
modeOnly = _kKeyLegacyMode;
|
||||
}
|
||||
}
|
||||
@@ -1279,7 +1292,8 @@ class _KeyboardMenu extends StatelessWidget {
|
||||
|
||||
mode(String? modeOnly) {
|
||||
return futureBuilder(future: () async {
|
||||
return await bind.sessionGetKeyboardMode(id: id) ?? _kKeyLegacyMode;
|
||||
return await bind.sessionGetKeyboardMode(sessionId: ffi.sessionId) ??
|
||||
_kKeyLegacyMode;
|
||||
}(), hasData: (data) {
|
||||
final groupValue = data as String;
|
||||
List<KeyboardModeMenu> modes = [
|
||||
@@ -1291,14 +1305,15 @@ class _KeyboardMenu extends StatelessWidget {
|
||||
final enabled = !ffi.ffiModel.viewOnly;
|
||||
onChanged(String? value) async {
|
||||
if (value == null) return;
|
||||
await bind.sessionSetKeyboardMode(id: id, value: value);
|
||||
await bind.sessionSetKeyboardMode(
|
||||
sessionId: ffi.sessionId, value: value);
|
||||
}
|
||||
|
||||
for (KeyboardModeMenu mode in modes) {
|
||||
if (modeOnly != null && mode.key != modeOnly) {
|
||||
continue;
|
||||
} else if (!bind.sessionIsKeyboardModeSupported(
|
||||
id: id, mode: mode.key)) {
|
||||
sessionId: ffi.sessionId, mode: mode.key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1351,7 +1366,8 @@ class _KeyboardMenu extends StatelessWidget {
|
||||
onChanged: enabled
|
||||
? (value) async {
|
||||
if (value == null) return;
|
||||
await bind.sessionToggleOption(id: id, value: 'view-only');
|
||||
await bind.sessionToggleOption(
|
||||
sessionId: ffi.sessionId, value: 'view-only');
|
||||
ffiModel.setViewOnly(id, value);
|
||||
}
|
||||
: null,
|
||||
@@ -1412,7 +1428,8 @@ class _ChatMenuState extends State<_ChatMenu> {
|
||||
return MenuButton(
|
||||
child: Text(translate('Voice call')),
|
||||
ffi: widget.ffi,
|
||||
onPressed: () => bind.sessionRequestVoiceCall(id: widget.id),
|
||||
onPressed: () =>
|
||||
bind.sessionRequestVoiceCall(sessionId: widget.ffi.sessionId),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1447,7 +1464,8 @@ class _VoiceCallMenu extends StatelessWidget {
|
||||
return _IconMenuButton(
|
||||
assetName: icon,
|
||||
tooltip: tooltip,
|
||||
onPressed: () => bind.sessionCloseVoiceCall(id: id),
|
||||
onPressed: () =>
|
||||
bind.sessionCloseVoiceCall(sessionId: ffi.sessionId),
|
||||
color: _MenubarTheme.redColor,
|
||||
hoverColor: _MenubarTheme.hoverRedColor);
|
||||
},
|
||||
@@ -1492,7 +1510,7 @@ class _CloseMenu extends StatelessWidget {
|
||||
return _IconMenuButton(
|
||||
assetName: 'assets/close.svg',
|
||||
tooltip: 'Close',
|
||||
onPressed: () => clientClose(id, ffi.dialogManager),
|
||||
onPressed: () => clientClose(ffi.sessionId, ffi.dialogManager),
|
||||
color: _MenubarTheme.redColor,
|
||||
hoverColor: _MenubarTheme.hoverRedColor,
|
||||
);
|
||||
@@ -1753,13 +1771,13 @@ class RdoMenuButton<T> extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _DraggableShowHide extends StatefulWidget {
|
||||
final String id;
|
||||
final SessionID sessionId;
|
||||
final RxDouble fractionX;
|
||||
final RxBool dragging;
|
||||
final RxBool show;
|
||||
const _DraggableShowHide({
|
||||
Key? key,
|
||||
required this.id,
|
||||
required this.sessionId,
|
||||
required this.fractionX,
|
||||
required this.dragging,
|
||||
required this.show,
|
||||
@@ -1826,7 +1844,7 @@ class _DraggableShowHideState extends State<_DraggableShowHide> {
|
||||
widget.fractionX.value = right;
|
||||
}
|
||||
bind.sessionPeerOption(
|
||||
id: widget.id,
|
||||
sessionId: widget.sessionId,
|
||||
name: 'remote-menubar-drag-x',
|
||||
value: widget.fractionX.value.toString(),
|
||||
);
|
||||
@@ -1952,7 +1970,7 @@ class _MultiMonitorMenu extends StatelessWidget {
|
||||
),
|
||||
onPressed: () {
|
||||
if (display.value != i) {
|
||||
bind.sessionSwitchDisplay(id: id, value: i);
|
||||
bind.sessionSwitchDisplay(sessionId: ffi.sessionId, value: i);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user