summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mannehed <samuel@cendio.se>2019-10-28 10:45:08 +0100
committerGitHub <noreply@github.com>2019-10-28 10:45:08 +0100
commit1dd1bf0306c12b768af4238f0b7ea68feaac9d8f (patch)
tree88928da470be1e0e267e5f07c90fdbb15d044c0f
parent0c4b3e802fe4415903467a52ccb1f630c318b385 (diff)
parenta5aa8e12822a0b83f2521ed04911a03f3f33c192 (diff)
downloadnovnc-1dd1bf0306c12b768af4238f0b7ea68feaac9d8f.tar.gz
Merge pull request #1312 from samhed/master
Fix so that you can use the keyboard after using the extra keys
-rw-r--r--app/ui.js29
1 files changed, 21 insertions, 8 deletions
diff --git a/app/ui.js b/app/ui.js
index 0148a44..15698b9 100644
--- a/app/ui.js
+++ b/app/ui.js
@@ -1503,20 +1503,20 @@ const UI = {
},
sendEsc() {
- UI.rfb.sendKey(KeyTable.XK_Escape, "Escape");
+ UI.sendKey(KeyTable.XK_Escape, "Escape");
},
sendTab() {
- UI.rfb.sendKey(KeyTable.XK_Tab);
+ UI.sendKey(KeyTable.XK_Tab, "Tab");
},
toggleCtrl() {
const btn = document.getElementById('noVNC_toggle_ctrl_button');
if (btn.classList.contains("noVNC_selected")) {
- UI.rfb.sendKey(KeyTable.XK_Control_L, "ControlLeft", false);
+ UI.sendKey(KeyTable.XK_Control_L, "ControlLeft", false);
btn.classList.remove("noVNC_selected");
} else {
- UI.rfb.sendKey(KeyTable.XK_Control_L, "ControlLeft", true);
+ UI.sendKey(KeyTable.XK_Control_L, "ControlLeft", true);
btn.classList.add("noVNC_selected");
}
},
@@ -1524,10 +1524,10 @@ const UI = {
toggleWindows() {
const btn = document.getElementById('noVNC_toggle_windows_button');
if (btn.classList.contains("noVNC_selected")) {
- UI.rfb.sendKey(KeyTable.XK_Super_L, "MetaLeft", false);
+ UI.sendKey(KeyTable.XK_Super_L, "MetaLeft", false);
btn.classList.remove("noVNC_selected");
} else {
- UI.rfb.sendKey(KeyTable.XK_Super_L, "MetaLeft", true);
+ UI.sendKey(KeyTable.XK_Super_L, "MetaLeft", true);
btn.classList.add("noVNC_selected");
}
},
@@ -1535,16 +1535,29 @@ const UI = {
toggleAlt() {
const btn = document.getElementById('noVNC_toggle_alt_button');
if (btn.classList.contains("noVNC_selected")) {
- UI.rfb.sendKey(KeyTable.XK_Alt_L, "AltLeft", false);
+ UI.sendKey(KeyTable.XK_Alt_L, "AltLeft", false);
btn.classList.remove("noVNC_selected");
} else {
- UI.rfb.sendKey(KeyTable.XK_Alt_L, "AltLeft", true);
+ UI.sendKey(KeyTable.XK_Alt_L, "AltLeft", true);
btn.classList.add("noVNC_selected");
}
},
sendCtrlAltDel() {
UI.rfb.sendCtrlAltDel();
+ // See below
+ UI.rfb.focus();
+ UI.idleControlbar();
+ },
+
+ sendKey(keysym, code, down) {
+ UI.rfb.sendKey(keysym, code, down);
+ // move focus to the screen in order to be able to
+ // use the keyboard right after these extra keys
+ UI.rfb.focus();
+ // fade out the controlbar to highlight that
+ // the focus has been moved to the screen
+ UI.idleControlbar();
},
/* ------^-------