From a2890fa548e6935a1a9f33212401a3a0d35881a5 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Mon, 14 Jun 2021 15:29:36 +0800 Subject: [PATCH] https://github.com/rustdesk/rustdesk/issues/35 --- src/ui/header.tis | 19 ++++++++++++++++++- src/ui/remote.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/ui/header.tis b/src/ui/header.tis index 96b722efb..2c3f39131 100644 --- a/src/ui/header.tis +++ b/src/ui/header.tis @@ -135,8 +135,13 @@ class Header: Reactor.Component { return
  • Transfer File
  • -
  • TCP Tunneling
  • +
  • TCP Tunneling
  • +
    {keyboard_enabled && (pi.platform == "Linux" || pi.sas_enabled) ?
  • Insert Ctrl + Alt + Del
  • : ""} +
  • Insert Ctrl + Space
  • +
  • Insert Alt + Tab
  • + {false &&
  • Insert Win/Super + ...
  • } +
    {keyboard_enabled ?
  • Insert Lock
  • : ""} {false && pi.platform == "Windows" ?
  • Block user input
  • : ""} {handler.support_refresh() ?
  • Refresh
  • : ""} @@ -223,6 +228,18 @@ class Header: Reactor.Component { event click $(#ctrl-alt-del) { handler.ctrl_alt_del(); } + + event click $(#alt-tab) { + handler.alt_tab(); + } + + event click $(#ctrl-space) { + handler.ctrl_space(); + } + + event click $(#super-x) { + handler.super_x(); + } event click $(#lock-screen) { handler.lock_screen(); diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 17e6c8af1..b4dd201f1 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -63,6 +63,7 @@ pub struct Handler { id: String, args: Vec, lc: Arc>, + super_on: bool, } impl Deref for Handler { @@ -153,6 +154,9 @@ impl sciter::EventHandler for Handler { fn send_mouse(i32, i32, i32, bool, bool, bool, bool); fn key_down_or_up(bool, String, i32, bool, bool, bool, bool, bool); fn ctrl_alt_del(); + fn ctrl_space(); + fn alt_tab(); + fn super_x(); fn transfer_file(); fn tunnel(); fn lock_screen(); @@ -813,6 +817,20 @@ impl Handler { } } + fn super_x(&mut self) { + self.super_on = true; + } + + fn ctrl_space(&mut self) { + let key = "VK_SPACE".to_owned(); + self.key_down_or_up(3, key, 0, false, true, false, false, false); + } + + fn alt_tab(&mut self) { + let key = "VK_TAB".to_owned(); + self.key_down_or_up(3, key, 0, true, false, false, false, false); + } + fn lock_screen(&mut self) { let lock = "LOCK_SCREEN".to_owned(); self.key_down_or_up(1, lock, 0, false, false, false, false, false); @@ -860,6 +878,15 @@ impl Handler { extended, ); + let mut command = command; + if self.super_on { + command = true; + } + + if down_or_up == 0 { + self.super_on = false; + } + let mut name = name; if extended {