fix build

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-03-28 10:52:43 +08:00
parent 77c4cce368
commit c845ddf510
4 changed files with 12 additions and 9 deletions

View File

@ -310,7 +310,7 @@ class _RemotePageState extends State<RemotePage>
} }
void leaveView(PointerExitEvent evt) { void leaveView(PointerExitEvent evt) {
if (_ffi.ffiModel.keyboard()) { if (_ffi.ffiModel.keyboard) {
_ffi.inputModel.tryMoveEdgeOnExit(evt.position); _ffi.inputModel.tryMoveEdgeOnExit(evt.position);
} }

View File

@ -59,6 +59,8 @@ class InputModel {
get id => parent.target?.id ?? ""; get id => parent.target?.id ?? "";
bool get keyboardPerm => parent.target!.ffiModel.keyboard;
InputModel(this.parent); InputModel(this.parent);
KeyEventResult handleRawKeyEvent(FocusNode data, RawKeyEvent e) { KeyEventResult handleRawKeyEvent(FocusNode data, RawKeyEvent e) {
@ -203,7 +205,7 @@ class InputModel {
/// [down] indicates the key's state(down or up). /// [down] indicates the key's state(down or up).
/// [press] indicates a click event(down and up). /// [press] indicates a click event(down and up).
void inputKey(String name, {bool? down, bool? press}) { void inputKey(String name, {bool? down, bool? press}) {
if (!parent.target!.ffiModel.keyboard()) return; if (!keyboardPerm) return;
bind.sessionInputKey( bind.sessionInputKey(
id: id, id: id,
name: name, name: name,
@ -286,7 +288,7 @@ class InputModel {
/// Send mouse press event. /// Send mouse press event.
void sendMouse(String type, MouseButtons button) { void sendMouse(String type, MouseButtons button) {
if (!parent.target!.ffiModel.keyboard()) return; if (!keyboardPerm) return;
bind.sessionSendMouse( bind.sessionSendMouse(
id: id, id: id,
msg: json.encode(modify({'type': type, 'buttons': button.value}))); 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]. /// Send mouse movement event with distance in [x] and [y].
void moveMouse(double x, double y) { void moveMouse(double x, double y) {
if (!parent.target!.ffiModel.keyboard()) return; if (!keyboardPerm) return;
var x2 = x.toInt(); var x2 = x.toInt();
var y2 = y.toInt(); var y2 = y.toInt();
bind.sessionSendMouse( bind.sessionSendMouse(
@ -379,7 +381,7 @@ class InputModel {
} }
void _scheduleFling2(double x, double y, int delay) { void _scheduleFling2(double x, double y, int delay) {
if ((x ==0 && y == 0) || _stopFling) { if ((x == 0 && y == 0) || _stopFling) {
return; return;
} }
@ -432,7 +434,8 @@ class InputModel {
void onPointerPanZoomEnd(PointerPanZoomEndEvent e) { void onPointerPanZoomEnd(PointerPanZoomEndEvent e) {
_stopFling = false; _stopFling = false;
_trackpadScrollUnsent = Offset.zero; _trackpadScrollUnsent = Offset.zero;
_scheduleFling2(_trackpadLastDelta.dx, _trackpadLastDelta.dy, _flingBaseDelay); _scheduleFling2(
_trackpadLastDelta.dx, _trackpadLastDelta.dy, _flingBaseDelay);
_trackpadLastDelta = Offset.zero; _trackpadLastDelta = Offset.zero;
} }

View File

@ -906,7 +906,7 @@ class CanvasModel with ChangeNotifier {
} }
// If keyboard is not permitted, do not move cursor when mouse is moving. // 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. // Draw cursor if is not desktop.
if (!isDesktop) { if (!isDesktop) {
parent.target!.cursorModel.moveLocal(x, y); parent.target!.cursorModel.moveLocal(x, y);

View File

@ -7,7 +7,7 @@ use hbb_common::{
anyhow::{anyhow, Context}, anyhow::{anyhow, Context},
bytes::Bytes, bytes::Bytes,
config::HwCodecConfig, config::HwCodecConfig,
get_time, lazy_static, log, lazy_static, log,
message_proto::{EncodedVideoFrame, EncodedVideoFrames, Message, VideoFrame}, message_proto::{EncodedVideoFrame, EncodedVideoFrames, Message, VideoFrame},
ResultType, ResultType,
}; };