From 9ff3bd74c9c8f5c8cf6c14a0bebe6c0bcff1ec6f Mon Sep 17 00:00:00 2001 From: open-trade Date: Thu, 3 Feb 2022 21:26:35 +0800 Subject: [PATCH] modify input key --- src/connection.ts | 17 ++++++++++++++++- src/globals.js | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/connection.ts b/src/connection.ts index 3337d3505..c0e4138ba 100644 --- a/src/connection.ts +++ b/src/connection.ts @@ -450,6 +450,8 @@ export default class Connection { inputKey( name: string, + down: boolean, + press: boolean, alt: Boolean, ctrl: Boolean, shift: Boolean, @@ -457,7 +459,20 @@ export default class Connection { ) { const key_event = mapKey(name); if (!key_event) return; - key_event.press = true; + if (alt && name == 'VK_MENU') { + alt = false; + } + if (ctrl && name == 'VK_CONTROL') { + ctrl = false; + } + if (shift && name == 'VK_SHIFT') { + shift = false; + } + if (command && name == 'Meta') { + command = false; + } + key_event.down = down; + key_event.press = press; key_event.modifiers = this.getMod(alt, ctrl, shift, command); this._ws?.sendMessage({ key_event }); } diff --git a/src/globals.js b/src/globals.js index b0721f18c..f67703cd1 100644 --- a/src/globals.js +++ b/src/globals.js @@ -181,7 +181,7 @@ window.setByName = (name, value) => { break; case 'input_key': value = JSON.parse(value); - curConn.inputKey(value.name, value.alt || false, value.ctrl || false, value.shift || false, value.command || false); + curConn.inputKey(value.name, value.down || false, value.press || false, value.alt || false, value.ctrl || false, value.shift || false, value.command || false); break; case 'input_string': curConn.inputString(value);