From 68135beedd40c2654f2d41bba821165ddf0d09d7 Mon Sep 17 00:00:00 2001 From: Matt McClaskey Date: Tue, 29 Aug 2023 14:03:58 -0400 Subject: [PATCH] sync client and server down keys on mouse down too (#76) Co-authored-by: mattmcclaskey --- core/input/keyboard.js | 4 ++-- core/rfb.js | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/input/keyboard.js b/core/input/keyboard.js index e551c6f0..db3c97ab 100644 --- a/core/input/keyboard.js +++ b/core/input/keyboard.js @@ -58,7 +58,7 @@ export default class Keyboard { // ===== PRIVATE METHODS ===== - _clearKeysDown(event) { + clearKeysDown(event) { // On some Operating systems, the browser will lose key up events when a shortcut key combination triggers something // on the OS that is outside the scope of the browser. For example, MacOS Cmd+Shift+Ctrl+4 brings up a screen capture // tool and the browser only recieves some of the key down events, but not the key up events. This leaves the server @@ -269,7 +269,7 @@ export default class Keyboard { _handleKeyDown(e) { const code = this._getKeyCode(e); let keysym = KeyboardUtil.getKeysym(e); - this._clearKeysDown(e); + this.clearKeysDown(e); if (this._isIMEInteraction(e)) { //skip event if IME related diff --git a/core/rfb.js b/core/rfb.js index 4bfac514..b2ed01f5 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -1655,6 +1655,9 @@ export default class RFB extends EventTargetMixin { this._keyboard._sendKeyEvent(KeyTable.XK_Control_L, "ControlLeft", true); } + // Ensure keys down are synced between client and server + this._keyboard.clearKeysDown(ev); + this._handleMouseButton(pos.x, pos.y, true, xvncButtonToMask(mappedButton)); break;