mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-13 11:35:56 +00:00
refact, separate remote window, tmp commit
Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
@@ -1579,6 +1579,7 @@ class FFI {
|
||||
/// dialogManager use late to ensure init after main page binding [globalKey]
|
||||
late final dialogManager = OverlayDialogManager();
|
||||
|
||||
late final bool isSessionAdded;
|
||||
late final SessionID sessionId;
|
||||
late final ImageModel imageModel; // session
|
||||
late final FfiModel ffiModel; // session
|
||||
@@ -1596,8 +1597,9 @@ class FFI {
|
||||
late final InputModel inputModel; // session
|
||||
late final ElevationModel elevationModel; // session
|
||||
|
||||
FFI() {
|
||||
sessionId = isDesktop ? Uuid().v4obj() : _constSessionId;
|
||||
FFI(SessionID? sId) {
|
||||
isSessionAdded = sId != null;
|
||||
sessionId = sId ?? (isDesktop ? Uuid().v4obj() : _constSessionId);
|
||||
imageModel = ImageModel(WeakReference(this));
|
||||
ffiModel = FfiModel(WeakReference(this));
|
||||
cursorModel = CursorModel(WeakReference(this));
|
||||
@@ -1637,17 +1639,19 @@ class FFI {
|
||||
imageModel.id = id;
|
||||
cursorModel.id = id;
|
||||
}
|
||||
// ignore: unused_local_variable
|
||||
final addRes = bind.sessionAddSync(
|
||||
sessionId: sessionId,
|
||||
id: id,
|
||||
isFileTransfer: isFileTransfer,
|
||||
isPortForward: isPortForward,
|
||||
isRdp: isRdp,
|
||||
switchUuid: switchUuid ?? "",
|
||||
forceRelay: forceRelay ?? false,
|
||||
password: password ?? "",
|
||||
);
|
||||
if (isSessionAdded) {
|
||||
// ignore: unused_local_variable
|
||||
final addRes = bind.sessionAddSync(
|
||||
sessionId: sessionId,
|
||||
id: id,
|
||||
isFileTransfer: isFileTransfer,
|
||||
isPortForward: isPortForward,
|
||||
isRdp: isRdp,
|
||||
switchUuid: switchUuid ?? "",
|
||||
forceRelay: forceRelay ?? false,
|
||||
password: password ?? "",
|
||||
);
|
||||
}
|
||||
final stream = bind.sessionStart(sessionId: sessionId, id: id);
|
||||
final cb = ffiModel.startEventListener(sessionId, id);
|
||||
final useTextureRender = bind.mainUseTextureRender();
|
||||
@@ -1712,7 +1716,7 @@ class FFI {
|
||||
}
|
||||
|
||||
/// Close the remote session.
|
||||
Future<void> close() async {
|
||||
Future<void> close({bool closeSession = true}) async {
|
||||
closed = true;
|
||||
chatModel.close();
|
||||
if (imageModel.image != null && !isWebDesktop) {
|
||||
@@ -1730,7 +1734,9 @@ class FFI {
|
||||
ffiModel.clear();
|
||||
canvasModel.clear();
|
||||
inputModel.resetModifiers();
|
||||
await bind.sessionClose(sessionId: sessionId);
|
||||
if (closeSession) {
|
||||
await bind.sessionClose(sessionId: sessionId);
|
||||
}
|
||||
debugPrint('model $id closed');
|
||||
id = '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user