| 587 | } |
| 588 | |
| 589 | sendKeyWithSpanishLatamKeyboard(keysym, down) { |
| 590 | const VSCODE_ACUTE_LATAM = 26; // The ASCII code of acute is 180 |
| 591 | let vscancode = this._scancodes[keysym] |
| 592 | if (vscancode) { |
| 593 | let shifted = vscancode.includes("shift"); |
| 594 | let altgr = vscancode.includes("altgr"); |
| 595 | let acute = vscancode.includes("acute"); |
| 596 | let vscancode_int = parseInt(vscancode); |
| 597 | if (acute) { |
| 598 | let shifted_1 = vscancode.includes("shift1"); // Shift with Acute accent |
| 599 | let shifted_2 = vscancode.includes("shift2"); // Shift with a/e/i/o/u |
| 600 | if (down) { |
| 601 | if (shifted_1 && ! this._shiftPressed) { |
| 602 | RFB.messages.keyEvent(this._sock, this._shiftKey, 1); |
| 603 | } else if (! shifted_1 && this._shiftPressed) { |
| 604 | RFB.messages.keyEvent(this._sock, this._shiftKey, 0); |
| 605 | } |
| 606 | RFB.messages.VMwareExtendedKeyEvent(this._sock, keysym, 1, VSCODE_ACUTE_LATAM); |
| 607 | RFB.messages.VMwareExtendedKeyEvent(this._sock, keysym, 0, VSCODE_ACUTE_LATAM); |
| 608 | if (shifted_2) { |
| 609 | RFB.messages.keyEvent(this._sock, this._shiftKey, 1); |
| 610 | } else { |
| 611 | RFB.messages.keyEvent(this._sock, this._shiftKey, 0); |
| 612 | } |
| 613 | } else { |
| 614 | RFB.messages.VMwareExtendedKeyEvent(this._sock, keysym, 0, VSCODE_ACUTE_LATAM); |
| 615 | if (shifted_2 && ! this._shiftPressed) { |
| 616 | RFB.messages.keyEvent(this._sock, this._shiftKey, 0); |
| 617 | } else if (! shifted_2 && this._shiftPressed) { |
| 618 | RFB.messages.keyEvent(this._sock, this._shiftKey, 1); |
| 619 | } |
| 620 | } |
| 621 | RFB.messages.VMwareExtendedKeyEvent(this._sock, keysym, down, vscancode_int); |
| 622 | return; |
| 623 | } |
| 624 | let isLetter = (keysym >= 65 && keysym <= 90) || (keysym >= 97 && keysym <= 122); |
| 625 | if (shifted && !this._shiftPressed && !isLetter && down) { |
| 626 | RFB.messages.keyEvent(this._sock, this._shiftKey, 1); |
| 627 | } |
| 628 | if (!shifted && this._shiftPressed && !isLetter && down) { |
| 629 | RFB.messages.keyEvent(this._sock, this._shiftKey, 0); |
| 630 | } |
| 631 | if (altgr && !this._altgrPressed && down) { |
| 632 | RFB.messages.keyEvent(this._sock, KeyTable.XK_Alt_R, 1); |
| 633 | } |
| 634 | RFB.messages.VMwareExtendedKeyEvent(this._sock, keysym, down, vscancode_int); |
| 635 | if (altgr && !this._altgrPressed && !down) { |
| 636 | RFB.messages.keyEvent(this._sock, KeyTable.XK_Alt_R, 0); |
| 637 | } |
| 638 | if (shifted && !this._shiftPressed && !isLetter && !down) { |
| 639 | RFB.messages.keyEvent(this._sock, this._shiftKey, 0); |
| 640 | } |
| 641 | if (!shifted && this._shiftPressed && !isLetter && !down) { |
| 642 | RFB.messages.keyEvent(this._sock, this._shiftKey, 1); |
| 643 | } |
| 644 | } else { |
| 645 | RFB.messages.keyEvent(this._sock, keysym, down ? 1 : 0); |
| 646 | } |