From 6a747d116f84fe55a4b1c6c4496b74879e54bde6 Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Thu, 23 Mar 2017 11:56:27 -0400 Subject: [PATCH 1/9] GUACAMOLE-113: Capture Ctrl-Alt-End keypress in order to do something useful with it. --- .../client/controllers/clientController.js | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index 88cfaa08f..86f6c1a18 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -72,7 +72,9 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams ALT_KEYS = {0xFFE9 : true, 0xFFEA : true, 0xFE03 : true, 0xFFE7 : true, 0xFFE8 : true}, CTRL_KEYS = {0xFFE3 : true, 0xFFE4 : true}, + END_KEYS = {0xFF57 : true, 0xFFB1 : true}, MENU_KEYS = angular.extend({}, SHIFT_KEYS, ALT_KEYS, CTRL_KEYS); + CAD_KEYS = angular.extend({}, ALT_KEYS, CTRL_KEYS, END_KEYS); /** * All client error codes handled and passed off for translation. Any error @@ -288,6 +290,16 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams return true; } + function checkCADHotkeyActive() { + for(var keysym in keysCurrentlyPressed) { + if(!CAD_KEYS[keysym]) { + return false; + } + } + + return true; + } + // Hide menu when the user swipes from the right $scope.menuDrag = function menuDrag(inProgress, startX, startY, currentX, currentY, deltaX, deltaY) { @@ -495,12 +507,12 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams // Record key as pressed keysCurrentlyPressed[keysym] = true; + var currentKeysPressedKeys = Object.keys(keysCurrentlyPressed); /* * If only menu keys are pressed, and we have one keysym from each group, * and one of the keys is being released, show the menu. */ if(checkMenuModeActive()) { - var currentKeysPressedKeys = Object.keys(keysCurrentlyPressed); // Check that there is a key pressed for each of the required key classes if(!_.isEmpty(_.pick(SHIFT_KEYS, currentKeysPressedKeys)) && @@ -522,6 +534,26 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams } } + if(checkCADHotkeyActive()) { + + // Check that there is a key pressed for each of the required key classes + if(!_.isEmpty(_.pick(ALT_KEYS, currentKeysPressedKeys)) && + !_.isEmpty(_.pick(CTRL_KEYS, currentKeysPressedKeys)) && + !_.isEmpty(_.pick(END_KEYS, currentKeysPressedKeys)) + ) { + + // Don't send this key event through to the client + event.preventDefault(); + + // Log the event + console.log('We should trigger Ctrl-Alt-Delete here.'); + + // Reset the keys pressed + keysCurrentlyPressed = {}; + keyboard.reset(); + } + } + }); // Update pressed keys as they are released, synchronizing the clipboard From d6e9a02c43b2cb81c77e5e63121f4d57e93a58b5 Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Mon, 17 Jul 2017 15:41:49 -0400 Subject: [PATCH 2/9] GUACAMOLE-113: Send through Ctrl-Alt-Delete when hotkey Ctrl-Alt-End is pressed. --- .../client/controllers/clientController.js | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index 86f6c1a18..6c80039aa 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -31,6 +31,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams // Required services var $location = $injector.get('$location'); + var $rootScope = $injector.get('$rootScope'); var authenticationService = $injector.get('authenticationService'); var clipboardService = $injector.get('clipboardService'); var guacClientManager = $injector.get('guacClientManager'); @@ -64,7 +65,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams */ var MENU_DRAG_VERTICAL_TOLERANCE = 10; - /* + /** * In order to open the guacamole menu, we need to hit ctrl-alt-shift. There are * several possible keysysms for each key. */ @@ -74,7 +75,15 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams CTRL_KEYS = {0xFFE3 : true, 0xFFE4 : true}, END_KEYS = {0xFF57 : true, 0xFFB1 : true}, MENU_KEYS = angular.extend({}, SHIFT_KEYS, ALT_KEYS, CTRL_KEYS); - CAD_KEYS = angular.extend({}, ALT_KEYS, CTRL_KEYS, END_KEYS); + + /** + * Keys needed to support the Ctrl-Alt-End hotkey for sending + * Ctrl-Alt-Delete. + */ + CAD_KEYS = angular.extend({}, ALT_KEYS, CTRL_KEYS, END_KEYS); + var CTRL_KEY = 0xFFE3; + var ALT_KEY = 0xFFE9; + var DEL_KEY = 0xFFFF; /** * All client error codes handled and passed off for translation. Any error @@ -501,14 +510,17 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams }; - // Track pressed keys, opening the Guacamole menu after Ctrl+Alt+Shift + /** + * Track pressed keys, opening the Guacamole menu after Ctrl+Alt+Shift, or + * send Ctrl-Alt-Delete when Ctrl-Alt-End is pressed. + */ $scope.$on('guacKeydown', function keydownListener(event, keysym, keyboard) { // Record key as pressed keysCurrentlyPressed[keysym] = true; var currentKeysPressedKeys = Object.keys(keysCurrentlyPressed); - /* + /** * If only menu keys are pressed, and we have one keysym from each group, * and one of the keys is being released, show the menu. */ @@ -534,6 +546,10 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams } } + /** + * If only Ctrl-Alt-End is pressed, and we have a one keysym from each + * group, and one key is being released, send Ctrl-Alt-Delete. + */ if(checkCADHotkeyActive()) { // Check that there is a key pressed for each of the required key classes @@ -545,12 +561,17 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams // Don't send this key event through to the client event.preventDefault(); - // Log the event - console.log('We should trigger Ctrl-Alt-Delete here.'); - // Reset the keys pressed keysCurrentlyPressed = {}; keyboard.reset(); + + // Send the Ctrl-Alt-Delete event. + $rootScope.$broadcast('guacSyntheticKeydown', CTRL_KEY); + $rootScope.$broadcast('guacSyntheticKeydown', ALT_KEY); + $rootScope.$broadcast('guacSyntheticKeydown', DEL_KEY); + $rootScope.$broadcast('guacSyntheticKeyup', DEL_KEY); + $rootScope.$broadcast('guacSyntheticKeyup', ALT_KEY); + $rootScope.$broadcast('guacSyntheticKeyup', CTRL_KEY); } } From ae9248fbe3999f4a1ea1d0535ae98effdc89f7ca Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Wed, 3 Jan 2018 14:01:18 -0500 Subject: [PATCH 3/9] GUACAMOLE-113: Refactor the hotkey to avoid sending unnecessary keystrokes. --- .../client/controllers/clientController.js | 60 +++++++------------ 1 file changed, 23 insertions(+), 37 deletions(-) diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index 6c80039aa..d66525f02 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -299,16 +299,6 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams return true; } - function checkCADHotkeyActive() { - for(var keysym in keysCurrentlyPressed) { - if(!CAD_KEYS[keysym]) { - return false; - } - } - - return true; - } - // Hide menu when the user swipes from the right $scope.menuDrag = function menuDrag(inProgress, startX, startY, currentX, currentY, deltaX, deltaY) { @@ -524,12 +514,12 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams * If only menu keys are pressed, and we have one keysym from each group, * and one of the keys is being released, show the menu. */ - if(checkMenuModeActive()) { + if (checkMenuModeActive()) { // Check that there is a key pressed for each of the required key classes - if(!_.isEmpty(_.pick(SHIFT_KEYS, currentKeysPressedKeys)) && - !_.isEmpty(_.pick(ALT_KEYS, currentKeysPressedKeys)) && - !_.isEmpty(_.pick(CTRL_KEYS, currentKeysPressedKeys)) + if (!_.isEmpty(_.pick(SHIFT_KEYS, currentKeysPressedKeys)) && + !_.isEmpty(_.pick(ALT_KEYS, currentKeysPressedKeys)) && + !_.isEmpty(_.pick(CTRL_KEYS, currentKeysPressedKeys)) ) { // Don't send this key event through to the client @@ -550,29 +540,13 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams * If only Ctrl-Alt-End is pressed, and we have a one keysym from each * group, and one key is being released, send Ctrl-Alt-Delete. */ - if(checkCADHotkeyActive()) { - - // Check that there is a key pressed for each of the required key classes - if(!_.isEmpty(_.pick(ALT_KEYS, currentKeysPressedKeys)) && - !_.isEmpty(_.pick(CTRL_KEYS, currentKeysPressedKeys)) && - !_.isEmpty(_.pick(END_KEYS, currentKeysPressedKeys)) - ) { - - // Don't send this key event through to the client - event.preventDefault(); - - // Reset the keys pressed - keysCurrentlyPressed = {}; - keyboard.reset(); - - // Send the Ctrl-Alt-Delete event. - $rootScope.$broadcast('guacSyntheticKeydown', CTRL_KEY); - $rootScope.$broadcast('guacSyntheticKeydown', ALT_KEY); - $rootScope.$broadcast('guacSyntheticKeydown', DEL_KEY); - $rootScope.$broadcast('guacSyntheticKeyup', DEL_KEY); - $rootScope.$broadcast('guacSyntheticKeyup', ALT_KEY); - $rootScope.$broadcast('guacSyntheticKeyup', CTRL_KEY); - } + if (END_KEYS[keysym] && + !_.isEmpty(_.pick(ALT_KEYS, currentKeysPressedKeys)) && + !_.isEmpty(_.pick(CTRL_KEYS, currentKeysPressedKeys)) + ) { + event.preventDefault(); + delete keysCurrentlyPressed[keysym]; + $rootScope.$broadcast('guacSyntheticKeydown', DEL_KEY); } }); @@ -581,12 +555,24 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams // with any data that appears to have come from those key presses $scope.$on('guacKeyup', function keyupListener(event, keysym, keyboard) { + var currentKeysPressedKeys = Object.keys(keysCurrentlyPressed); + // Sync local clipboard with any clipboard data received while this // key was pressed (if any) as long as the menu is not open var clipboardData = clipboardDataFromKey[keysym]; if (clipboardData && !$scope.menu.shown) clipboardService.setLocalClipboard(clipboardData); + if (END_KEYS[keysym] && + !_.isEmpty(_.pick(ALT_KEYS, currentKeysPressedKeys)) && + !_.isEmpty(_.pick(CTRL_KEYS, currentKeysPressedKeys)) + ) { + + event.preventDefault(); + $rootScope.$broadcast('guacSyntheticKeyup', DEL_KEY); + + } + // Mark key as released delete clipboardDataFromKey[keysym]; delete keysCurrentlyPressed[keysym]; From 50c196d703dc8fdace4bf18eec87d465e70d4010 Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Wed, 3 Jan 2018 14:05:07 -0500 Subject: [PATCH 4/9] GUACAMOLE-113: Remove unnecessary declerations and update comments. --- .../main/webapp/app/client/controllers/clientController.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index d66525f02..e9527479a 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -77,12 +77,9 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams MENU_KEYS = angular.extend({}, SHIFT_KEYS, ALT_KEYS, CTRL_KEYS); /** - * Keys needed to support the Ctrl-Alt-End hotkey for sending - * Ctrl-Alt-Delete. + * Keysym for sending the DELETE key when the Ctrl-Alt-End hotkey + * combo is pressed. */ - CAD_KEYS = angular.extend({}, ALT_KEYS, CTRL_KEYS, END_KEYS); - var CTRL_KEY = 0xFFE3; - var ALT_KEY = 0xFFE9; var DEL_KEY = 0xFFFF; /** From 733a4d42faa3a433d65b8531da2485d5fa50acee Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Thu, 4 Jan 2018 19:11:41 -0500 Subject: [PATCH 5/9] 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]; + } }); From 5376794e05d61862b8fca9114c38d10246eebcf9 Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Thu, 4 Jan 2018 22:52:57 -0500 Subject: [PATCH 6/9] GUACAMOLE-113: Fix style issues in code. --- .../client/controllers/clientController.js | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index f38ada4cc..04b137a66 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -278,6 +278,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams * 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 = {}; @@ -505,20 +506,17 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams }; - /** - * Track pressed keys, opening the Guacamole menu after Ctrl+Alt+Shift, or - * send Ctrl-Alt-Delete when Ctrl-Alt-End is pressed. - */ + // Track pressed keys, opening the Guacamole menu after Ctrl+Alt+Shift, or + // send Ctrl-Alt-Delete when Ctrl-Alt-End is pressed. $scope.$on('guacKeydown', function keydownListener(event, keysym, keyboard) { // Record key as pressed keysCurrentlyPressed[keysym] = true; var currentKeysPressedKeys = Object.keys(keysCurrentlyPressed); - /** - * If only menu keys are pressed, and we have one keysym from each group, - * and one of the keys is being released, show the menu. - */ + + // If only menu keys are pressed, and we have one keysym from each group, + // and one of the keys is being released, show the menu. if (checkMenuModeActive()) { // Check that there is a key pressed for each of the required key classes @@ -541,10 +539,8 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams } } - /** - * If only Ctrl-Alt-End is pressed, and we have a one keysym from each - * group, and one key is being released, send Ctrl-Alt-Delete. - */ + // If only Ctrl-Alt-End is pressed, and we have a one keysym from each + // group, and one key is being released, send Ctrl-Alt-Delete. if (END_KEYS[keysym] && !_.isEmpty(_.pick(ALT_KEYS, currentKeysPressedKeys)) && !_.isEmpty(_.pick(CTRL_KEYS, currentKeysPressedKeys)) From 9a9b570543cf38a8c1b56cfe59903e2566c24ca5 Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Sat, 13 Jan 2018 23:15:46 -0500 Subject: [PATCH 7/9] GUACAMOLE-113: Code clean-up - style, comments, and unneeded variables. --- .../app/client/controllers/clientController.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index 04b137a66..d26c87323 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -73,14 +73,21 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams ALT_KEYS = {0xFFE9 : true, 0xFFEA : true, 0xFE03 : true, 0xFFE7 : true, 0xFFE8 : true}, CTRL_KEYS = {0xFFE3 : true, 0xFFE4 : true}, - END_KEYS = {0xFF57 : true, 0xFFB1 : true}, MENU_KEYS = angular.extend({}, SHIFT_KEYS, ALT_KEYS, CTRL_KEYS); + /** + * Keysym for detecting any END key presses, for the purpose of passing through + * the Ctrl-Alt-Del sequence to a remote system. + */ + END_KEYS = {0xFF57 : true, 0xFFB1 : true}, + /** * Keysym for sending the DELETE key when the Ctrl-Alt-End hotkey * combo is pressed. + * + * @type Number */ - var DEL_KEY = 0xFFFF; + var DEL_KEY = 0xFFFF; /** * All client error codes handled and passed off for translation. Any error @@ -539,8 +546,8 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams } } - // If only Ctrl-Alt-End is pressed, and we have a one keysym from each - // group, and one key is being released, send Ctrl-Alt-Delete. + // If one of the End keys is pressed, and we have a one keysym from each + // of Ctrl and Alt groups, send Ctrl-Alt-Delete. if (END_KEYS[keysym] && !_.isEmpty(_.pick(ALT_KEYS, currentKeysPressedKeys)) && !_.isEmpty(_.pick(CTRL_KEYS, currentKeysPressedKeys)) @@ -557,8 +564,6 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams // with any data that appears to have come from those key presses $scope.$on('guacKeyup', function keyupListener(event, keysym, keyboard) { - var currentKeysPressedKeys = Object.keys(keysCurrentlyPressed); - // Sync local clipboard with any clipboard data received while this // key was pressed (if any) as long as the menu is not open var clipboardData = clipboardDataFromKey[keysym]; From f358cf298b1567950117211606b9851a670f29b3 Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Sat, 13 Jan 2018 23:25:27 -0500 Subject: [PATCH 8/9] GUACAMOLE-113: Use scope instead of rootScope. --- .../main/webapp/app/client/controllers/clientController.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index d26c87323..bf692bcde 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -31,7 +31,6 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams // Required services var $location = $injector.get('$location'); - var $rootScope = $injector.get('$rootScope'); var authenticationService = $injector.get('authenticationService'); var clipboardService = $injector.get('clipboardService'); var guacClientManager = $injector.get('guacClientManager'); @@ -79,7 +78,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams * Keysym for detecting any END key presses, for the purpose of passing through * the Ctrl-Alt-Del sequence to a remote system. */ - END_KEYS = {0xFF57 : true, 0xFFB1 : true}, + var END_KEYS = {0xFF57 : true, 0xFFB1 : true}; /** * Keysym for sending the DELETE key when the Ctrl-Alt-End hotkey @@ -555,7 +554,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams event.preventDefault(); delete keysCurrentlyPressed[keysym]; substituteKeysPressed[keysym] = DEL_KEY; - $rootScope.$broadcast('guacSyntheticKeydown', DEL_KEY); + $scope.$broadcast('guacSyntheticKeydown', DEL_KEY); } }); @@ -574,7 +573,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams if (substituteKeysPressed[keysym]) { event.preventDefault(); delete substituteKeysPressed[keysym]; - $rootScope.$broadcast('guacSyntheticKeyup', substituteKeysPressed[keysym]); + $scope.$broadcast('guacSyntheticKeyup', substituteKeysPressed[keysym]); } // Mark key as released From cd4fcabe3a71db28e6a5804f7ee399295414e3ae Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Sun, 14 Jan 2018 19:48:41 -0500 Subject: [PATCH 9/9] GUACAMOLE-113: Style and comment cleanup. --- .../app/client/controllers/clientController.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index bf692bcde..a21c0a200 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -551,10 +551,19 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams !_.isEmpty(_.pick(ALT_KEYS, currentKeysPressedKeys)) && !_.isEmpty(_.pick(CTRL_KEYS, currentKeysPressedKeys)) ) { - event.preventDefault(); - delete keysCurrentlyPressed[keysym]; - substituteKeysPressed[keysym] = DEL_KEY; - $scope.$broadcast('guacSyntheticKeydown', DEL_KEY); + + // Don't send this event through to the client. + event.preventDefault(); + + // Remove the original key press + delete keysCurrentlyPressed[keysym]; + + // Record the substituted key press so that it can be + // properly dealt with later. + substituteKeysPressed[keysym] = DEL_KEY; + + // Send through the delete key. + $scope.$broadcast('guacSyntheticKeydown', DEL_KEY); } });