weizhouapache commented on code in PR #7694:
URL: https://github.com/apache/cloudstack/pull/7694#discussion_r1247630667
##########
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:
@nvazquez
From what I have tested, if the vm layout and client keyboard layout are
same, this is not required (for example both are Japanese)
However, if the vm layout and client keyboard layout are different, this is
required (for example, vm layout is Japanese, but our laptop/client uses US
keyboard)
--
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]