nvazquez commented on code in PR #7694:
URL: https://github.com/apache/cloudstack/pull/7694#discussion_r1247686219


##########
systemvm/agent/noVNC/core/rfb.js:
##########
@@ -506,13 +521,46 @@ export default class RFB extends EventTargetMixin {
 
         const scancode = XtScancode[code];
 
+        if (keysym === KeyTable.XK_Shift_L || keysym === KeyTable.XK_Shift_R) {
+            this._shiftPressed = down;
+            this._shiftKey = down ? keysym : KeyTable.XK_Shift_L;
+        }
+        if (keysym === KeyTable.XK_Control_L || keysym === 
KeyTable.XK_Control_R) {
+            this._ctrlPressed = down;
+        }
+        if (keysym === KeyTable.XK_Alt_L || keysym === KeyTable.XK_Alt_R) {
+            this._altPressed = down;
+        }
+
         if (this._qemuExtKeyEventSupported && scancode) {
             // 0 is NoSymbol
             keysym = keysym || 0;
 
             Log.Info("Sending key (" + (down ? "down" : "up") + "): keysym " + 
keysym + ", scancode " + scancode);
 
             RFB.messages.QEMUExtendedKeyEvent(this._sock, keysym, down, 
scancode);
+        } else if (this._VMwareCursorSupported && 
Object.keys(this._scancodes).length > 0) {
+            let vscancode = this._scancodes[keysym]
+            if (vscancode) {
+                let shifted = vscancode.includes("shift");
+                let vscancode_int = parseInt(vscancode);
+                let isLetter = (keysym >= 65 && keysym <=90) || (keysym >=97 
&& keysym <=122);
+                if (shifted && ! this._shiftPressed && ! isLetter) {
+                    RFB.messages.keyEvent(this._sock, this._shiftKey, 1);
+                }
+                if (! shifted && this._shiftPressed && ! isLetter) {
+                    RFB.messages.keyEvent(this._sock, this._shiftKey, 0);
+                }
+                RFB.messages.VMwareExtendedKeyEvent(this._sock, keysym, down, 
vscancode_int);
+                if (shifted && ! this._shiftPressed && ! isLetter) {
+                    RFB.messages.keyEvent(this._sock, this._shiftKey, 0);
+                }
+                if (! shifted && this._shiftPressed && ! isLetter) {

Review Comment:
   Ok thanks @weizhouapache +1 for keeping it then



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to