MCPcopy Create free account
hub / github.com/apache/cloudstack / sendKey

Method sendKey

systemvm/agent/noVNC/core/rfb.js:522–560  ·  view source on GitHub ↗
(keysym, code, down)

Source from the content-addressed store, hash-verified

520 // Send a key press. If 'down' is not specified then send a down key
521 // followed by an up key.
522 sendKey(keysym, code, down) {
523 if (this._rfbConnectionState !== 'connected' || this._viewOnly) { return; }
524
525 if (down === undefined) {
526 this.sendKey(keysym, code, true);
527 this.sendKey(keysym, code, false);
528 return;
529 }
530
531 const scancode = XtScancode[code];
532
533 if (keysym === KeyTable.XK_Shift_L || keysym === KeyTable.XK_Shift_R) {
534 this._shiftPressed = down;
535 this._shiftKey = down ? keysym : KeyTable.XK_Shift_L;
536 }
537
538 if (keysym === KeyTable.XK_Alt_R) {
539 this._altgrPressed = down;
540 }
541
542 if (this._qemuExtKeyEventSupported && scancode) {
543 // 0 is NoSymbol
544 keysym = keysym || 0;
545
546 Log.Info("Sending key (" + (down ? "down" : "up") + "): keysym " + keysym + ", scancode " + scancode);
547
548 RFB.messages.QEMUExtendedKeyEvent(this._sock, keysym, down, scancode);
549 } else if (Object.keys(this._scancodes).length > 0 && this._language === "jp") {
550 this.sendKeyWithJapaneseKeyboard(keysym, down)
551 } else if (Object.keys(this._scancodes).length > 0 && this._language === "es-latam") {
552 this.sendKeyWithSpanishLatamKeyboard(keysym, down)
553 } else {
554 if (!keysym) {
555 return;
556 }
557 Log.Info("Sending keysym (" + (down ? "down" : "up") + "): " + keysym);
558 RFB.messages.keyEvent(this._sock, keysym, down ? 1 : 0);
559 }
560 }
561
562 sendKeyWithJapaneseKeyboard(keysym, down) {
563 let vscancode = this._scancodes[keysym]

Callers 14

keyboardTypeTextMethod · 0.95
sendCtrlAltDelMethod · 0.95
sendCtrlEscMethod · 0.95
_handleKeyEventMethod · 0.95
keyEventFunction · 0.80
keyInputFunction · 0.80
sendEscFunction · 0.80
sendTabFunction · 0.80
toggleCtrlFunction · 0.80
toggleShiftFunction · 0.80
toggleWindowsFunction · 0.80
toggleAltFunction · 0.80

Calls 3

keysMethod · 0.80

Tested by

no test coverage detected