mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-10 07:01:29 +03:00
fix(desktop): wakelock issue with multiple tabs in same window (#13956)
Each desktop isolate now independently tracks wakelock state. WakelockPlus.disable() is only called when all tabs within the same isolate are closed/minimized. WakelockPlus ensures screen stays awake as long as any isolate has wakelock enabled. Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -17,7 +17,6 @@ import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart';
|
||||
import 'package:flutter_hbb/models/file_model.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:wakelock_plus/wakelock_plus.dart';
|
||||
import 'package:flutter_hbb/web/dummy.dart'
|
||||
if (dart.library.html) 'package:flutter_hbb/web/web_unique.dart';
|
||||
|
||||
@@ -86,6 +85,7 @@ class _FileManagerPageState extends State<FileManagerPage>
|
||||
|
||||
final _dropMaskVisible = false.obs; // TODO impl drop mask
|
||||
final _overlayKeyState = OverlayKeyState();
|
||||
final _uniqueKey = UniqueKey();
|
||||
|
||||
late FFI _ffi;
|
||||
|
||||
@@ -107,9 +107,7 @@ class _FileManagerPageState extends State<FileManagerPage>
|
||||
.showLoading(translate('Connecting...'), onCancel: closeConnection);
|
||||
});
|
||||
Get.put<FFI>(_ffi, tag: 'ft_${widget.id}');
|
||||
if (!isLinux) {
|
||||
WakelockPlus.enable();
|
||||
}
|
||||
WakelockManager.enable(_uniqueKey);
|
||||
if (isWeb) {
|
||||
_ffi.ffiModel.updateEventListener(_ffi.sessionId, widget.id);
|
||||
}
|
||||
@@ -127,9 +125,7 @@ class _FileManagerPageState extends State<FileManagerPage>
|
||||
model.close().whenComplete(() {
|
||||
_ffi.close();
|
||||
_ffi.dialogManager.dismissAll();
|
||||
if (!isLinux) {
|
||||
WakelockPlus.disable();
|
||||
}
|
||||
WakelockManager.disable(_uniqueKey);
|
||||
Get.delete<FFI>(tag: 'ft_${widget.id}');
|
||||
});
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
|
||||
Reference in New Issue
Block a user