Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

swap left right mouse button

rustdesk2e146190e106
diff --git a/flutter/lib/common/widgets/toolbar.dart b/flutter/lib/common/widgets/toolbar.dart
index 2ff3419ab..05cb84f8d 100644
--- a/flutter/lib/common/widgets/toolbar.dart
+++ b/flutter/lib/common/widgets/toolbar.dart
@@ -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;
}
diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dart
index ce80bfbd0..29a8b3b31 100644
--- a/flutter/lib/desktop/pages/desktop_setting_page.dart
+++ b/flutter/lib/desktop/pages/desktop_setting_page.dart
@@ -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',
diff --git a/flutter/lib/mobile/pages/settings_page.dart b/flutter/lib/mobile/pages/settings_page.dart
index f1f9bb39f..0aa417437 100644
--- a/flutter/lib/mobile/pages/settings_page.dart
+++ b/flutter/lib/mobile/pages/settings_page.dart
@@ -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'),
],
),
]),
diff --git a/src/lang/ar.rs b/src/lang/ar.rs
index b76cd496a..e09c94977 100644
--- a/src/lang/ar.rs
+++ b/src/lang/ar.rs
@@ -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();
}
diff --git a/src/lang/ca.rs b/src/lang/ca.rs
index 24f076992..ef2701f8b 100644
--- a/src/lang/ca.rs
+++ b/src/lang/ca.rs
@@ -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();
}
diff --git a/src/lang/cn.rs b/src/lang/cn.rs
index be78b6b98..417b0fc58 100644
--- a/src/lang/cn.rs
+++ b/src/lang/cn.rs
@@ -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();
}
diff --git a/src/lang/cs.rs b/src/lang/cs.rs
index 3ffa6aa00..11a39e92c 100644
--- a/src/lang/cs.rs
+++ b/src/lang/cs.rs
@@ -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();
}
diff --git a/src/lang/da.rs b/src/lang/da.rs
index d843fef2d..af277f450 100644
--- a/src/lang/da.rs
+++ b/src/lang/da.rs
@@ -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();
}
diff --git a/src/lang/de.rs b/src/lang/de.rs
index f78ab8fc6..624667066 100644
--- a/src/lang/de.rs
+++ b/src/lang/de.rs
@@ -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();
}
diff --git a/src/lang/el.rs b/src/lang/el.rs
index cba247bbd..7a79b5edb 100644
--- a/src/lang/el.rs
+++ b/src/lang/el.rs
@@ -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();
}
diff --git a/src/lang/en.rs b/src/lang/en.rs
index abe53325f..a9a8c2618 100644
--- a/src/lang/en.rs
+++ b/src/lang/en.rs
@@ -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();
}
diff --git a/src/lang/eo.rs b/src/lang/eo.rs
index 7066286d2..44d6b146f 100644
--- a/src/lang/eo.rs
+++ b/src/lang/eo.rs
@@ -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();
}
diff --git a/src/lang/es.rs b/src/lang/es.rs
index 8775bf181..1f0434988 100644
--- a/src/lang/es.rs
+++ b/src/lang/es.rs
@@ -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();
}
diff --git a/src/lang/fa.rs b/src/lang/fa.rs
index 17270d66c..388c1491d 100644
--- a/src/lang/fa.rs
+++ b/src/lang/fa.rs
@@ -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();
}
diff --git a/src/lang/fr.rs b/src/lang/fr.rs
index bf6c0186e..e0bda09ad 100644
--- a/src/lang/fr.rs
+++ b/src/lang/fr.rs
@@ -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();
}
diff --git a/src/lang/hu.rs b/src/lang/hu.rs
index 0a662739a..8680910b3 100644
--- a/src/lang/hu.rs
+++ b/src/lang/hu.rs
@@ -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();
}
diff --git a/src/lang/id.rs b/src/lang/id.rs
index 1238a0364..e20fdf05f 100644
--- a/src/lang/id.rs
+++ b/src/lang/id.rs
@@ -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();
}
diff --git a/src/lang/it.rs b/src/lang/it.rs
index 7abaab82c..9653ef167 100644
--- a/src/lang/it.rs
+++ b/src/lang/it.rs
@@ -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();
}
diff --git a/src/lang/ja.rs b/src/lang/ja.rs
index a95db4a0c..0bc9c42d3 100644
--- a/src/lang/ja.rs
+++ b/src/lang/ja.rs
@@ -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();
}
diff --git a/src/lang/ko.rs b/src/lang/ko.rs
index 765904792..dd93ca3f7 100644
--- a/src/lang/ko.rs
+++ b/src/lang/ko.rs
@@ -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();
}
diff --git a/src/lang/kz.rs b/src/lang/kz.rs
index 2e8c652b6..9571d23a1 100644
--- a/src/lang/kz.rs
+++ b/src/lang/kz.rs
@@ -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();
}
diff --git a/src/lang/lt.rs b/src/lang/lt.rs
index 7e24b2cba..0076be89f 100644
--- a/src/lang/lt.rs
+++ b/src/lang/lt.rs
@@ -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();
}
diff --git a/src/lang/lv.rs b/src/lang/lv.rs
index 2c6c0f2d2..eaaf25404 100644
--- a/src/lang/lv.rs
+++ b/src/lang/lv.rs
@@ -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();
}
diff --git a/src/lang/nb.rs b/src/lang/nb.rs
index b421a8efd..edcc62c58 100644
--- a/src/lang/nb.rs
+++ b/src/lang/nb.rs
@@ -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();
}
diff --git a/src/lang/nl.rs b/src/lang/nl.rs
index e65bc5fea..2fea853c6 100644
--- a/src/lang/nl.rs
+++ b/src/lang/nl.rs
@@ -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();
}
diff --git a/src/lang/pl.rs b/src/lang/pl.rs
index 91a0c9770..2d66c8d00 100644
--- a/src/lang/pl.rs
+++ b/src/lang/pl.rs
@@ -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();
}
diff --git a/src/lang/pt_PT.rs b/src/lang/pt_PT.rs
index aee10b47e..23245cb11 100644
--- a/src/lang/pt_PT.rs
+++ b/src/lang/pt_PT.rs
@@ -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();
}
diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs
index 589eb2afc..9ec9122cd 100644
--- a/src/lang/ptbr.rs
+++ b/src/lang/ptbr.rs
@@ -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();
}
diff --git a/src/lang/ro.rs b/src/lang/ro.rs
index 7ddfa95a2..153bdd2cd 100644
--- a/src/lang/ro.rs
+++ b/src/lang/ro.rs
@@ -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();
}
diff --git a/src/lang/ru.rs b/src/lang/ru.rs
index ccc83cde3..0b2ec8b38 100644
--- a/src/lang/ru.rs
+++ b/src/lang/ru.rs
@@ -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();
}
diff --git a/src/lang/sk.rs b/src/lang/sk.rs
index 1f9274005..73787271f 100644
--- a/src/lang/sk.rs
+++ b/src/lang/sk.rs
@@ -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();
}
diff --git a/src/lang/sl.rs b/src/lang/sl.rs
index ae8ddfa77..0607af020 100755
--- a/src/lang/sl.rs
+++ b/src/lang/sl.rs
@@ -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();
}
diff --git a/src/lang/sq.rs b/src/lang/sq.rs
index 1ada6a9ab..8d59faf35 100644
--- a/src/lang/sq.rs
+++ b/src/lang/sq.rs
@@ -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();
}
diff --git a/src/lang/sr.rs b/src/lang/sr.rs
index 65f85c4f7..7a9157cac 100644
--- a/src/lang/sr.rs
+++ b/src/lang/sr.rs
@@ -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();
}
diff --git a/src/lang/sv.rs b/src/lang/sv.rs
index 8f6462ae4..2a06e8b10 100644
--- a/src/lang/sv.rs
+++ b/src/lang/sv.rs
@@ -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();
}
diff --git a/src/lang/template.rs b/src/lang/template.rs
index d7a5b4227..6ab55c85a 100644
--- a/src/lang/template.rs
+++ b/src/lang/template.rs
@@ -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();
}
diff --git a/src/lang/th.rs b/src/lang/th.rs
index bcf7837d0..15eec7219 100644
--- a/src/lang/th.rs
+++ b/src/lang/th.rs
@@ -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();
}
diff --git a/src/lang/tr.rs b/src/lang/tr.rs
index 54cd1e4f3..3be48a83b 100644
--- a/src/lang/tr.rs
+++ b/src/lang/tr.rs
@@ -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();
}
diff --git a/src/lang/tw.rs b/src/lang/tw.rs
index f4a3611a0..8bf85f7cb 100644
--- a/src/lang/tw.rs
+++ b/src/lang/tw.rs
@@ -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();
}
diff --git a/src/lang/ua.rs b/src/lang/ua.rs
index 3327761f5..aa47e4334 100644
--- a/src/lang/ua.rs
+++ b/src/lang/ua.rs
@@ -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();
}
diff --git a/src/lang/vn.rs b/src/lang/vn.rs
index f98a8f74a..d16b18224 100644
--- a/src/lang/vn.rs
+++ b/src/lang/vn.rs
@@ -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();
}
diff --git a/src/ui_session_interface.rs b/src/ui_session_interface.rs
index fd9802986..4c5785640 100644
--- a/src/ui_session_interface.rs
+++ b/src/ui_session_interface.rs
@@ -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