summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/share/js/kvm/hid.js4
-rw-r--r--web/share/js/kvm/keyboard.js15
-rw-r--r--web/share/js/kvm/mouse.js25
3 files changed, 29 insertions, 15 deletions
diff --git a/web/share/js/kvm/hid.js b/web/share/js/kvm/hid.js
index 75e77d7d..580a5417 100644
--- a/web/share/js/kvm/hid.js
+++ b/web/share/js/kvm/hid.js
@@ -153,8 +153,8 @@ export function Hid() {
wm.switchEnabled($("hid-mouse-squash-checkbox"), (has_relative_squash && !state.busy));
if (state) {
- __keyboard.setState(state.keyboard);
- __mouse.setState(state.mouse);
+ __keyboard.setState(state.keyboard, state.online, state.busy);
+ __mouse.setState(state.mouse, state.online, state.busy);
}
};
diff --git a/web/share/js/kvm/keyboard.js b/web/share/js/kvm/keyboard.js
index e919a840..db024917 100644
--- a/web/share/js/kvm/keyboard.js
+++ b/web/share/js/kvm/keyboard.js
@@ -73,8 +73,12 @@ export function Keyboard(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);
+ }
__updateOnlineLeds();
for (let led of ["caps", "scroll", "num"]) {
@@ -107,14 +111,17 @@ export function Keyboard(record_callback) {
let title = "Keyboard free";
if (__ws) {
- if (__online) {
+ if (__online === null) {
+ led = "led-red";
+ title = (is_captured ? "Keyboard captured, HID offline" : "Keyboard free, HID offline");
+ } else if (__online) {
if (is_captured) {
led = "led-green";
title = "Keyboard captured";
}
} else {
led = "led-yellow";
- title = (is_captured ? "Keyboard captured, HID offline" : "Keyboard free, HID offline");
+ title = (is_captured ? "Keyboard captured, inactive/busy" : "Keyboard free, inactive/busy");
}
} else {
if (is_captured) {
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";
}
}