weizhouapache commented on code in PR #7694:
URL: https://github.com/apache/cloudstack/pull/7694#discussion_r1245447351
##########
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:
Sometimes it happens that some chars in Japanese keyboard require shift to
be pressed, but if we use different keyboard (e.g. us/uk) we do not need to
press shift.
In this case, if the vm use Japanese keyboard, we need to press shift at
first, send the keycode and release shift.
(this does not apply on letters)
--
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]