mirror of
https://github.com/netbirdio/IronRDP.git
synced 2026-05-22 18:43:12 -07:00
fix(web): apply correct key codes to scan codes mapping (#866)
The root cause of the bug is the incorrect keycodes-to-scancodes mappings. These mappings translated the browser's key codes (like "KeyA") to OS-specific scancode (OS where the browser runs). However, that's not exactly what we need to do. We need to map the browser's key codes to _Windows_ scancodes - the only format that is accepted by _VNC_ and _RDP_) modules. Let's look at an example for a better understanding. _Safari_ browser used _Linux_'s _Gecko) mappings as a fallback (because there were no MacOS-specific mappings). For a given key, _iron-remote-desktop_ was providing a scancode that did not correspond to the _Windows_ scancode for that same key. As a result, the `IronVNC` module incorrectly mapped this scancode to a `KeySym`, which resulted in an incorrect `KeySym` or `NO_SYMBOL`.
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
export enum OS {
|
||||
WINDOWS = 'windows',
|
||||
LINUX = 'linux',
|
||||
ANDROID = 'android',
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,5 @@
|
||||
import { loggingService } from './logging.service';
|
||||
import { scanCode } from '../lib/scancodes';
|
||||
import { OS } from '../enums/OS';
|
||||
import { ModifierKey } from '../enums/ModifierKey';
|
||||
import { LockKey } from '../enums/LockKey';
|
||||
import { SessionEventType } from '../enums/SessionEventType';
|
||||
@@ -329,7 +328,7 @@ export class RemoteDesktopService {
|
||||
}
|
||||
|
||||
if (!evt.repeat || (!isModifierKey && !isLockKey)) {
|
||||
const keyScanCode = scanCode(evt.code, OS.WINDOWS);
|
||||
const keyScanCode = scanCode(evt.code);
|
||||
const unknownScanCode = Number.isNaN(keyScanCode);
|
||||
|
||||
if (!this.keyboardUnicodeMode && keyEvent && !unknownScanCode) {
|
||||
@@ -343,7 +342,7 @@ export class RemoteDesktopService {
|
||||
return;
|
||||
}
|
||||
|
||||
const keyCode = scanCode(evt.key, OS.WINDOWS);
|
||||
const keyCode = scanCode(evt.key);
|
||||
const isUnicodeCharacter = Number.isNaN(keyCode) && evt.key.length === 1;
|
||||
|
||||
if (isUnicodeCharacter && sendAsUnicode) {
|
||||
|
||||
Reference in New Issue
Block a user