From 28b03355817d60062995ad1b966bcc3c8919f06d Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 30 Jan 2022 11:38:25 +0100 Subject: [PATCH] reenable keyboardlock in fullscreenchange event --- .../src/app/client/services/guacFullscreen.js | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/guacamole/src/main/frontend/src/app/client/services/guacFullscreen.js b/guacamole/src/main/frontend/src/app/client/services/guacFullscreen.js index bf933ad980..2d053e41a8 100644 --- a/guacamole/src/main/frontend/src/app/client/services/guacFullscreen.js +++ b/guacamole/src/main/frontend/src/app/client/services/guacFullscreen.js @@ -52,23 +52,20 @@ angular.module('client').factory('guacFullscreen', ['$injector', // check is browser is in fullscreen mode (may have failed in step above) // if so additionally set keyboard lock mode to prevent execution of special keys // on local os (e.g. Win key, functions keys like F11(= default kex for browser fullsceen mode)) - if(service.isInFullscreenMode())navigator.keyboard.lock(); - else navigator.keyboard.unlock(); + } } - // attach to fullscreenevent and set keyboard lock - // this is done by event, to - // document.addEventListener('fullscreenchange', () => { + //attach to fullscreenevent and set keyboard lock + //this is done by fullscreenchange event, to prevent browser errors + // (running this immediately after setting fullscreen throws errors) + document.addEventListener('fullscreenchange', () => { - // if (navigator.keyboard){ - // if(service.isInFullscreenMode()){ - - // }else{ - - // } - // } - // }) + if (navigator.keyboard){ + if(service.isInFullscreenMode())navigator.keyboard.lock(); + else navigator.keyboard.unlock(); + } + }) return service; }