Merge patch branch changes to main

This commit is contained in:
Virtually Nick committed 2025-06-02 13:57:44 -04:00
commit 4dd4209c2a
1 file changed
+16 -3
@@ -36,9 +36,9 @@ angular.module('client').factory('guacFullscreen', ['$injector',
service.setFullscreenMode = function setFullscreenMode(state) {
if (document.fullscreenEnabled) {
if (state && !service.isInFullscreenMode())
document.documentElement.requestFullscreen().then(navigator.keyboard.lock());
document.documentElement.requestFullscreen();
else if (!state && service.isInFullscreenMode())
document.exitFullscreen().then(navigator.keyboard.unlock());
document.exitFullscreen();
}
}
@@ -50,6 +50,19 @@ angular.module('client').factory('guacFullscreen', ['$injector',
service.setFullscreenMode(false);
}
// If the browser supports keyboard lock, lock the keyboard when entering
// fullscreen mode and unlock it when exiting fullscreen mode.
if (navigator.keyboard?.lock) {
document.addEventListener('fullscreenchange', () => {
if (document.fullscreenElement) {
navigator.keyboard.lock();
return;
}
navigator.keyboard.unlock();
});
}
return service;
}]);
}]);