mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 11:16:47 +00:00
fix(console): a held key let go on the keyboard is let go in the VM
A key held from the menu (Hold Ctrl, Alt or Windows) is the same key as the keyboard's left Ctrl, Alt or Windows key. Pressing and releasing that key on the screen let the VM's key go, while the menu still showed it held. And when the key went down outside the screen (in the Clipboard dialog) and came up on it, noVNC sent no release, as it had not seen the key go down. The release of that key where noVNC takes keys (the screen, the touch keyboard) now lets a held key go itself, and clears the menu's mark. A release elsewhere reaches no VM and changes nothing.
This commit is contained in:
parent
bfa0fc9fe5
commit
2e2dd9849d
1 changed files with 13 additions and 0 deletions
|
|
@ -69,6 +69,19 @@ export function bindSendKeys(rfb) {
|
|||
}
|
||||
});
|
||||
}
|
||||
// the same key on the keyboard, where noVNC takes keys (the screen, the
|
||||
// touch keyboard): its release lets the held key go. Sent here, seen
|
||||
// before noVNC (which keeps the event to itself): noVNC sends no release
|
||||
// of a key it did not see go down, as when it went down in a dialog.
|
||||
for (const target of [document.getElementById('screen'), document.getElementById('keyboard_input')]) {
|
||||
target.addEventListener('keyup', (e) => {
|
||||
for (const [id, key] of HOLDS) {
|
||||
if (e.code === key.code && document.getElementById(id).getAttribute('aria-pressed') === 'true') {
|
||||
hold(rfb, id, key, false);
|
||||
}
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
|
||||
// the Fullscreen item; in full screen the page also takes the keys the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue