diff options
author | Devaev Maxim <[email protected]> | 2018-12-01 12:56:36 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-12-01 12:56:36 +0300 |
commit | a6d4545bafe750f894654fa3cddbfe15a89e6e6e (patch) | |
tree | 14534ad82d798575904813134f4d2360f9c024b1 /web/js/kvm/keyboard.js | |
parent | 5f7834724a48f28539a66b481772201f00147b31 (diff) |
focus-based window manager
Diffstat (limited to 'web/js/kvm/keyboard.js')
-rw-r--r-- | web/js/kvm/keyboard.js | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/web/js/kvm/keyboard.js b/web/js/kvm/keyboard.js index 273038fa..3c821406 100644 --- a/web/js/kvm/keyboard.js +++ b/web/js/kvm/keyboard.js @@ -21,9 +21,8 @@ function Keyboard() { $("stream-window").onfocus = __updateLeds; $("stream-window").onblur = __updateLeds; - window.addEventListener("focus", __updateLeds); - window.addEventListener("pagehide", __updateLeds); - window.addEventListener("blur", __updateLeds); + window.addEventListener("focusin", __updateLeds); + window.addEventListener("focusout", __updateLeds); Array.prototype.forEach.call($$("key"), function(el_key) { tools.setOnDown(el_key, () => __clickHandler(el_key, true)); @@ -67,14 +66,9 @@ function Keyboard() { }; var __updateLeds = function() { - tools.info("Update leds"); + tools.debug("Keyboard: update leds"); if ( - __ws - && ( - document.activeElement === $("stream-window") - || document.activeElement === $("keyboard-window") - ) - && ( + __ws && ( $("stream-window").classList.contains("window-active") || $("keyboard-window").classList.contains("window-active") ) |