diff options
author | Devaev Maxim <[email protected]> | 2020-12-03 10:04:06 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-12-03 10:04:06 +0300 |
commit | b9cf8f974dc126f7760fea9657e407e753ffe7d7 (patch) | |
tree | 52b73a562181f7ce09764f489f694d3746e22412 /web/share/js/kvm/mouse.js | |
parent | be6b81af9c338430d018bf544f117d683a555814 (diff) |
separate state for hid offline
Diffstat (limited to 'web/share/js/kvm/mouse.js')
-rw-r--r-- | web/share/js/kvm/mouse.js | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/web/share/js/kvm/mouse.js b/web/share/js/kvm/mouse.js index 5aa803d9..0fdfdc22 100644 --- a/web/share/js/kvm/mouse.js +++ b/web/share/js/kvm/mouse.js @@ -77,8 +77,12 @@ export function Mouse(record_callback) { __updateOnlineLeds(); }; - self.setState = function(state) { - __online = state.online; + self.setState = function(state, hid_online, hid_busy) { + if (!hid_online) { + __online = null; + } else { + __online = (state.online && !hid_busy); + } if (!__absolute && state.absolute && __isRelativeCaptured()) { document.exitPointerLock(); } @@ -101,27 +105,30 @@ export function Mouse(record_callback) { }; var __updateOnlineLeds = function() { - let captured; + let is_captured; if (__absolute) { - captured = (__stream_hovered || tools.browser.is_ios); + is_captured = (__stream_hovered || tools.browser.is_ios); } else { - captured = __isRelativeCaptured(); + is_captured = __isRelativeCaptured(); } let led = "led-gray"; let title = "Mouse free"; if (__ws) { - if (__online) { - if (captured) { + if (__online === null) { + led = "led-red"; + title = (is_captured ? "Mouse captured, HID offline" : "Mouse free, HID offline"); + } else if (__online) { + if (is_captured) { led = "led-green"; title = "Mouse captured"; } } else { led = "led-yellow"; - title = (captured ? "Mouse captured, HID offline" : "Mouse free, HID offline"); + title = (is_captured ? "Mouse captured, inactive/busy" : "Mouse free, inactive/busy"); } } else { - if (captured) { + if (is_captured) { title = "Mouse captured, Pi-KVM offline"; } } |