focus-based window manager

This commit is contained in:
Devaev Maxim
2018-12-01 12:56:36 +03:00
parent 5f7834724a
commit a6d4545baf
9 changed files with 143 additions and 110 deletions

View File

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