From eb0a0662a32de3f10284de454e3fc3f7058276be Mon Sep 17 00:00:00 2001 From: fufesou Date: Sun, 10 Sep 2023 14:14:57 +0800 Subject: [PATCH 1/5] feat, mouse wheel and touchpad scroll mode, default or reverse Signed-off-by: fufesou --- flutter/lib/consts.dart | 5 + .../desktop/pages/desktop_setting_page.dart | 46 ++++++ .../lib/desktop/widgets/remote_toolbar.dart | 146 +++++++++++------- libs/hbb_common/src/config.rs | 15 ++ src/client.rs | 11 ++ src/flutter_ffi.rs | 16 +- src/ui_session_interface.rs | 36 ++++- 7 files changed, 217 insertions(+), 58 deletions(-) diff --git a/flutter/lib/consts.dart b/flutter/lib/consts.dart index 7fcc7b3a..24a9b3fa 100644 --- a/flutter/lib/consts.dart +++ b/flutter/lib/consts.dart @@ -138,6 +138,11 @@ const kRemoteScrollStyleAuto = 'scrollauto'; /// [kRemoteScrollStyleBar] Scroll image with scroll bar. const kRemoteScrollStyleBar = 'scrollbar'; +/// [kScrollModeDefault] Mouse or touchpad, the default scroll mode. +const kScrollModeDefault = 'default'; +/// [kScrollModeReverse] Mouse or touchpad, the reverse scroll mode. +const kScrollModeReverse = 'reverse'; + /// [kRemoteImageQualityBest] Best image quality. const kRemoteImageQualityBest = 'best'; diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dart index 3a33c7e5..38b2d3c5 100644 --- a/flutter/lib/desktop/pages/desktop_setting_page.dart +++ b/flutter/lib/desktop/pages/desktop_setting_page.dart @@ -105,6 +105,7 @@ class _DesktopSettingPageState extends State _TabInfo('Network', Icons.link_outlined, Icons.link), _TabInfo( 'Display', Icons.desktop_windows_outlined, Icons.desktop_windows), + _TabInfo('Input', Icons.keyboard_outlined, Icons.keyboard), _TabInfo('Account', Icons.person_outline, Icons.person), _TabInfo('About', Icons.info_outline, Icons.info) ]; @@ -121,6 +122,7 @@ class _DesktopSettingPageState extends State _Safety(), _Network(), _Display(), + _Input(), _Account(), _About(), ]; @@ -1220,6 +1222,50 @@ class _DisplayState extends State<_Display> { } } +class _Input extends StatefulWidget { + const _Input({Key? key}) : super(key: key); + + @override + State<_Input> createState() => _InputState(); +} + +class _InputState extends State<_Input> { + @override + Widget build(BuildContext context) { + final scrollController = ScrollController(); + return DesktopScrollWrapper( + scrollController: scrollController, + child: ListView( + controller: scrollController, + physics: DraggableNeverScrollableScrollPhysics(), + children: [ + scrollMode(context), + ]).marginOnly(bottom: _kListViewBottomMargin)); + } + + Widget scrollMode(BuildContext context) { + final key = 'scroll_mode'; + onChanged(String value) async { + await bind.mainSetUserDefaultOption(key: key, value: value); + setState(() {}); + } + + final groupValue = bind.mainGetUserDefaultOption(key: key); + return _Card(title: 'Default Scroll Mode', children: [ + _Radio(context, + value: kScrollModeDefault, + groupValue: groupValue, + label: 'Default scroll', + onChanged: onChanged), + _Radio(context, + value: kScrollModeReverse, + groupValue: groupValue, + label: 'Reverse scroll', + onChanged: onChanged), + ]); + } +} + class _Account extends StatefulWidget { const _Account({Key? key}) : super(key: key); diff --git a/flutter/lib/desktop/widgets/remote_toolbar.dart b/flutter/lib/desktop/widgets/remote_toolbar.dart index b59ae373..a6aa1fd0 100644 --- a/flutter/lib/desktop/widgets/remote_toolbar.dart +++ b/flutter/lib/desktop/widgets/remote_toolbar.dart @@ -101,7 +101,7 @@ class ToolbarState { class _ToolbarTheme { static const Color blueColor = MyTheme.button; static const Color hoverBlueColor = MyTheme.accent; - static Color inactiveColor = Colors.grey[800]!; + static Color inactiveColor = Colors.grey[800]!; static Color hoverInactiveColor = Colors.grey[850]!; static const Color redColor = Colors.redAccent; @@ -546,9 +546,11 @@ class _PinMenu extends StatelessWidget { assetName: state.pin ? "assets/pinned.svg" : "assets/unpinned.svg", tooltip: state.pin ? 'Unpin Toolbar' : 'Pin Toolbar', onPressed: state.switchPin, - color: state.pin ? _ToolbarTheme.blueColor : _ToolbarTheme.inactiveColor, - hoverColor: - state.pin ? _ToolbarTheme.hoverBlueColor : _ToolbarTheme.hoverInactiveColor, + color: + state.pin ? _ToolbarTheme.blueColor : _ToolbarTheme.inactiveColor, + hoverColor: state.pin + ? _ToolbarTheme.hoverBlueColor + : _ToolbarTheme.hoverInactiveColor, ), ); } @@ -561,15 +563,18 @@ class _MobileActionMenu extends StatelessWidget { @override Widget build(BuildContext context) { if (!ffi.ffiModel.isPeerAndroid) return Offstage(); - return Obx(()=>_IconMenuButton( - assetName: 'assets/actions_mobile.svg', - tooltip: 'Mobile Actions', - onPressed: () => ffi.dialogManager.toggleMobileActionsOverlay(ffi: ffi), - color: ffi.dialogManager.mobileActionsOverlayVisible.isTrue - ? _ToolbarTheme.blueColor : _ToolbarTheme.inactiveColor, - hoverColor: ffi.dialogManager.mobileActionsOverlayVisible.isTrue - ? _ToolbarTheme.hoverBlueColor : _ToolbarTheme.hoverInactiveColor, - )); + return Obx(() => _IconMenuButton( + assetName: 'assets/actions_mobile.svg', + tooltip: 'Mobile Actions', + onPressed: () => + ffi.dialogManager.toggleMobileActionsOverlay(ffi: ffi), + color: ffi.dialogManager.mobileActionsOverlayVisible.isTrue + ? _ToolbarTheme.blueColor + : _ToolbarTheme.inactiveColor, + hoverColor: ffi.dialogManager.mobileActionsOverlayVisible.isTrue + ? _ToolbarTheme.hoverBlueColor + : _ToolbarTheme.hoverInactiveColor, + )); } } @@ -1304,23 +1309,25 @@ class _KeyboardMenu extends StatelessWidget { color: _ToolbarTheme.blueColor, hoverColor: _ToolbarTheme.hoverBlueColor, menuChildren: [ - mode(modeOnly), + keyboardMode(modeOnly), localKeyboardType(), Divider(), - view_mode(), + viewMode(), + Divider(), + scrollMode(), ]); } - mode(String? modeOnly) { + keyboardMode(String? modeOnly) { return futureBuilder(future: () async { return await bind.sessionGetKeyboardMode(sessionId: ffi.sessionId) ?? _kKeyLegacyMode; }(), hasData: (data) { final groupValue = data as String; - List modes = [ - KeyboardModeMenu(key: _kKeyLegacyMode, menu: 'Legacy mode'), - KeyboardModeMenu(key: _kKeyMapMode, menu: 'Map mode'), - KeyboardModeMenu(key: _kKeyTranslateMode, menu: 'Translate mode'), + List modes = [ + InputModeMenu(key: _kKeyLegacyMode, menu: 'Legacy mode'), + InputModeMenu(key: _kKeyMapMode, menu: 'Map mode'), + InputModeMenu(key: _kKeyTranslateMode, menu: 'Translate mode'), ]; List list = []; final enabled = !ffi.ffiModel.viewOnly; @@ -1330,7 +1337,7 @@ class _KeyboardMenu extends StatelessWidget { sessionId: ffi.sessionId, value: value); } - for (KeyboardModeMenu mode in modes) { + for (InputModeMenu mode in modes) { if (modeOnly != null && mode.key != modeOnly) { continue; } else if (!bind.sessionIsKeyboardModeSupported( @@ -1379,7 +1386,7 @@ class _KeyboardMenu extends StatelessWidget { ); } - view_mode() { + viewMode() { final ffiModel = ffi.ffiModel; final enabled = version_cmp(pi.version, '1.2.0') >= 0 && ffiModel.keyboard; return CkbMenuButton( @@ -1395,6 +1402,40 @@ class _KeyboardMenu extends StatelessWidget { ffi: ffi, child: Text(translate('View Mode'))); } + + scrollMode() { + return futureBuilder(future: () async { + final mode = await bind.sessionGetScrollMode(sessionId: ffi.sessionId); + if (mode != null) { + return mode; + } + return bind.mainGetUserDefaultOption(key: 'scroll_mode'); + }(), hasData: (data) { + final groupValue = data as String; + List modes = [ + InputModeMenu(key: kScrollModeDefault, menu: 'Default mode'), + InputModeMenu(key: kScrollModeReverse, menu: 'Reverse mode'), + ]; + List list = []; + final enabled = !ffi.ffiModel.viewOnly; + onChanged(String? value) async { + if (value == null) return; + await bind.sessionSetScrollMode(sessionId: ffi.sessionId, value: value); + } + + for (InputModeMenu mode in modes) { + var text = translate(mode.menu); + list.add(RdoMenuButton( + child: Text(text), + value: mode.key, + groupValue: groupValue, + onChanged: enabled ? onChanged : null, + ffi: ffi, + )); + } + return Column(children: list); + }); + } } class _ChatMenu extends StatefulWidget { @@ -1592,26 +1633,26 @@ class _IconMenuButtonState extends State<_IconMenuButton> { width: _ToolbarTheme.buttonSize, height: _ToolbarTheme.buttonSize, child: MenuItemButton( - style: ButtonStyle( - backgroundColor: MaterialStatePropertyAll(Colors.transparent), - padding: MaterialStatePropertyAll(EdgeInsets.zero), - overlayColor: MaterialStatePropertyAll(Colors.transparent)), - onHover: (value) => setState(() { - hover = value; - }), - onPressed: widget.onPressed, - child: Tooltip( - message: translate(widget.tooltip), - child: Material( - type: MaterialType.transparency, - child: Ink( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(_ToolbarTheme.iconRadius), - color: hover ? widget.hoverColor : widget.color, - ), - child: icon)), - ) - ), + style: ButtonStyle( + backgroundColor: MaterialStatePropertyAll(Colors.transparent), + padding: MaterialStatePropertyAll(EdgeInsets.zero), + overlayColor: MaterialStatePropertyAll(Colors.transparent)), + onHover: (value) => setState(() { + hover = value; + }), + onPressed: widget.onPressed, + child: Tooltip( + message: translate(widget.tooltip), + child: Material( + type: MaterialType.transparency, + child: Ink( + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(_ToolbarTheme.iconRadius), + color: hover ? widget.hoverColor : widget.color, + ), + child: icon)), + )), ).marginSymmetric( horizontal: widget.hMargin ?? _ToolbarTheme.buttonHMargin, vertical: widget.vMargin ?? _ToolbarTheme.buttonVMargin); @@ -1675,18 +1716,17 @@ class _IconSubmenuButtonState extends State<_IconSubmenuButton> { onHover: (value) => setState(() { hover = value; }), - child: Tooltip( - message: translate(widget.tooltip), - child: Material( + child: Tooltip( + message: translate(widget.tooltip), + child: Material( type: MaterialType.transparency, child: Ink( - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(_ToolbarTheme.iconRadius), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(_ToolbarTheme.iconRadius), color: hover ? widget.hoverColor : widget.color, - ), - child: icon)) - ), + ), + child: icon))), menuChildren: widget.menuChildren .map((e) => _buildPointerTrackWidget(e, widget.ffi)) .toList())); @@ -1973,11 +2013,11 @@ class _DraggableShowHideState extends State<_DraggableShowHide> { } } -class KeyboardModeMenu { +class InputModeMenu { final String key; final String menu; - KeyboardModeMenu({required this.key, required this.menu}); + InputModeMenu({required this.key, required this.menu}); } _menuDismissCallback(FFI ffi) => ffi.inputModel.refreshMousePos(); diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index a48da5ff..4d89d06c 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -230,6 +230,7 @@ pub struct PeerConfig { skip_serializing_if = "String::is_empty" )] pub view_style: String, + // Image scroll style, scrollbar or scroll auto #[serde( default = "PeerConfig::default_scroll_style", deserialize_with = "PeerConfig::deserialize_scroll_style", @@ -276,6 +277,13 @@ pub struct PeerConfig { pub keyboard_mode: String, #[serde(flatten)] pub view_only: ViewOnly, + // Mouse wheel or touchpad scroll mode, default or reverse + #[serde( + default = "PeerConfig::default_scroll_mode", + deserialize_with = "PeerConfig::deserialize_scroll_mode", + skip_serializing_if = "String::is_empty" + )] + pub scroll_mode: String, #[serde( default, @@ -319,6 +327,7 @@ impl Default for PeerConfig { show_quality_monitor: Default::default(), keyboard_mode: Default::default(), view_only: Default::default(), + scroll_mode: Self::default_scroll_mode(), custom_resolutions: Default::default(), options: Self::default_options(), ui_flutter: Default::default(), @@ -1130,6 +1139,11 @@ impl PeerConfig { deserialize_image_quality, UserDefaultConfig::read().get("image_quality") ); + serde_field_string!( + default_scroll_mode, + deserialize_scroll_mode, + UserDefaultConfig::read().get("scroll_mode") + ); fn default_custom_image_quality() -> Vec { let f: f64 = UserDefaultConfig::read() @@ -1474,6 +1488,7 @@ impl UserDefaultConfig { } "custom_image_quality" => self.get_double_string(key, 50.0, 10.0, 0xFFF as f64), "custom-fps" => self.get_double_string(key, 30.0, 5.0, 120.0), + "scroll_mode" => self.get_string(key, "default", vec!["reverse"]), _ => self .options .get(key) diff --git a/src/client.rs b/src/client.rs index 0bfcfb65..f23a2c51 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1195,6 +1195,17 @@ impl LoginConfigHandler { self.save_config(config); } + /// Save mouse scroll mode("default", "reverse") to the current config. + /// + /// # Arguments + /// + /// * `value` - The view style to be saved. + pub fn save_scroll_mode(&mut self, value: String) { + let mut config = self.load_config(); + config.scroll_mode = value; + self.save_config(config); + } + /// Save scroll style to the current config. /// /// # Arguments diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs index eaf273d2..05dcf034 100644 --- a/src/flutter_ffi.rs +++ b/src/flutter_ffi.rs @@ -21,8 +21,6 @@ use hbb_common::{ }; use std::{ collections::HashMap, - ffi::{CStr, CString}, - os::raw::c_char, str::FromStr, sync::{ atomic::{AtomicI32, Ordering}, @@ -302,6 +300,20 @@ pub fn session_set_keyboard_mode(session_id: SessionID, value: String) { } } +pub fn session_get_scroll_mode(session_id: SessionID) -> Option { + if let Some(session) = SESSIONS.read().unwrap().get(&session_id) { + Some(session.get_scroll_mode()) + } else { + None + } +} + +pub fn session_set_scroll_mode(session_id: SessionID, value: String) { + if let Some(session) = SESSIONS.write().unwrap().get_mut(&session_id) { + session.save_scroll_mode(value); + } +} + pub fn session_get_custom_image_quality(session_id: SessionID) -> Option> { if let Some(session) = SESSIONS.read().unwrap().get(&session_id) { Some(session.get_custom_image_quality()) diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index a8304b5d..c416b95d 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -1,4 +1,4 @@ -use crate::input::{MOUSE_BUTTON_LEFT, MOUSE_TYPE_DOWN, MOUSE_TYPE_UP}; +use crate::input::{MOUSE_BUTTON_LEFT, MOUSE_TYPE_DOWN, MOUSE_TYPE_UP, MOUSE_TYPE_WHEEL}; #[cfg(not(any(target_os = "android", target_os = "ios")))] use std::{collections::HashMap, sync::atomic::AtomicBool}; use std::{ @@ -175,6 +175,14 @@ impl Session { self.lc.write().unwrap().save_keyboard_mode(value); } + pub fn get_scroll_mode(&self) -> String { + self.lc.read().unwrap().scroll_mode.clone() + } + + pub fn save_scroll_mode(&mut self, value: String) { + self.lc.write().unwrap().save_scroll_mode(value); + } + pub fn save_view_style(&mut self, value: String) { self.lc.write().unwrap().save_view_style(value); } @@ -730,6 +738,7 @@ impl Session { }); } "pan_update" => { + let (x, y) = self.get_scroll_xy((x, y)); touch_evt.set_pan_update(TouchPanUpdate { x, y, @@ -753,11 +762,26 @@ impl Session { send_pointer_device_event(evt, alt, ctrl, shift, command, self); } + #[inline] + #[cfg(not(any(target_os = "android", target_os = "ios")))] + fn is_scroll_reverse_mode(&self) -> bool { + self.lc.read().unwrap().scroll_mode.eq("reverse") + } + + #[inline] + fn get_scroll_xy(&self, xy: (i32, i32)) -> (i32, i32) { + #[cfg(not(any(target_os = "android", target_os = "ios")))] + if self.is_scroll_reverse_mode() { + return (-xy.0, -xy.1); + } + xy + } + pub fn send_mouse( &self, mask: i32, - x: i32, - y: i32, + mut x: i32, + mut y: i32, alt: bool, ctrl: bool, shift: bool, @@ -772,6 +796,12 @@ impl Session { } } + let (x, y) = if mask == MOUSE_TYPE_WHEEL { + self.get_scroll_xy((x, y)) + } else { + (x, y) + }; + // #[cfg(not(any(target_os = "android", target_os = "ios")))] let (alt, ctrl, shift, command) = keyboard::client::get_modifiers_state(alt, ctrl, shift, command); From 28d8ad1e616428350b85f1fbc0020e34c6adabc2 Mon Sep 17 00:00:00 2001 From: fufesou Date: Sun, 10 Sep 2023 14:23:22 +0800 Subject: [PATCH 2/5] add lang Signed-off-by: fufesou --- flutter/lib/desktop/pages/desktop_setting_page.dart | 4 ++-- src/lang/ar.rs | 4 ++++ src/lang/ca.rs | 4 ++++ src/lang/cn.rs | 4 ++++ src/lang/cs.rs | 4 ++++ src/lang/da.rs | 4 ++++ src/lang/de.rs | 4 ++++ src/lang/el.rs | 4 ++++ src/lang/eo.rs | 4 ++++ src/lang/es.rs | 4 ++++ src/lang/fa.rs | 4 ++++ src/lang/fr.rs | 4 ++++ src/lang/hu.rs | 4 ++++ src/lang/id.rs | 4 ++++ src/lang/it.rs | 4 ++++ src/lang/ja.rs | 4 ++++ src/lang/ko.rs | 4 ++++ src/lang/kz.rs | 4 ++++ src/lang/lt.rs | 4 ++++ src/lang/nl.rs | 4 ++++ src/lang/pl.rs | 4 ++++ src/lang/pt_PT.rs | 4 ++++ src/lang/ptbr.rs | 4 ++++ src/lang/ro.rs | 4 ++++ src/lang/ru.rs | 4 ++++ src/lang/sk.rs | 4 ++++ src/lang/sl.rs | 4 ++++ src/lang/sq.rs | 4 ++++ src/lang/sr.rs | 4 ++++ src/lang/sv.rs | 4 ++++ src/lang/template.rs | 4 ++++ src/lang/th.rs | 4 ++++ src/lang/tr.rs | 4 ++++ src/lang/tw.rs | 4 ++++ src/lang/ua.rs | 4 ++++ src/lang/vn.rs | 4 ++++ 36 files changed, 142 insertions(+), 2 deletions(-) diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dart index 38b2d3c5..3b033255 100644 --- a/flutter/lib/desktop/pages/desktop_setting_page.dart +++ b/flutter/lib/desktop/pages/desktop_setting_page.dart @@ -1255,12 +1255,12 @@ class _InputState extends State<_Input> { _Radio(context, value: kScrollModeDefault, groupValue: groupValue, - label: 'Default scroll', + label: 'Default mode', onChanged: onChanged), _Radio(context, value: kScrollModeReverse, groupValue: groupValue, - label: 'Reverse scroll', + label: 'Reverse mode', onChanged: onChanged), ]); } diff --git a/src/lang/ar.rs b/src/lang/ar.rs index 0d9bdacd..a1ba011e 100644 --- a/src/lang/ar.rs +++ b/src/lang/ar.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ca.rs b/src/lang/ca.rs index 1ec5d78f..27925a84 100644 --- a/src/lang/ca.rs +++ b/src/lang/ca.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/cn.rs b/src/lang/cn.rs index 8e07a296..1367b290 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "HSV 色"), ("Installation Successful!", "安装成功!"), ("Installation failed!", "安装失败!"), + ("Input", "输入"), + ("Default Scroll Mode", "默认滚动模式"), + ("Default mode", "默认模式"), + ("Reverse mode", "反向模式"), ].iter().cloned().collect(); } diff --git a/src/lang/cs.rs b/src/lang/cs.rs index 5dd4dc9a..0ef2dc12 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/da.rs b/src/lang/da.rs index 999875df..7e4dd064 100644 --- a/src/lang/da.rs +++ b/src/lang/da.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/de.rs b/src/lang/de.rs index 8dcf672c..e292ea0c 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "HSV-Farbe"), ("Installation Successful!", "Installation erfolgreich!"), ("Installation failed!", "Installation fehlgeschlagen!"), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/el.rs b/src/lang/el.rs index 4e7a8301..a2eec30b 100644 --- a/src/lang/el.rs +++ b/src/lang/el.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/eo.rs b/src/lang/eo.rs index 7cb5a1b2..9374b652 100644 --- a/src/lang/eo.rs +++ b/src/lang/eo.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/es.rs b/src/lang/es.rs index b1fc5795..d859cae3 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "Color HSV"), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fa.rs b/src/lang/fa.rs index 1284ec98..a276ae71 100644 --- a/src/lang/fa.rs +++ b/src/lang/fa.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fr.rs b/src/lang/fr.rs index fea4f7ff..a126e158 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "Couleur TSL"), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/hu.rs b/src/lang/hu.rs index a9089de3..3dcba499 100644 --- a/src/lang/hu.rs +++ b/src/lang/hu.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/id.rs b/src/lang/id.rs index 27676a42..06fa9584 100644 --- a/src/lang/id.rs +++ b/src/lang/id.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "Warna HSV"), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/it.rs b/src/lang/it.rs index 07234b3f..0c152410 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "Colore HSV"), ("Installation Successful!", "Installazione completata"), ("Installation failed!", "Installazione fallita"), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ja.rs b/src/lang/ja.rs index e6ef7581..b75af831 100644 --- a/src/lang/ja.rs +++ b/src/lang/ja.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ko.rs b/src/lang/ko.rs index 6f26674c..af849fc0 100644 --- a/src/lang/ko.rs +++ b/src/lang/ko.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/kz.rs b/src/lang/kz.rs index b68caad5..c4199b2a 100644 --- a/src/lang/kz.rs +++ b/src/lang/kz.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/lt.rs b/src/lang/lt.rs index 41caa606..f9c9cd7e 100644 --- a/src/lang/lt.rs +++ b/src/lang/lt.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/nl.rs b/src/lang/nl.rs index 6010a413..e625fbd6 100644 --- a/src/lang/nl.rs +++ b/src/lang/nl.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "HSV Kleur"), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pl.rs b/src/lang/pl.rs index fe069359..c17af1ce 100644 --- a/src/lang/pl.rs +++ b/src/lang/pl.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pt_PT.rs b/src/lang/pt_PT.rs index d0ade108..cb57a176 100644 --- a/src/lang/pt_PT.rs +++ b/src/lang/pt_PT.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs index 6dfc8f2a..a0284535 100644 --- a/src/lang/ptbr.rs +++ b/src/lang/ptbr.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ro.rs b/src/lang/ro.rs index 01e0402a..29148949 100644 --- a/src/lang/ro.rs +++ b/src/lang/ro.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ru.rs b/src/lang/ru.rs index 2f86351c..17ff0ae5 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "Цвет HSV"), ("Installation Successful!", "Установка выполнена успешно!"), ("Installation failed!", "Установка не выполнена!"), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sk.rs b/src/lang/sk.rs index 615dd08f..e0386ee3 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sl.rs b/src/lang/sl.rs index a05b5f4c..1ace96c0 100755 --- a/src/lang/sl.rs +++ b/src/lang/sl.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sq.rs b/src/lang/sq.rs index cfc2fda7..c6fca4d5 100644 --- a/src/lang/sq.rs +++ b/src/lang/sq.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sr.rs b/src/lang/sr.rs index 85bb6f48..9a3407ec 100644 --- a/src/lang/sr.rs +++ b/src/lang/sr.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sv.rs b/src/lang/sv.rs index 90f54361..4333f78c 100644 --- a/src/lang/sv.rs +++ b/src/lang/sv.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/template.rs b/src/lang/template.rs index 7f58b445..8b9bf3a9 100644 --- a/src/lang/template.rs +++ b/src/lang/template.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/th.rs b/src/lang/th.rs index 94251c5b..220250d9 100644 --- a/src/lang/th.rs +++ b/src/lang/th.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tr.rs b/src/lang/tr.rs index 57a337b1..e05fecc2 100644 --- a/src/lang/tr.rs +++ b/src/lang/tr.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "HSV Rengi"), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tw.rs b/src/lang/tw.rs index 49d1c08c..69c5c4d2 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "HSV 色"), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ua.rs b/src/lang/ua.rs index b398afab..54585793 100644 --- a/src/lang/ua.rs +++ b/src/lang/ua.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } diff --git a/src/lang/vn.rs b/src/lang/vn.rs index a6a4478e..17e8a48f 100644 --- a/src/lang/vn.rs +++ b/src/lang/vn.rs @@ -543,5 +543,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), + ("Input", ""), + ("Default Scroll Mode", ""), + ("Default mode", ""), + ("Reverse mode", ""), ].iter().cloned().collect(); } From 0c1899a0aff69c39c28350d8c376e3455fea2a95 Mon Sep 17 00:00:00 2001 From: fufesou Date: Sun, 10 Sep 2023 14:25:41 +0800 Subject: [PATCH 3/5] format Signed-off-by: fufesou --- .../lib/desktop/widgets/remote_toolbar.dart | 69 +++++++++---------- 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/flutter/lib/desktop/widgets/remote_toolbar.dart b/flutter/lib/desktop/widgets/remote_toolbar.dart index a6aa1fd0..63085d52 100644 --- a/flutter/lib/desktop/widgets/remote_toolbar.dart +++ b/flutter/lib/desktop/widgets/remote_toolbar.dart @@ -546,11 +546,9 @@ class _PinMenu extends StatelessWidget { assetName: state.pin ? "assets/pinned.svg" : "assets/unpinned.svg", tooltip: state.pin ? 'Unpin Toolbar' : 'Pin Toolbar', onPressed: state.switchPin, - color: - state.pin ? _ToolbarTheme.blueColor : _ToolbarTheme.inactiveColor, - hoverColor: state.pin - ? _ToolbarTheme.hoverBlueColor - : _ToolbarTheme.hoverInactiveColor, + color: state.pin ? _ToolbarTheme.blueColor : _ToolbarTheme.inactiveColor, + hoverColor: + state.pin ? _ToolbarTheme.hoverBlueColor : _ToolbarTheme.hoverInactiveColor, ), ); } @@ -563,18 +561,15 @@ class _MobileActionMenu extends StatelessWidget { @override Widget build(BuildContext context) { if (!ffi.ffiModel.isPeerAndroid) return Offstage(); - return Obx(() => _IconMenuButton( - assetName: 'assets/actions_mobile.svg', - tooltip: 'Mobile Actions', - onPressed: () => - ffi.dialogManager.toggleMobileActionsOverlay(ffi: ffi), - color: ffi.dialogManager.mobileActionsOverlayVisible.isTrue - ? _ToolbarTheme.blueColor - : _ToolbarTheme.inactiveColor, - hoverColor: ffi.dialogManager.mobileActionsOverlayVisible.isTrue - ? _ToolbarTheme.hoverBlueColor - : _ToolbarTheme.hoverInactiveColor, - )); + return Obx(()=>_IconMenuButton( + assetName: 'assets/actions_mobile.svg', + tooltip: 'Mobile Actions', + onPressed: () => ffi.dialogManager.toggleMobileActionsOverlay(ffi: ffi), + color: ffi.dialogManager.mobileActionsOverlayVisible.isTrue + ? _ToolbarTheme.blueColor : _ToolbarTheme.inactiveColor, + hoverColor: ffi.dialogManager.mobileActionsOverlayVisible.isTrue + ? _ToolbarTheme.hoverBlueColor : _ToolbarTheme.hoverInactiveColor, + )); } } @@ -1633,26 +1628,26 @@ class _IconMenuButtonState extends State<_IconMenuButton> { width: _ToolbarTheme.buttonSize, height: _ToolbarTheme.buttonSize, child: MenuItemButton( - style: ButtonStyle( - backgroundColor: MaterialStatePropertyAll(Colors.transparent), - padding: MaterialStatePropertyAll(EdgeInsets.zero), - overlayColor: MaterialStatePropertyAll(Colors.transparent)), - onHover: (value) => setState(() { - hover = value; - }), - onPressed: widget.onPressed, - child: Tooltip( - message: translate(widget.tooltip), - child: Material( - type: MaterialType.transparency, - child: Ink( - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(_ToolbarTheme.iconRadius), - color: hover ? widget.hoverColor : widget.color, - ), - child: icon)), - )), + style: ButtonStyle( + backgroundColor: MaterialStatePropertyAll(Colors.transparent), + padding: MaterialStatePropertyAll(EdgeInsets.zero), + overlayColor: MaterialStatePropertyAll(Colors.transparent)), + onHover: (value) => setState(() { + hover = value; + }), + onPressed: widget.onPressed, + child: Tooltip( + message: translate(widget.tooltip), + child: Material( + type: MaterialType.transparency, + child: Ink( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(_ToolbarTheme.iconRadius), + color: hover ? widget.hoverColor : widget.color, + ), + child: icon)), + ) + ), ).marginSymmetric( horizontal: widget.hMargin ?? _ToolbarTheme.buttonHMargin, vertical: widget.vMargin ?? _ToolbarTheme.buttonVMargin); From 558567d399ab92641c1cfe2c0e7079a144beb3eb Mon Sep 17 00:00:00 2001 From: fufesou Date: Sun, 10 Sep 2023 14:28:58 +0800 Subject: [PATCH 4/5] remove unused mut Signed-off-by: fufesou --- src/ui_session_interface.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index c416b95d..fe160360 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -780,8 +780,8 @@ impl Session { pub fn send_mouse( &self, mask: i32, - mut x: i32, - mut y: i32, + x: i32, + y: i32, alt: bool, ctrl: bool, shift: bool, From f1d5afe72aa41100f9aac7a5c8c6cd38bbb2305d Mon Sep 17 00:00:00 2001 From: fufesou Date: Sun, 10 Sep 2023 18:31:16 +0800 Subject: [PATCH 5/5] Change the option 'Scroll mode' to be 'Reverse mouse wheel' Signed-off-by: fufesou --- .../desktop/pages/desktop_setting_page.dart | 47 +------- .../lib/desktop/widgets/remote_toolbar.dart | 109 +++++++++--------- libs/hbb_common/src/config.rs | 23 ++-- src/client.rs | 8 +- src/flutter_ffi.rs | 8 +- src/lang/ar.rs | 5 +- src/lang/ca.rs | 5 +- src/lang/cn.rs | 5 +- src/lang/cs.rs | 5 +- src/lang/da.rs | 5 +- src/lang/de.rs | 5 +- src/lang/el.rs | 5 +- src/lang/en.rs | 1 + src/lang/eo.rs | 5 +- src/lang/es.rs | 5 +- src/lang/fa.rs | 5 +- src/lang/fr.rs | 5 +- src/lang/hu.rs | 5 +- src/lang/id.rs | 5 +- src/lang/it.rs | 5 +- src/lang/ja.rs | 5 +- src/lang/ko.rs | 5 +- src/lang/kz.rs | 5 +- src/lang/lt.rs | 5 +- src/lang/nl.rs | 5 +- src/lang/pl.rs | 5 +- src/lang/pt_PT.rs | 5 +- src/lang/ptbr.rs | 5 +- src/lang/ro.rs | 5 +- src/lang/ru.rs | 5 +- src/lang/sk.rs | 5 +- src/lang/sl.rs | 5 +- src/lang/sq.rs | 5 +- src/lang/sr.rs | 5 +- src/lang/sv.rs | 5 +- src/lang/template.rs | 5 +- src/lang/th.rs | 5 +- src/lang/tr.rs | 5 +- src/lang/tw.rs | 5 +- src/lang/ua.rs | 5 +- src/lang/vn.rs | 5 +- src/ui_session_interface.rs | 10 +- 42 files changed, 116 insertions(+), 265 deletions(-) diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dart index 3b033255..468886cb 100644 --- a/flutter/lib/desktop/pages/desktop_setting_page.dart +++ b/flutter/lib/desktop/pages/desktop_setting_page.dart @@ -105,7 +105,6 @@ class _DesktopSettingPageState extends State _TabInfo('Network', Icons.link_outlined, Icons.link), _TabInfo( 'Display', Icons.desktop_windows_outlined, Icons.desktop_windows), - _TabInfo('Input', Icons.keyboard_outlined, Icons.keyboard), _TabInfo('Account', Icons.person_outline, Icons.person), _TabInfo('About', Icons.info_outline, Icons.info) ]; @@ -122,7 +121,6 @@ class _DesktopSettingPageState extends State _Safety(), _Network(), _Display(), - _Input(), _Account(), _About(), ]; @@ -1218,50 +1216,7 @@ class _DisplayState extends State<_Display> { otherRow('Disable clipboard', 'disable_clipboard'), otherRow('Lock after session end', 'lock_after_session_end'), otherRow('Privacy mode', 'privacy_mode'), - ]); - } -} - -class _Input extends StatefulWidget { - const _Input({Key? key}) : super(key: key); - - @override - State<_Input> createState() => _InputState(); -} - -class _InputState extends State<_Input> { - @override - Widget build(BuildContext context) { - final scrollController = ScrollController(); - return DesktopScrollWrapper( - scrollController: scrollController, - child: ListView( - controller: scrollController, - physics: DraggableNeverScrollableScrollPhysics(), - children: [ - scrollMode(context), - ]).marginOnly(bottom: _kListViewBottomMargin)); - } - - Widget scrollMode(BuildContext context) { - final key = 'scroll_mode'; - onChanged(String value) async { - await bind.mainSetUserDefaultOption(key: key, value: value); - setState(() {}); - } - - final groupValue = bind.mainGetUserDefaultOption(key: key); - return _Card(title: 'Default Scroll Mode', children: [ - _Radio(context, - value: kScrollModeDefault, - groupValue: groupValue, - label: 'Default mode', - onChanged: onChanged), - _Radio(context, - value: kScrollModeReverse, - groupValue: groupValue, - label: 'Reverse mode', - onChanged: onChanged), + otherRow('Reverse mouse wheel', 'reverse_mouse_wheel'), ]); } } diff --git a/flutter/lib/desktop/widgets/remote_toolbar.dart b/flutter/lib/desktop/widgets/remote_toolbar.dart index 63085d52..a03fc704 100644 --- a/flutter/lib/desktop/widgets/remote_toolbar.dart +++ b/flutter/lib/desktop/widgets/remote_toolbar.dart @@ -546,9 +546,11 @@ class _PinMenu extends StatelessWidget { assetName: state.pin ? "assets/pinned.svg" : "assets/unpinned.svg", tooltip: state.pin ? 'Unpin Toolbar' : 'Pin Toolbar', onPressed: state.switchPin, - color: state.pin ? _ToolbarTheme.blueColor : _ToolbarTheme.inactiveColor, - hoverColor: - state.pin ? _ToolbarTheme.hoverBlueColor : _ToolbarTheme.hoverInactiveColor, + color: + state.pin ? _ToolbarTheme.blueColor : _ToolbarTheme.inactiveColor, + hoverColor: state.pin + ? _ToolbarTheme.hoverBlueColor + : _ToolbarTheme.hoverInactiveColor, ), ); } @@ -561,15 +563,18 @@ class _MobileActionMenu extends StatelessWidget { @override Widget build(BuildContext context) { if (!ffi.ffiModel.isPeerAndroid) return Offstage(); - return Obx(()=>_IconMenuButton( - assetName: 'assets/actions_mobile.svg', - tooltip: 'Mobile Actions', - onPressed: () => ffi.dialogManager.toggleMobileActionsOverlay(ffi: ffi), - color: ffi.dialogManager.mobileActionsOverlayVisible.isTrue - ? _ToolbarTheme.blueColor : _ToolbarTheme.inactiveColor, - hoverColor: ffi.dialogManager.mobileActionsOverlayVisible.isTrue - ? _ToolbarTheme.hoverBlueColor : _ToolbarTheme.hoverInactiveColor, - )); + return Obx(() => _IconMenuButton( + assetName: 'assets/actions_mobile.svg', + tooltip: 'Mobile Actions', + onPressed: () => + ffi.dialogManager.toggleMobileActionsOverlay(ffi: ffi), + color: ffi.dialogManager.mobileActionsOverlayVisible.isTrue + ? _ToolbarTheme.blueColor + : _ToolbarTheme.inactiveColor, + hoverColor: ffi.dialogManager.mobileActionsOverlayVisible.isTrue + ? _ToolbarTheme.hoverBlueColor + : _ToolbarTheme.hoverInactiveColor, + )); } } @@ -1309,7 +1314,7 @@ class _KeyboardMenu extends StatelessWidget { Divider(), viewMode(), Divider(), - scrollMode(), + reverseMouseWheel(), ]); } @@ -1398,37 +1403,29 @@ class _KeyboardMenu extends StatelessWidget { child: Text(translate('View Mode'))); } - scrollMode() { + reverseMouseWheel() { return futureBuilder(future: () async { - final mode = await bind.sessionGetScrollMode(sessionId: ffi.sessionId); - if (mode != null) { - return mode; + final v = + await bind.sessionGetReverseMouseWheel(sessionId: ffi.sessionId); + debugPrint('REMOVE ME ======================== $v'); + if (v != null && v != '') { + return v; } - return bind.mainGetUserDefaultOption(key: 'scroll_mode'); + return bind.mainGetUserDefaultOption(key: 'reverse_mouse_wheel'); }(), hasData: (data) { - final groupValue = data as String; - List modes = [ - InputModeMenu(key: kScrollModeDefault, menu: 'Default mode'), - InputModeMenu(key: kScrollModeReverse, menu: 'Reverse mode'), - ]; - List list = []; + debugPrint('REMOVE ME ======================== data $data'); final enabled = !ffi.ffiModel.viewOnly; - onChanged(String? value) async { + onChanged(bool? value) async { if (value == null) return; - await bind.sessionSetScrollMode(sessionId: ffi.sessionId, value: value); + await bind.sessionSetReverseMouseWheel( + sessionId: ffi.sessionId, value: value ? 'Y' : 'N'); } - for (InputModeMenu mode in modes) { - var text = translate(mode.menu); - list.add(RdoMenuButton( - child: Text(text), - value: mode.key, - groupValue: groupValue, + return CkbMenuButton( + value: data == 'Y', onChanged: enabled ? onChanged : null, - ffi: ffi, - )); - } - return Column(children: list); + child: Text(translate('Reverse mouse wheel')), + ffi: ffi); }); } } @@ -1628,26 +1625,26 @@ class _IconMenuButtonState extends State<_IconMenuButton> { width: _ToolbarTheme.buttonSize, height: _ToolbarTheme.buttonSize, child: MenuItemButton( - style: ButtonStyle( - backgroundColor: MaterialStatePropertyAll(Colors.transparent), - padding: MaterialStatePropertyAll(EdgeInsets.zero), - overlayColor: MaterialStatePropertyAll(Colors.transparent)), - onHover: (value) => setState(() { - hover = value; - }), - onPressed: widget.onPressed, - child: Tooltip( - message: translate(widget.tooltip), - child: Material( - type: MaterialType.transparency, - child: Ink( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(_ToolbarTheme.iconRadius), - color: hover ? widget.hoverColor : widget.color, - ), - child: icon)), - ) - ), + style: ButtonStyle( + backgroundColor: MaterialStatePropertyAll(Colors.transparent), + padding: MaterialStatePropertyAll(EdgeInsets.zero), + overlayColor: MaterialStatePropertyAll(Colors.transparent)), + onHover: (value) => setState(() { + hover = value; + }), + onPressed: widget.onPressed, + child: Tooltip( + message: translate(widget.tooltip), + child: Material( + type: MaterialType.transparency, + child: Ink( + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(_ToolbarTheme.iconRadius), + color: hover ? widget.hoverColor : widget.color, + ), + child: icon)), + )), ).marginSymmetric( horizontal: widget.hMargin ?? _ToolbarTheme.buttonHMargin, vertical: widget.vMargin ?? _ToolbarTheme.buttonVMargin); diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index 4d89d06c..82174754 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -277,13 +277,13 @@ pub struct PeerConfig { pub keyboard_mode: String, #[serde(flatten)] pub view_only: ViewOnly, - // Mouse wheel or touchpad scroll mode, default or reverse + // Mouse wheel or touchpad scroll mode #[serde( - default = "PeerConfig::default_scroll_mode", - deserialize_with = "PeerConfig::deserialize_scroll_mode", + default = "PeerConfig::default_reverse_mouse_wheel", + deserialize_with = "PeerConfig::deserialize_reverse_mouse_wheel", skip_serializing_if = "String::is_empty" )] - pub scroll_mode: String, + pub reverse_mouse_wheel: String, #[serde( default, @@ -327,7 +327,7 @@ impl Default for PeerConfig { show_quality_monitor: Default::default(), keyboard_mode: Default::default(), view_only: Default::default(), - scroll_mode: Self::default_scroll_mode(), + reverse_mouse_wheel: Self::default_reverse_mouse_wheel(), custom_resolutions: Default::default(), options: Self::default_options(), ui_flutter: Default::default(), @@ -1140,9 +1140,9 @@ impl PeerConfig { UserDefaultConfig::read().get("image_quality") ); serde_field_string!( - default_scroll_mode, - deserialize_scroll_mode, - UserDefaultConfig::read().get("scroll_mode") + default_reverse_mouse_wheel, + deserialize_reverse_mouse_wheel, + UserDefaultConfig::read().get("reverse_mouse_wheel") ); fn default_custom_image_quality() -> Vec { @@ -1488,7 +1488,6 @@ impl UserDefaultConfig { } "custom_image_quality" => self.get_double_string(key, 50.0, 10.0, 0xFFF as f64), "custom-fps" => self.get_double_string(key, 30.0, 5.0, 120.0), - "scroll_mode" => self.get_string(key, "default", vec!["reverse"]), _ => self .options .get(key) @@ -1498,7 +1497,11 @@ impl UserDefaultConfig { } pub fn set(&mut self, key: String, value: String) { - self.options.insert(key, value); + if value.is_empty() { + self.options.remove(&key); + } else { + self.options.insert(key, value); + } self.store(); } diff --git a/src/client.rs b/src/client.rs index f23a2c51..85b6fc0f 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1195,14 +1195,14 @@ impl LoginConfigHandler { self.save_config(config); } - /// Save mouse scroll mode("default", "reverse") to the current config. + /// Save reverse mouse wheel ("", "Y") to the current config. /// /// # Arguments /// - /// * `value` - The view style to be saved. - pub fn save_scroll_mode(&mut self, value: String) { + /// * `value` - The reverse mouse wheel ("", "Y"). + pub fn save_reverse_mouse_wheel(&mut self, value: String) { let mut config = self.load_config(); - config.scroll_mode = value; + config.reverse_mouse_wheel = value; self.save_config(config); } diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs index 05dcf034..69f6f507 100644 --- a/src/flutter_ffi.rs +++ b/src/flutter_ffi.rs @@ -300,17 +300,17 @@ pub fn session_set_keyboard_mode(session_id: SessionID, value: String) { } } -pub fn session_get_scroll_mode(session_id: SessionID) -> Option { +pub fn session_get_reverse_mouse_wheel(session_id: SessionID) -> Option { if let Some(session) = SESSIONS.read().unwrap().get(&session_id) { - Some(session.get_scroll_mode()) + Some(session.get_reverse_mouse_wheel()) } else { None } } -pub fn session_set_scroll_mode(session_id: SessionID, value: String) { +pub fn session_set_reverse_mouse_wheel(session_id: SessionID, value: String) { if let Some(session) = SESSIONS.write().unwrap().get_mut(&session_id) { - session.save_scroll_mode(value); + session.save_reverse_mouse_wheel(value); } } diff --git a/src/lang/ar.rs b/src/lang/ar.rs index a1ba011e..4a1f8486 100644 --- a/src/lang/ar.rs +++ b/src/lang/ar.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ca.rs b/src/lang/ca.rs index 27925a84..55e01fef 100644 --- a/src/lang/ca.rs +++ b/src/lang/ca.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/cn.rs b/src/lang/cn.rs index 1367b290..5fdfa460 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "HSV 色"), ("Installation Successful!", "安装成功!"), ("Installation failed!", "安装失败!"), - ("Input", "输入"), - ("Default Scroll Mode", "默认滚动模式"), - ("Default mode", "默认模式"), - ("Reverse mode", "反向模式"), + ("Reverse mouse wheel", "鼠标滚轮反向"), ].iter().cloned().collect(); } diff --git a/src/lang/cs.rs b/src/lang/cs.rs index 0ef2dc12..37473e0b 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/da.rs b/src/lang/da.rs index 7e4dd064..9a9ecdfe 100644 --- a/src/lang/da.rs +++ b/src/lang/da.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/de.rs b/src/lang/de.rs index e292ea0c..cc0ae6af 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "HSV-Farbe"), ("Installation Successful!", "Installation erfolgreich!"), ("Installation failed!", "Installation fehlgeschlagen!"), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/el.rs b/src/lang/el.rs index a2eec30b..d2ae3eb5 100644 --- a/src/lang/el.rs +++ b/src/lang/el.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/en.rs b/src/lang/en.rs index c949575c..dc17ac7e 100644 --- a/src/lang/en.rs +++ b/src/lang/en.rs @@ -77,5 +77,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("pull_ab_failed_tip", "Failed to refresh address book"), ("push_ab_failed_tip", "Failed to sync address book to server"), ("synced_peer_readded_tip", "The devices that were present in the recent sessions will be synchronized back to the address book."), + ("View Mode", "View mode"), ].iter().cloned().collect(); } diff --git a/src/lang/eo.rs b/src/lang/eo.rs index 9374b652..90144c69 100644 --- a/src/lang/eo.rs +++ b/src/lang/eo.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/es.rs b/src/lang/es.rs index d859cae3..779135f0 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "Color HSV"), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fa.rs b/src/lang/fa.rs index a276ae71..ab1d7ab1 100644 --- a/src/lang/fa.rs +++ b/src/lang/fa.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fr.rs b/src/lang/fr.rs index a126e158..3ce8bca0 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "Couleur TSL"), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/hu.rs b/src/lang/hu.rs index 3dcba499..50ca9679 100644 --- a/src/lang/hu.rs +++ b/src/lang/hu.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/id.rs b/src/lang/id.rs index 06fa9584..5f802e44 100644 --- a/src/lang/id.rs +++ b/src/lang/id.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "Warna HSV"), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/it.rs b/src/lang/it.rs index 0c152410..493e62d1 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "Colore HSV"), ("Installation Successful!", "Installazione completata"), ("Installation failed!", "Installazione fallita"), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ja.rs b/src/lang/ja.rs index b75af831..015ee7af 100644 --- a/src/lang/ja.rs +++ b/src/lang/ja.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ko.rs b/src/lang/ko.rs index af849fc0..2897ed5f 100644 --- a/src/lang/ko.rs +++ b/src/lang/ko.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/kz.rs b/src/lang/kz.rs index c4199b2a..5a0c1487 100644 --- a/src/lang/kz.rs +++ b/src/lang/kz.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/lt.rs b/src/lang/lt.rs index f9c9cd7e..100e2295 100644 --- a/src/lang/lt.rs +++ b/src/lang/lt.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/nl.rs b/src/lang/nl.rs index e625fbd6..7503831b 100644 --- a/src/lang/nl.rs +++ b/src/lang/nl.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "HSV Kleur"), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pl.rs b/src/lang/pl.rs index c17af1ce..d488f681 100644 --- a/src/lang/pl.rs +++ b/src/lang/pl.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pt_PT.rs b/src/lang/pt_PT.rs index cb57a176..91a85a3b 100644 --- a/src/lang/pt_PT.rs +++ b/src/lang/pt_PT.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs index a0284535..7ca81495 100644 --- a/src/lang/ptbr.rs +++ b/src/lang/ptbr.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ro.rs b/src/lang/ro.rs index 29148949..bcc13a0d 100644 --- a/src/lang/ro.rs +++ b/src/lang/ro.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ru.rs b/src/lang/ru.rs index 17ff0ae5..ee5467af 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "Цвет HSV"), ("Installation Successful!", "Установка выполнена успешно!"), ("Installation failed!", "Установка не выполнена!"), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sk.rs b/src/lang/sk.rs index e0386ee3..003b2cab 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sl.rs b/src/lang/sl.rs index 1ace96c0..80b9aed1 100755 --- a/src/lang/sl.rs +++ b/src/lang/sl.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sq.rs b/src/lang/sq.rs index c6fca4d5..fd2db0c8 100644 --- a/src/lang/sq.rs +++ b/src/lang/sq.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sr.rs b/src/lang/sr.rs index 9a3407ec..9092d453 100644 --- a/src/lang/sr.rs +++ b/src/lang/sr.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sv.rs b/src/lang/sv.rs index 4333f78c..ed8c3697 100644 --- a/src/lang/sv.rs +++ b/src/lang/sv.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/template.rs b/src/lang/template.rs index 8b9bf3a9..6b4d176d 100644 --- a/src/lang/template.rs +++ b/src/lang/template.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/th.rs b/src/lang/th.rs index 220250d9..a5e193a0 100644 --- a/src/lang/th.rs +++ b/src/lang/th.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tr.rs b/src/lang/tr.rs index e05fecc2..0fe1369d 100644 --- a/src/lang/tr.rs +++ b/src/lang/tr.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "HSV Rengi"), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tw.rs b/src/lang/tw.rs index 69c5c4d2..5e533e9b 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", "HSV 色"), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ua.rs b/src/lang/ua.rs index 54585793..7cc885f5 100644 --- a/src/lang/ua.rs +++ b/src/lang/ua.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/lang/vn.rs b/src/lang/vn.rs index 17e8a48f..e65fab66 100644 --- a/src/lang/vn.rs +++ b/src/lang/vn.rs @@ -543,9 +543,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("HSV Color", ""), ("Installation Successful!", ""), ("Installation failed!", ""), - ("Input", ""), - ("Default Scroll Mode", ""), - ("Default mode", ""), - ("Reverse mode", ""), + ("Reverse mouse wheel", ""), ].iter().cloned().collect(); } diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs index fe160360..dae85fe5 100644 --- a/src/ui_session_interface.rs +++ b/src/ui_session_interface.rs @@ -175,12 +175,12 @@ impl Session { self.lc.write().unwrap().save_keyboard_mode(value); } - pub fn get_scroll_mode(&self) -> String { - self.lc.read().unwrap().scroll_mode.clone() + pub fn get_reverse_mouse_wheel(&self) -> String { + self.lc.read().unwrap().reverse_mouse_wheel.clone() } - pub fn save_scroll_mode(&mut self, value: String) { - self.lc.write().unwrap().save_scroll_mode(value); + pub fn save_reverse_mouse_wheel(&mut self, value: String) { + self.lc.write().unwrap().save_reverse_mouse_wheel(value); } pub fn save_view_style(&mut self, value: String) { @@ -765,7 +765,7 @@ impl Session { #[inline] #[cfg(not(any(target_os = "android", target_os = "ios")))] fn is_scroll_reverse_mode(&self) -> bool { - self.lc.read().unwrap().scroll_mode.eq("reverse") + self.lc.read().unwrap().reverse_mouse_wheel.eq("Y") } #[inline]