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


##########
systemvm/agent/noVNC/core/rfb.js:
##########
@@ -2608,6 +2656,7 @@ export default class RFB extends EventTargetMixin {
                 return true;
 
             case encodings.pseudoEncodingVMwareCursor:
+                this._VMwareCursorSupported = true;

Review Comment:
   Is this encoding a requirement to display the JP keyboard?



##########
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) {

Review Comment:
   Could it be the case in which the JP keyboard is needed but uses a different 
encoding?



##########
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) {

Review Comment:
   Seems like ctrlPressed and altPressed are not used, can we remove these 2 
checks?



##########
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:
   Why is this logic repetead after the `VMwareExtendedKeyEvent` call?



-- 
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