mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-06-07 09:52:49 +08:00
swap left right mouse button
This commit is contained in:
parent
fc110c4988
commit
2e146190e1
@ -552,6 +552,19 @@ Future<List<TToggleMenu>> toolbarDisplayToggle(
|
||||
child: Text(translate('True color (4:4:4)'))));
|
||||
}
|
||||
|
||||
if (ffiModel.keyboard) {
|
||||
final option = 'swap-left-right-mouse';
|
||||
final value =
|
||||
bind.sessionGetToggleOptionSync(sessionId: sessionId, arg: option);
|
||||
v.add(TToggleMenu(
|
||||
value: value,
|
||||
onChanged: (value) {
|
||||
if (value == null) return;
|
||||
bind.sessionToggleOption(sessionId: sessionId, value: option);
|
||||
},
|
||||
child: Text(translate('swap-left-right-mouse'))));
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
@ -1362,6 +1362,7 @@ class _DisplayState extends State<_Display> {
|
||||
otherRow('Privacy mode', 'privacy_mode'),
|
||||
otherRow('Reverse mouse wheel', 'reverse_mouse_wheel'),
|
||||
otherRow('True color (4:4:4)', 'i444'),
|
||||
otherRow('swap-left-right-mouse', 'swap-left-right-mouse'),
|
||||
];
|
||||
if (useTextureRender) {
|
||||
children.add(otherRow('Show displays as individual windows',
|
||||
|
@ -798,6 +798,7 @@ class __DisplayPageState extends State<_DisplayPage> {
|
||||
otherRow('Privacy mode', 'privacy_mode'),
|
||||
otherRow('Touch mode', 'touch-mode'),
|
||||
otherRow('True color (4:4:4)', 'i444'),
|
||||
otherRow('swap-left-right-mouse', 'swap-left-right-mouse'),
|
||||
],
|
||||
),
|
||||
]),
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", "输入源 1"),
|
||||
("input_source_2_tip", "输入源 2"),
|
||||
("capture_display_elevated_connections_tip", "用户提权后,不能显示多个显示器。若要控制多显示器,请安装后再试。"),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", "Vstupní zdroj 1"),
|
||||
("input_source_2_tip", "Vstupní zdroj 2"),
|
||||
("capture_display_elevated_connections_tip", "Snímání více displejů není podporováno v uživatelském režimu se zvýšenými oprávněními. Pokud chcete ovládat více displejů, zkuste to znovu po instalaci."),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", "Eingangsquelle 1"),
|
||||
("input_source_2_tip", "Eingangsquelle 2"),
|
||||
("capture_display_elevated_connections_tip", "Das Erfassen mehrerer Bildschirme wird im erweiterten Benutzermodus nicht unterstützt. Bitte versuchen Sie es nach der Installation erneut, wenn Sie mehrere Bildschirme steuern möchten."),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -209,5 +209,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", "Input source 1"),
|
||||
("input_source_2_tip", "Input source 2"),
|
||||
("capture_display_elevated_connections_tip", "Capturing multiple displays is not supported in the elevated user mode. Please try again after installation if you want to control multiple displays."),
|
||||
("swap-left-right-mouse", "Swap left-right mouse button"),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", "Sorgente ingresso (1)"),
|
||||
("input_source_2_tip", "Sorgente ingresso (2)"),
|
||||
("capture_display_elevated_connections_tip", "La cattura di più display non è supportata nella modalità utente con privilegi elevati. Se vuoi controllare più display riprova dopo l'installazione."),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", "입력소스 1"),
|
||||
("input_source_2_tip", "입력소스 2"),
|
||||
("capture_display_elevated_connections_tip", "권한 상승된 사용자 모드에서는 다중 디스플레이 캡처가 지원되지 않습니다. 다중 디스플레이를 제어하려면 설치 후 재시도하세요."),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", "Ievades avots 1"),
|
||||
("input_source_2_tip", "Ievades avots 2"),
|
||||
("capture_display_elevated_connections_tip", "Vairāku displeju uzņemšana netiek atbalstīta paaugstinātā lietotāja režīmā. Lūdzu, mēģiniet vēlreiz pēc instalēšanas, ja vēlaties kontrolēt vairākus displejus."),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", "Invoerbron 1"),
|
||||
("input_source_2_tip", "Invoerbron 2"),
|
||||
("capture_display_elevated_connections_tip", "Scannen van meerdere schermen wordt niet ondersteund in de bevoorrechte gebruikersmodus. Als je meerdere schermen wilt bedienen, probeer het dan opnieuw na de installatie."),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", "Wejście źródła 1"),
|
||||
("input_source_2_tip", "Wejście źródła 2"),
|
||||
("capture_display_elevated_connections_tip", "Przechwytywanie wielu ekranów nie jest obsługiwane w trybie użytkownika z podwyższonym poziomem uprawnień. Jeśli chcesz sterować wieloma wyświetlaczami, spróbuj ponownie po instalacji."),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", "Источник ввода 1"),
|
||||
("input_source_2_tip", "Источник ввода 2"),
|
||||
("capture_display_elevated_connections_tip", "Захват экрана нескольких дисплеев не поддерживается в режиме повышенных прав. Повторите попытку после установки, если хотите управлять несколькими дисплеями."),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", "Vstupný zdroj 1"),
|
||||
("input_source_2_tip", "Vstupný zdroj 2"),
|
||||
("capture_display_elevated_connections_tip", "Snímanie viacerých displejov nie je podporované v režime privilegovaného používateľa. Ak chcete ovládať viac displejov, skúste to po inštalácii znova."),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", "Джерело введення 1"),
|
||||
("input_source_2_tip", "Джерело введення 2"),
|
||||
("capture_display_elevated_connections_tip", "В режимі розширених прав захоплення декількох дисплеїв не підтримується. Якщо ви хочете керувати декількома дисплеями, будь ласка, спробуйте це після встановлення."),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -576,5 +576,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
||||
("input_source_1_tip", ""),
|
||||
("input_source_2_tip", ""),
|
||||
("capture_display_elevated_connections_tip", ""),
|
||||
("Swap control-command key", ""),
|
||||
("swap-left-right-mouse", ""),
|
||||
].iter().cloned().collect();
|
||||
}
|
||||
|
@ -591,7 +591,7 @@ impl<T: InvokeUiSession> Session<T> {
|
||||
return "".to_owned();
|
||||
}
|
||||
|
||||
pub fn swab_modifier_key(&self, msg: &mut KeyEvent) {
|
||||
pub fn swap_modifier_key(&self, msg: &mut KeyEvent) {
|
||||
let allow_swap_key = self.get_toggle_option("allow_swap_key".to_string());
|
||||
if allow_swap_key {
|
||||
if let Some(key_event::Union::ControlKey(ck)) = msg.union {
|
||||
@ -670,7 +670,7 @@ impl<T: InvokeUiSession> Session<T> {
|
||||
// mode: legacy(0), map(1), translate(2), auto(3)
|
||||
|
||||
let mut msg = evt.clone();
|
||||
self.swab_modifier_key(&mut msg);
|
||||
self.swap_modifier_key(&mut msg);
|
||||
let mut msg_out = Message::new();
|
||||
msg_out.set_key_event(msg);
|
||||
self.send(Data::Message(msg_out));
|
||||
@ -925,7 +925,7 @@ impl<T: InvokeUiSession> Session<T> {
|
||||
|
||||
pub fn send_mouse(
|
||||
&self,
|
||||
mask: i32,
|
||||
mut mask: i32,
|
||||
x: i32,
|
||||
y: i32,
|
||||
alt: bool,
|
||||
@ -952,6 +952,20 @@ impl<T: InvokeUiSession> Session<T> {
|
||||
let (alt, ctrl, shift, command) =
|
||||
keyboard::client::get_modifiers_state(alt, ctrl, shift, command);
|
||||
|
||||
use crate::input::*;
|
||||
let is_left = (mask & (MOUSE_BUTTON_LEFT << 3)) > 0;
|
||||
let is_right = (mask & (MOUSE_BUTTON_RIGHT << 3)) > 0;
|
||||
if is_left ^ is_right {
|
||||
let swap_lr = self.get_toggle_option("swap-left-right-mouse".to_string());
|
||||
if swap_lr {
|
||||
if is_left {
|
||||
mask = (mask & (!(MOUSE_BUTTON_LEFT << 3))) | (MOUSE_BUTTON_RIGHT << 3);
|
||||
} else {
|
||||
mask = (mask & (!(MOUSE_BUTTON_RIGHT << 3))) | (MOUSE_BUTTON_LEFT << 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
send_mouse(mask, x, y, alt, ctrl, shift, command, self);
|
||||
// on macos, ctrl + left button down = right button down, up won't emit, so we need to
|
||||
// emit up myself if peer is not macos
|
||||
|
Loading…
Reference in New Issue
Block a user