mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 19:17:58 +00:00
add MOUSE_MOVE_TIME to key event, may work for
https://github.com/rustdesk/rustdesk/issues/8633 when window resume via keyboard rather than mouse
This commit is contained in:
@@ -8,6 +8,7 @@ import 'package:flutter_hbb/models/platform_model.dart';
|
||||
import 'package:flutter_hbb/models/state_model.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
// import 'package:flutter/services.dart';
|
||||
|
||||
import '../../common/shared_state.dart';
|
||||
|
||||
@@ -41,6 +42,7 @@ class _DesktopTabPageState extends State<DesktopTabPage>
|
||||
final tabController = DesktopTabController(tabType: DesktopTabType.main);
|
||||
|
||||
final RxBool _block = false.obs;
|
||||
// bool mouseIn = false;
|
||||
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
@@ -53,6 +55,7 @@ class _DesktopTabPageState extends State<DesktopTabPage>
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// HardwareKeyboard.instance.addHandler(_handleKeyEvent);
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
Get.put<DesktopTabController>(tabController);
|
||||
RemoteCountState.init();
|
||||
@@ -78,8 +81,19 @@ class _DesktopTabPageState extends State<DesktopTabPage>
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
bool _handleKeyEvent(KeyEvent event) {
|
||||
if (!mouseIn && event is KeyDownEvent) {
|
||||
print('key down: ${event.logicalKey}');
|
||||
shouldBeBlocked(_block, canBeBlocked);
|
||||
}
|
||||
return false; // allow it to propagate
|
||||
}
|
||||
*/
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// HardwareKeyboard.instance.removeHandler(_handleKeyEvent);
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
Get.delete<DesktopTabController>();
|
||||
|
||||
@@ -105,8 +119,12 @@ class _DesktopTabPageState extends State<DesktopTabPage>
|
||||
)));
|
||||
widget() => MouseRegion(
|
||||
onEnter: (_) async {
|
||||
// mouseIn = true;
|
||||
await shouldBeBlocked(_block, canBeBlocked);
|
||||
},
|
||||
onExit: (_) {
|
||||
// mouseIn = false;
|
||||
},
|
||||
child: FocusScope(child: tabWidget, canRequestFocus: !_block.value));
|
||||
return isMacOS || kUseCompatibleUiMode
|
||||
? Obx(() => widget())
|
||||
|
||||
Reference in New Issue
Block a user