diff --git a/flutter/lib/desktop/pages/remote_page.dart b/flutter/lib/desktop/pages/remote_page.dart index 1bc09f137..3bc450345 100644 --- a/flutter/lib/desktop/pages/remote_page.dart +++ b/flutter/lib/desktop/pages/remote_page.dart @@ -310,7 +310,7 @@ class _RemotePageState extends State } void leaveView(PointerExitEvent evt) { - if (_ffi.ffiModel.keyboard()) { + if (_ffi.ffiModel.keyboard) { _ffi.inputModel.tryMoveEdgeOnExit(evt.position); } diff --git a/flutter/lib/models/input_model.dart b/flutter/lib/models/input_model.dart index 310a3cadb..95f0f2634 100644 --- a/flutter/lib/models/input_model.dart +++ b/flutter/lib/models/input_model.dart @@ -59,6 +59,8 @@ class InputModel { get id => parent.target?.id ?? ""; + bool get keyboardPerm => parent.target!.ffiModel.keyboard; + InputModel(this.parent); KeyEventResult handleRawKeyEvent(FocusNode data, RawKeyEvent e) { @@ -203,7 +205,7 @@ class InputModel { /// [down] indicates the key's state(down or up). /// [press] indicates a click event(down and up). void inputKey(String name, {bool? down, bool? press}) { - if (!parent.target!.ffiModel.keyboard()) return; + if (!keyboardPerm) return; bind.sessionInputKey( id: id, name: name, @@ -286,7 +288,7 @@ class InputModel { /// Send mouse press event. void sendMouse(String type, MouseButtons button) { - if (!parent.target!.ffiModel.keyboard()) return; + if (!keyboardPerm) return; bind.sessionSendMouse( id: id, msg: json.encode(modify({'type': type, 'buttons': button.value}))); @@ -303,7 +305,7 @@ class InputModel { /// Send mouse movement event with distance in [x] and [y]. void moveMouse(double x, double y) { - if (!parent.target!.ffiModel.keyboard()) return; + if (!keyboardPerm) return; var x2 = x.toInt(); var y2 = y.toInt(); bind.sessionSendMouse( @@ -379,7 +381,7 @@ class InputModel { } void _scheduleFling2(double x, double y, int delay) { - if ((x ==0 && y == 0) || _stopFling) { + if ((x == 0 && y == 0) || _stopFling) { return; } @@ -394,7 +396,7 @@ class InputModel { final dx0 = x * _trackpadSpeed * 2; final dy0 = y * _trackpadSpeed * 2; - // Try set delta (x,y) and delay. + // Try set delta (x,y) and delay. var dx = dx0.toInt(); var dy = dy0.toInt(); var delay = _flingBaseDelay; @@ -432,7 +434,8 @@ class InputModel { void onPointerPanZoomEnd(PointerPanZoomEndEvent e) { _stopFling = false; _trackpadScrollUnsent = Offset.zero; - _scheduleFling2(_trackpadLastDelta.dx, _trackpadLastDelta.dy, _flingBaseDelay); + _scheduleFling2( + _trackpadLastDelta.dx, _trackpadLastDelta.dy, _flingBaseDelay); _trackpadLastDelta = Offset.zero; } diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index 82c8efbca..06bfeec45 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -906,7 +906,7 @@ class CanvasModel with ChangeNotifier { } // If keyboard is not permitted, do not move cursor when mouse is moving. - if (parent.target != null && parent.target!.ffiModel.keyboard()) { + if (parent.target != null && parent.target!.ffiModel.keyboard) { // Draw cursor if is not desktop. if (!isDesktop) { parent.target!.cursorModel.moveLocal(x, y); diff --git a/libs/scrap/src/common/hwcodec.rs b/libs/scrap/src/common/hwcodec.rs index 42bf76cb5..e5ede45b1 100644 --- a/libs/scrap/src/common/hwcodec.rs +++ b/libs/scrap/src/common/hwcodec.rs @@ -7,7 +7,7 @@ use hbb_common::{ anyhow::{anyhow, Context}, bytes::Bytes, config::HwCodecConfig, - get_time, lazy_static, log, + lazy_static, log, message_proto::{EncodedVideoFrame, EncodedVideoFrames, Message, VideoFrame}, ResultType, };