diff --git a/flutter/lib/models/input_model.dart b/flutter/lib/models/input_model.dart index 90589ed33..52675de41 100644 --- a/flutter/lib/models/input_model.dart +++ b/flutter/lib/models/input_model.dart @@ -50,7 +50,7 @@ class InputModel { // mouse final isPhysicalMouse = false.obs; - int _lastMouseDownButtons = 0; + int _lastButtons = 0; Offset lastMousePos = Offset.zero; get id => parent.target?.id ?? ""; @@ -195,17 +195,17 @@ class InputModel { if (command) out['command'] = 'true'; // Check update event type and set buttons to be sent. - int buttons = _lastMouseDownButtons; + int buttons = _lastButtons; if (type == _kMouseEventMove) { // flutter may emit move event if one button is pressed and anoter button // is pressing or releasing. - if (evt.buttons != _lastMouseDownButtons) { + if (evt.buttons != _lastButtons) { // For simplicity // Just consider 3 - 1 ((Left + Right buttons) - Left button) // Do not consider 2 - 1 (Right button - Left button) // or 6 - 5 ((Right + Mid buttons) - (Left + Mid buttons)) // and so on - buttons = evt.buttons - _lastMouseDownButtons; + buttons = evt.buttons - _lastButtons; if (buttons > 0) { type = _kMouseEventDown; } else { @@ -218,7 +218,7 @@ class InputModel { buttons = evt.buttons; } } - _lastMouseDownButtons = evt.buttons; + _lastButtons = evt.buttons; out['buttons'] = buttons; out['type'] = type; diff --git a/libs/scrap/src/common/mod.rs b/libs/scrap/src/common/mod.rs index 1e78656cf..1de2f89d6 100644 --- a/libs/scrap/src/common/mod.rs +++ b/libs/scrap/src/common/mod.rs @@ -74,9 +74,9 @@ pub fn is_x11() -> bool { #[inline] pub fn is_cursor_embedded() -> bool { if is_x11() { - x11::is_cursor_embedded + x11::IS_CURSOR_EMBEDDED } else { - wayland::is_cursor_embedded + wayland::IS_CURSOR_EMBEDDED } } diff --git a/libs/scrap/src/common/wayland.rs b/libs/scrap/src/common/wayland.rs index e9a846602..3efaed36e 100644 --- a/libs/scrap/src/common/wayland.rs +++ b/libs/scrap/src/common/wayland.rs @@ -5,7 +5,7 @@ use std::{io, sync::RwLock, time::Duration}; pub struct Capturer(Display, Box, bool, Vec); #[allow(non_upper_case_globals)] -pub const is_cursor_embedded: bool = true; +pub const IS_CURSOR_EMBEDDED: bool = true; lazy_static::lazy_static! { static ref MAP_ERR: RwLock io::Error>> = Default::default(); diff --git a/libs/scrap/src/common/x11.rs b/libs/scrap/src/common/x11.rs index a8359498b..ffeb1b55f 100644 --- a/libs/scrap/src/common/x11.rs +++ b/libs/scrap/src/common/x11.rs @@ -4,7 +4,7 @@ use std::{io, ops, time::Duration}; pub struct Capturer(x11::Capturer); #[allow(non_upper_case_globals)] -pub const is_cursor_embedded: bool = false; +pub const IS_CURSOR_EMBEDDED: bool = false; impl Capturer { pub fn new(display: Display, yuv: bool) -> io::Result { diff --git a/src/keyboard.rs b/src/keyboard.rs index a3088c63f..9fa53757f 100644 --- a/src/keyboard.rs +++ b/src/keyboard.rs @@ -636,7 +636,7 @@ pub fn map_keyboard_mode(event: &Event, mut key_event: KeyEvent) -> Option rdev::linux_code_to_win_scancode(event.code as _)?, "macos" => { if hbb_common::config::LocalConfig::get_kb_layout_type() == "ISO" { - rdev::linux_code_to_macos_iso_code(event.scan_code)? + rdev::linux_code_to_macos_iso_code(event.code as _)? } else { rdev::linux_code_to_macos_code(event.code as _)? }