mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUACAMOLE-724: Allow keyboard interaction with client notifications.
This commit is contained in:
@@ -407,6 +407,23 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevents the default behavior of the given AngularJS event if a
|
||||||
|
* notification is currently shown and the client is focused.
|
||||||
|
*
|
||||||
|
* @param {event} e
|
||||||
|
* The AngularJS event to selectively prevent.
|
||||||
|
*/
|
||||||
|
var preventDefaultDuringNotification = function preventDefaultDuringNotification(e) {
|
||||||
|
if ($scope.status && $scope.client.clientProperties.focused)
|
||||||
|
e.preventDefault();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Block internal handling of key events (by the client) if a
|
||||||
|
// notification is visible
|
||||||
|
$scope.$on('guacBeforeKeydown', preventDefaultDuringNotification);
|
||||||
|
$scope.$on('guacBeforeKeyup', preventDefaultDuringNotification);
|
||||||
|
|
||||||
}];
|
}];
|
||||||
|
|
||||||
return directive;
|
return directive;
|
||||||
|
@@ -163,9 +163,8 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
|
|||||||
// Broadcast keydown events
|
// Broadcast keydown events
|
||||||
keyboard.onkeydown = function onkeydown(keysym) {
|
keyboard.onkeydown = function onkeydown(keysym) {
|
||||||
|
|
||||||
// Do not handle key events if not logged in or if a notification is
|
// Do not handle key events if not logged in
|
||||||
// shown
|
if ($scope.applicationState !== ApplicationState.READY)
|
||||||
if ($scope.applicationState !== ApplicationState.READY || guacNotification.getStatus())
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Warn of pending keydown
|
// Warn of pending keydown
|
||||||
@@ -184,7 +183,7 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
|
|||||||
|
|
||||||
// Do not handle key events if not logged in or if a notification is
|
// Do not handle key events if not logged in or if a notification is
|
||||||
// shown
|
// shown
|
||||||
if ($scope.applicationState !== ApplicationState.READY || guacNotification.getStatus())
|
if ($scope.applicationState !== ApplicationState.READY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Warn of pending keyup
|
// Warn of pending keyup
|
||||||
|
Reference in New Issue
Block a user