client side view mode

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-03-16 09:37:35 +08:00
parent 51bb83cd8c
commit 0e05df12fc
43 changed files with 203 additions and 46 deletions

View File

@@ -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 {