From 733a4d42faa3a433d65b8531da2485d5fa50acee Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Thu, 4 Jan 2018 19:11:41 -0500 Subject: [PATCH] GUACAMOLE-113: Add object to clientController to keep track of substituted keys. --- .../client/controllers/clientController.js | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index e9527479a..f38ada4cc 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -274,6 +274,14 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams */ var keysCurrentlyPressed = {}; + /** + * Map of all substituted key presses. If one key is pressed in place of another + * the value of the substituted key is stored in an object with the keysym of + * the original key. + * @type Object. + */ + var substituteKeysPressed = {}; + /** * Map of all currently pressed keys (by keysym) to the clipboard contents * received from the remote desktop while those keys were pressed. All keys @@ -543,6 +551,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams ) { event.preventDefault(); delete keysCurrentlyPressed[keysym]; + substituteKeysPressed[keysym] = DEL_KEY; $rootScope.$broadcast('guacSyntheticKeydown', DEL_KEY); } @@ -560,19 +569,18 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams if (clipboardData && !$scope.menu.shown) clipboardService.setLocalClipboard(clipboardData); - if (END_KEYS[keysym] && - !_.isEmpty(_.pick(ALT_KEYS, currentKeysPressedKeys)) && - !_.isEmpty(_.pick(CTRL_KEYS, currentKeysPressedKeys)) - ) { - + // Deal with substitute key presses + if (substituteKeysPressed[keysym]) { event.preventDefault(); - $rootScope.$broadcast('guacSyntheticKeyup', DEL_KEY); - + delete substituteKeysPressed[keysym]; + $rootScope.$broadcast('guacSyntheticKeyup', substituteKeysPressed[keysym]); } // Mark key as released - delete clipboardDataFromKey[keysym]; - delete keysCurrentlyPressed[keysym]; + else { + delete clipboardDataFromKey[keysym]; + delete keysCurrentlyPressed[keysym]; + } });