Repository: guacamole-client
Updated Branches:
  refs/heads/master 656328149 -> b5361a588


GUACAMOLE-113: Send through Ctrl-Alt-Delete when hotkey Ctrl-Alt-End is pressed.


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

Branch: refs/heads/master
Commit: d6e9a02c43b2cb81c77e5e63121f4d57e93a58b5
Parents: 6a747d1
Author: Nick Couchman <[email protected]>
Authored: Mon Jul 17 15:41:49 2017 -0400
Committer: Nick Couchman <[email protected]>
Committed: Wed Jan 3 11:36:14 2018 -0500

----------------------------------------------------------------------
 .../app/client/controllers/clientController.js  | 35 ++++++++++++++++----
 1 file changed, 28 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/d6e9a02c/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 86f6c1a..6c80039 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);
             }
         }
 

Reply via email to