Fixed pikvm/pikvm#307: mute hid switch

This commit is contained in:
Devaev Maxim 2021-05-19 09:11:44 +03:00
parent ac109043ed
commit cd80286414
4 changed files with 14 additions and 2 deletions

View File

@ -206,6 +206,16 @@
</td>
</table>
</div>
<hr>
<table class="kv">
<td>Mute HID input events:</td>
<td align="right">
<div class="switch-box">
<input type="checkbox" id="hid-mute-switch">
<label for="hid-mute-switch"><span class="switch-inner"></span><span class="switch"></span></label>
</div>
</td>
</table>
<hr>
<div class="feature-disabled" id="v3-usb-breaker">
<table class="kv">

View File

@ -55,6 +55,8 @@ li(class="right")
hr
+menu_switch("hid-connect-switch", "Connect HID to Server", true, true)
hr
+menu_switch("hid-mute-switch", "Mute HID input events", true, false)
hr
div(id="v3-usb-breaker" class="feature-disabled")
table(class="kv")
td Connect main USB to Server:

View File

@ -149,7 +149,7 @@ export function Keyboard(record_callback) {
"event_type": "key",
"event": {"key": code, "state": state},
};
if (__ws) {
if (__ws && !$("hid-mute-switch").checked) {
__ws.send(JSON.stringify(event));
}
__record_callback(event);

View File

@ -301,7 +301,7 @@ export function Mouse(get_resolution_callback, record_callback) {
var __sendEvent = function(event_type, event) {
event = {"event_type": event_type, "event": event};
if (__ws) {
if (__ws && !$("hid-mute-switch").checked) {
__ws.send(JSON.stringify(event));
}
__record_callback(event);