diff options
author | Devaev Maxim <[email protected]> | 2018-07-27 11:29:44 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-07-27 11:29:44 +0300 |
commit | d2da0829b98e9aca474867f5ce9d5929f8b234af (patch) | |
tree | b0902959494cf6a50c4eb3b671c642f5c9b2a197 /kvmd/web/js/keyboard.js | |
parent | b7d933b6ce128d466a9e0e031ead9e083c370374 (diff) |
release keys when window loosing focus
Diffstat (limited to 'kvmd/web/js/keyboard.js')
-rw-r--r-- | kvmd/web/js/keyboard.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/kvmd/web/js/keyboard.js b/kvmd/web/js/keyboard.js index 13b96561..4ea38e5b 100644 --- a/kvmd/web/js/keyboard.js +++ b/kvmd/web/js/keyboard.js @@ -24,13 +24,17 @@ var keyboard = new function() { }; this.setSocket = function(ws) { + keyboard.releaseAll(); + __ws = ws; + $("hid-keyboard-led").className = (ws ? "led-on" : "led-off"); + }; + + this.releaseAll = function(ws) { __keys.concat(__modifiers).forEach(function(el_key) { if (__isActive(el_key)) { keyboard.fireEvent(el_key.id, false); } }); - __ws = ws; - $("hid-keyboard-led").className = (ws ? "led-on" : "led-off"); }; this.fireEvent = function(code, state) { |