GUACAMOLE-113: Add object to clientController to keep track of substituted keys.


Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/733a4d42
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/733a4d42
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/733a4d42

Branch: refs/heads/master
Commit: 733a4d42faa3a433d65b8531da2485d5fa50acee
Parents: 50c196d
Author: Nick Couchman <[email protected]>
Authored: Thu Jan 4 19:11:41 2018 -0500
Committer: Nick Couchman <[email protected]>
Committed: Thu Jan 4 19:11:41 2018 -0500

----------------------------------------------------------------------
 .../app/client/controllers/clientController.js  | 26 +++++++++++++-------
 1 file changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/733a4d42/guacamole/src/main/webapp/app/client/controllers/clientController.js
----------------------------------------------------------------------
diff --git 
a/guacamole/src/main/webapp/app/client/controllers/clientController.js 
b/guacamole/src/main/webapp/app/client/controllers/clientController.js
index e952747..f38ada4 100644
--- a/guacamole/src/main/webapp/app/client/controllers/clientController.js
+++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js
@@ -275,6 +275,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.<Number, Number>
+     */
+    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
      * not currently pressed will not have entries within this map.
@@ -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];
+        }
 
     });
 

Reply via email to