Merge pull request #2630 from Kingtous/master
fix: keeps mouse region grab key on linux
This commit is contained in:
commit
38e11ea60a
@ -128,21 +128,31 @@ class _RemotePageState extends State<RemotePage>
|
|||||||
@override
|
@override
|
||||||
void onWindowBlur() {
|
void onWindowBlur() {
|
||||||
super.onWindowBlur();
|
super.onWindowBlur();
|
||||||
_isWindowBlur = true;
|
// On windows, we use `focus` way to handle keyboard better.
|
||||||
// unfocus the key focus when the whole window is lost focus,
|
// Now on Linux, there's some rdev issues which will break the input.
|
||||||
// and let OS to handle events instead.
|
// We disable the `focus` way for non-Windows temporarily.
|
||||||
_rawKeyFocusNode.unfocus();
|
if (Platform.isWindows) {
|
||||||
|
_isWindowBlur = true;
|
||||||
|
// unfocus the primary-focus when the whole window is lost focus,
|
||||||
|
// and let OS to handle events instead.
|
||||||
|
_rawKeyFocusNode.unfocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onWindowFocus() {
|
void onWindowFocus() {
|
||||||
super.onWindowFocus();
|
super.onWindowFocus();
|
||||||
_isWindowBlur = false;
|
// See [onWindowBlur].
|
||||||
|
if (Platform.isWindows) {
|
||||||
|
_isWindowBlur = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
debugPrint("REMOTE PAGE dispose ${widget.id}");
|
debugPrint("REMOTE PAGE dispose ${widget.id}");
|
||||||
|
// ensure we leave this session, this is a double check
|
||||||
|
bind.sessionEnterOrLeave(id: widget.id, enter: false);
|
||||||
DesktopMultiWindow.removeListener(this);
|
DesktopMultiWindow.removeListener(this);
|
||||||
_ffi.dialogManager.hideMobileActionsOverlay();
|
_ffi.dialogManager.hideMobileActionsOverlay();
|
||||||
_ffi.recordingModel.onClose();
|
_ffi.recordingModel.onClose();
|
||||||
@ -175,16 +185,19 @@ class _RemotePageState extends State<RemotePage>
|
|||||||
onFocusChange: (bool imageFocused) {
|
onFocusChange: (bool imageFocused) {
|
||||||
debugPrint(
|
debugPrint(
|
||||||
"onFocusChange(window active:${!_isWindowBlur}) $imageFocused");
|
"onFocusChange(window active:${!_isWindowBlur}) $imageFocused");
|
||||||
if (_isWindowBlur) {
|
// See [onWindowBlur].
|
||||||
imageFocused = false;
|
if (Platform.isWindows) {
|
||||||
Future.delayed(Duration.zero, () {
|
if (_isWindowBlur) {
|
||||||
_rawKeyFocusNode.unfocus();
|
imageFocused = false;
|
||||||
});
|
Future.delayed(Duration.zero, () {
|
||||||
}
|
_rawKeyFocusNode.unfocus();
|
||||||
if (imageFocused) {
|
});
|
||||||
_ffi.inputModel.enterOrLeave(true);
|
}
|
||||||
} else {
|
if (imageFocused) {
|
||||||
_ffi.inputModel.enterOrLeave(false);
|
_ffi.inputModel.enterOrLeave(true);
|
||||||
|
} else {
|
||||||
|
_ffi.inputModel.enterOrLeave(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
inputModel: _ffi.inputModel,
|
inputModel: _ffi.inputModel,
|
||||||
@ -221,6 +234,13 @@ class _RemotePageState extends State<RemotePage>
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// See [onWindowBlur].
|
||||||
|
if (!Platform.isWindows) {
|
||||||
|
if (!_rawKeyFocusNode.hasFocus) {
|
||||||
|
_rawKeyFocusNode.requestFocus();
|
||||||
|
}
|
||||||
|
bind.sessionEnterOrLeave(id: widget.id, enter: true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void leaveView(PointerExitEvent evt) {
|
void leaveView(PointerExitEvent evt) {
|
||||||
@ -233,6 +253,10 @@ class _RemotePageState extends State<RemotePage>
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// See [onWindowBlur].
|
||||||
|
if (!Platform.isWindows) {
|
||||||
|
bind.sessionEnterOrLeave(id: widget.id, enter: false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget getBodyForDesktop(BuildContext context) {
|
Widget getBodyForDesktop(BuildContext context) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user