hid: led-yellow preferred

This commit is contained in:
Devaev Maxim 2019-02-08 03:02:58 +03:00
parent 686f2a8bd4
commit e22426155d
2 changed files with 36 additions and 22 deletions

View File

@ -72,24 +72,30 @@ function Keyboard() {
};
var __updateLeds = function() {
tools.debug("Keyboard: update leds");
if (
__ws && (
$("stream-window").classList.contains("window-active")
|| $("keyboard-window").classList.contains("window-active")
)
) {
var is_captured = (
$("stream-window").classList.contains("window-active")
|| $("keyboard-window").classList.contains("window-active")
);
var led = "led-gray";
var title = "Keyboard free";
if (__ws) {
if (__ok) {
$("hid-keyboard-led").className = "led-green";
$("hid-keyboard-led").title = "Keyboard captured";
if (is_captured) {
led = "led-green";
title = "Keyboard captured";
}
} else {
$("hid-keyboard-led").className = "led-yellow";
$("hid-keyboard-led").title = "Keyboard captured, HID offline";
led = "led-yellow";
title = (is_captured ? "Keyboard captured, HID offline" : "Keyboard free, HID offline");
}
} else {
$("hid-keyboard-led").className = "led-gray";
$("hid-keyboard-led").title = "Keyboard free";
if (is_captured) {
title = "Keyboard captured, Pi-KVM offline";
}
}
$("hid-keyboard-led").className = led;
$("hid-keyboard-led").title = title;
};
var __keyboardHandler = function(event, state) {

View File

@ -61,19 +61,27 @@ function Mouse() {
};
var __updateLeds = function() {
if (__ws && (__stream_hovered || tools.browser.is_ios)) {
// Mouse is always available on iOS via touchscreen
if (__ok) {
$("hid-mouse-led").className = "led-green";
$("hid-mouse-led").title = "Mouse tracked";
var is_captured = (__stream_hovered || tools.browser.is_ios);
var led = "led-gray";
var title = "Mouse free";
if (__ws) {
if (__ok) {
if (is_captured) {
led = "led-green";
title = "Mouse captured";
}
} else {
$("hid-mouse-led").className = "led-yellow";
$("hid-mouse-led").title = "Mouse tracked, HID offline";
led = "led-yellow";
title = (is_captured ? "Mouse captured, HID offline" : "Mouse free, HID offline");
}
} else {
$("hid-mouse-led").className = "led-gray";
$("hid-mouse-led").title = "Mouse free";
if (is_captured) {
title = "Mouse captured, Pi-KVM offline";
}
}
$("hid-mouse-led").className = led;
$("hid-mouse-led").title = title;
};
var __buttonHandler = function(event, state) {