diff options
author | Maxim Devaev <[email protected]> | 2022-08-21 15:35:11 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2022-08-21 15:35:11 +0300 |
commit | 7bd690b4db5a2f075c2b13432a983dad8fc86622 (patch) | |
tree | 653983d556d11da4958d63e3cd38eacc177334e1 /web/share/js/kvm/keyboard.js | |
parent | 614d02a74d6e2816dc620d4f04ec64cd9a008183 (diff) |
refactoring
Diffstat (limited to 'web/share/js/kvm/keyboard.js')
-rw-r--r-- | web/share/js/kvm/keyboard.js | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/web/share/js/kvm/keyboard.js b/web/share/js/kvm/keyboard.js index e1368f3e..0cdfafda 100644 --- a/web/share/js/kvm/keyboard.js +++ b/web/share/js/kvm/keyboard.js @@ -33,10 +33,14 @@ export function Keyboard(__recordWsEvent) { var __online = true; var __keypad = null; - var __fix_mac_cmd = false; var __init__ = function() { - __keypad = new Keypad("div#keyboard-window", __sendKey); + let fix_mac_cmd = tools.browser.is_mac; + if (fix_mac_cmd) { + tools.info("Keyboard: enabled Fix-Mac-CMD"); + } + + __keypad = new Keypad("div#keyboard-window", __sendKey, fix_mac_cmd); $("hid-keyboard-led").title = "Keyboard free"; @@ -52,13 +56,6 @@ export function Keyboard(__recordWsEvent) { window.addEventListener("focusin", __updateOnlineLeds); window.addEventListener("focusout", __updateOnlineLeds); - - if (tools.browser.is_mac) { - // https://bugs.chromium.org/p/chromium/issues/detail?id=28089 - // https://bugzilla.mozilla.org/show_bug.cgi?id=1299553 - tools.info("Keyboard: enabled Fix-Mac-CMD"); - __fix_mac_cmd = true; - } }; /************************************************************************/ @@ -135,9 +132,7 @@ export function Keyboard(__recordWsEvent) { event.preventDefault(); } if (!event.repeat) { - // https://bugs.chromium.org/p/chromium/issues/detail?id=28089 - // https://bugzilla.mozilla.org/show_bug.cgi?id=1299553 - __keypad.emit(event.code, state, __fix_mac_cmd); + __keypad.emit(event.code, state); } }; |