[ 
https://issues.apache.org/jira/browse/GUACAMOLE-552?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nick Couchman updated GUACAMOLE-552:
------------------------------------
    Priority: Minor  (was: Major)

> Allow Guacamole client to directly paste the clipboard data to the remote 
> machine
> ---------------------------------------------------------------------------------
>
>                 Key: GUACAMOLE-552
>                 URL: https://issues.apache.org/jira/browse/GUACAMOLE-552
>             Project: Guacamole
>          Issue Type: Improvement
>          Components: guacamole-client
>    Affects Versions: 0.9.14
>            Reporter: Kalki Nethaji
>            Priority: Minor
>
> Now we need to open the sidebar and paste our clipboard content and then 
> close the sidebar and then we need to do paste command to paste the clipboard 
> data in the remote machine.
> Instead of these four steps, A simple CTRL-V to paste the local machines 
> clipboard data on the server will be really great.
>  
> I've made upto this part, but facing an unknown issue.
> I need to open the sidebar initially and do a CTRL-V before using CTRL-V 
> directly on the terminal. Else the paste ClipboardEvent is not generated by 
> the browser.
>  
> In 
> "guacamole-client\guacamole\src\main\webapp\app\client\controllers\clientController.js":
> {code:java}
> var PASTE_KEYS   = angular.extend({}, CTRL_KEYS, {0x0076: true});
> function checkPaste() {
>     for(var keysym in keysCurrentlyPressed) {
>         if(!PASTE_KEYS[keysym]) {
>             return false;
>         }
>     }
>     return true;
> }
> document.addEventListener('paste', function (event) {
>     console.log('Pasted text event: ', event.clipboardData.getData('text'));
>     $scope.client.clipboardData.data = event.clipboardData.getData('text');
>     $scope.$broadcast('guacClipboard', $scope.client.clipboardData);
>     $scope.client.clientProperties.keyboardEnabled = true;
>     $scope.client.client.sendKeyEvent(1, 0xFFE3);
>     $scope.client.client.sendKeyEvent(1, 0xFFE1);
>     $scope.client.client.sendKeyEvent(1, 0x0056);
>     $scope.client.client.sendKeyEvent(0, 0x0056);
>     $scope.client.client.sendKeyEvent(0, 0xFFE1);
>     $scope.client.client.sendKeyEvent(0, 0xFFE3);
> });
> // Track pressed keys, opening the Guacamole menu after Ctrl+Alt+Shift
> $scope.$on('guacKeydown', function keydownListener(event, keysym, keyboard) {
>     // Record key as pressed
>     keysCurrentlyPressed[keysym] = true;   
>     
>     /* 
>      * 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)) &&
>            !_.isEmpty(_.pick(ALT_KEYS, currentKeysPressedKeys)) &&
>            !_.isEmpty(_.pick(CTRL_KEYS, currentKeysPressedKeys))
>         ) {
>     
>             // Don't send this key event through to the client
>             event.preventDefault();
>             
>             // Reset the keys pressed
>             keysCurrentlyPressed = {};
>             keyboard.reset();
>             
>             // Toggle the menu
>             $scope.$apply(function() {
>                 $scope.menu.shown = !$scope.menu.shown;
>             });
>         }
>     } else if (checkPaste()) {
>         $scope.client.clientProperties.keyboardEnabled = false;
>         console.log('catched by paste trigger & setting keyboardEnabled to 
> false');
>     }
> });
> });{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to