mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
@@ -1318,6 +1318,7 @@ class _DisplayState extends State<_Display> {
|
||||
|
||||
Widget other(BuildContext context) {
|
||||
return _Card(title: 'Other Default Options', children: [
|
||||
otherRow('View Mode', 'view-only'),
|
||||
otherRow('show_monitors_tip', 'show_monitors_toolbar'),
|
||||
otherRow('Show remote cursor', 'show_remote_cursor'),
|
||||
otherRow('Zoom cursor', 'zoom-cursor'),
|
||||
|
||||
@@ -139,8 +139,9 @@ class _RemotePageState extends State<RemotePage>
|
||||
_ffi.ffiModel.updateEventListener(widget.id);
|
||||
_ffi.qualityMonitorModel.checkShowQualityMonitor(widget.id);
|
||||
// Session option should be set after models.dart/FFI.start
|
||||
_showRemoteCursor.value = bind.sessionGetToggleOptionSync(
|
||||
id: widget.id, arg: 'show-remote-cursor');
|
||||
// _showRemoteCursor has been set by setViewOnly
|
||||
_ffi.ffiModel.setViewOnly(widget.id,
|
||||
bind.sessionGetToggleOptionSync(id: widget.id, arg: 'view-only'));
|
||||
_zoomCursor.value =
|
||||
bind.sessionGetToggleOptionSync(id: widget.id, arg: 'zoom-cursor');
|
||||
DesktopMultiWindow.addListener(this);
|
||||
|
||||
@@ -385,6 +385,7 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
|
||||
}
|
||||
|
||||
Widget _buildToolbar(BuildContext context) {
|
||||
final ffiModel = Provider.of<FfiModel>(context);
|
||||
final List<Widget> toolbarItems = [];
|
||||
if (!isWebDesktop) {
|
||||
toolbarItems.add(_PinMenu(state: widget.state));
|
||||
@@ -410,7 +411,9 @@ class _RemoteMenubarState extends State<RemoteMenubar> {
|
||||
state: widget.state,
|
||||
setFullscreen: _setFullscreen,
|
||||
));
|
||||
toolbarItems.add(_KeyboardMenu(id: widget.id, ffi: widget.ffi));
|
||||
if (!ffiModel.viewOnly) {
|
||||
toolbarItems.add(_KeyboardMenu(id: widget.id, ffi: widget.ffi));
|
||||
}
|
||||
if (!isWeb) {
|
||||
toolbarItems.add(_ChatMenu(id: widget.id, ffi: widget.ffi));
|
||||
toolbarItems.add(_VoiceCallMenu(id: widget.id, ffi: widget.ffi));
|
||||
@@ -820,8 +823,10 @@ class _ControlMenu extends StatelessWidget {
|
||||
|
||||
ctrlAltDel() {
|
||||
final perms = ffi.ffiModel.permissions;
|
||||
final viewOnly = ffi.ffiModel.viewOnly;
|
||||
final pi = ffi.ffiModel.pi;
|
||||
final visible = perms['keyboard'] != false &&
|
||||
final visible = !viewOnly &&
|
||||
perms['keyboard'] != false &&
|
||||
(pi.platform == kPeerPlatformLinux || pi.sasEnabled);
|
||||
if (!visible) return Offstage();
|
||||
return _MenuItemButton(
|
||||
@@ -846,7 +851,8 @@ class _ControlMenu extends StatelessWidget {
|
||||
|
||||
insertLock() {
|
||||
final perms = ffi.ffiModel.permissions;
|
||||
final visible = perms['keyboard'] != false;
|
||||
final viewOnly = ffi.ffiModel.viewOnly;
|
||||
final visible = !viewOnly && perms['keyboard'] != false;
|
||||
if (!visible) return Offstage();
|
||||
return _MenuItemButton(
|
||||
child: Text(translate('Insert Lock')),
|
||||
@@ -963,6 +969,7 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
codec(),
|
||||
resolutions(),
|
||||
Divider(),
|
||||
view_only(),
|
||||
showRemoteCursor(),
|
||||
zoomCursor(),
|
||||
showQualityMonitor(),
|
||||
@@ -1456,11 +1463,28 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
child: Text(translate("Resolution")));
|
||||
}
|
||||
|
||||
view_only() {
|
||||
final visible = version_cmp(pi.version, '1.2.0') >= 0;
|
||||
if (!visible) return Offstage();
|
||||
final ffiModel = widget.ffi.ffiModel;
|
||||
return _CheckboxMenuButton(
|
||||
value: ffiModel.viewOnly,
|
||||
onChanged: (value) async {
|
||||
if (value == null) return;
|
||||
bind.sessionSetViewOnly(id: widget.id, viewOnly: value);
|
||||
ffiModel.setViewOnly(widget.id, value);
|
||||
},
|
||||
ffi: widget.ffi,
|
||||
child: Text(translate('View Mode')));
|
||||
}
|
||||
|
||||
showRemoteCursor() {
|
||||
if (widget.ffi.ffiModel.pi.platform == kPeerPlatformAndroid) {
|
||||
return Offstage();
|
||||
}
|
||||
final visible = !widget.ffi.canvasModel.cursorEmbedded;
|
||||
final ffiModel = widget.ffi.ffiModel;
|
||||
final visible =
|
||||
!ffiModel.viewOnly && !widget.ffi.canvasModel.cursorEmbedded;
|
||||
if (!visible) return Offstage();
|
||||
final state = ShowRemoteCursorState.find(widget.id);
|
||||
final option = 'show-remote-cursor';
|
||||
@@ -1543,7 +1567,10 @@ class _DisplayMenuState extends State<_DisplayMenu> {
|
||||
}
|
||||
|
||||
disableClipboard() {
|
||||
final visible = perms['keyboard'] != false && perms['clipboard'] != false;
|
||||
final ffiModel = widget.ffi.ffiModel;
|
||||
final visible = perms['keyboard'] != false &&
|
||||
perms['clipboard'] != false &&
|
||||
!ffiModel.viewOnly;
|
||||
if (!visible) return Offstage();
|
||||
final option = 'disable-clipboard';
|
||||
final value = bind.sessionGetToggleOptionSync(id: widget.id, arg: option);
|
||||
|
||||
@@ -47,6 +47,7 @@ class FfiModel with ChangeNotifier {
|
||||
bool _touchMode = false;
|
||||
Timer? _timer;
|
||||
var _reconnects = 1;
|
||||
bool _viewOnly = false;
|
||||
WeakReference<FFI> parent;
|
||||
|
||||
Map<String, bool> get permissions => _permissions;
|
||||
@@ -65,6 +66,8 @@ class FfiModel with ChangeNotifier {
|
||||
|
||||
bool get isPeerAndroid => _pi.platform == kPeerPlatformAndroid;
|
||||
|
||||
bool get viewOnly => _viewOnly;
|
||||
|
||||
set inputBlocked(v) {
|
||||
_inputBlocked = v;
|
||||
}
|
||||
@@ -373,7 +376,8 @@ class FfiModel with ChangeNotifier {
|
||||
_updateSessionWidthHeight(String id) {
|
||||
parent.target?.canvasModel.updateViewStyle();
|
||||
if (display.width <= 0 || display.height <= 0) {
|
||||
debugPrintStack(label: 'invalid display size (${display.width},${display.height})');
|
||||
debugPrintStack(
|
||||
label: 'invalid display size (${display.width},${display.height})');
|
||||
} else {
|
||||
bind.sessionSetSize(id: id, width: display.width, height: display.height);
|
||||
}
|
||||
@@ -516,6 +520,19 @@ class FfiModel with ChangeNotifier {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
void setViewOnly(String id, bool value) {
|
||||
if (value) {
|
||||
ShowRemoteCursorState.find(id).value = value;
|
||||
} else {
|
||||
ShowRemoteCursorState.find(id).value =
|
||||
bind.sessionGetToggleOptionSync(id: id, arg: 'show-remote-cursor');
|
||||
}
|
||||
if (_viewOnly != value) {
|
||||
_viewOnly = value;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ImageModel with ChangeNotifier {
|
||||
|
||||
Reference in New Issue
Block a user