sync client and server down keys on mouse down too (#76)

Co-authored-by: mattmcclaskey <matt@kasmweb.com>
This commit is contained in:
Matt McClaskey 2023-08-29 14:03:58 -04:00 committed by GitHub
parent 2b7e3321ae
commit 68135beedd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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;