Send NumLock on macOS, even though the key is Clear

There is no obvious choice what works best here, but this is what
TigerVNC has been doing for years without complaints. Let's follow
them until we get reports that this doesn't work well.
This commit is contained in:
Pierre Ossman
2019-11-01 13:13:35 +01:00
committed by Lauri Kasanen
parent 6916c83b48
commit 796de9653f
2 changed files with 27 additions and 0 deletions

View File

@@ -156,6 +156,14 @@ export function getKeysym(evt) {
location = 2;
}
// And for Clear
if ((key === 'Clear') && (location === 3)) {
let code = getKeycode(evt);
if (code === 'NumLock') {
location = 0;
}
}
if ((location === undefined) || (location > 3)) {
location = 0;
}
@@ -172,6 +180,15 @@ export function getKeysym(evt) {
}
}
// macOS has Clear instead of NumLock, but the remote system is
// probably not macOS, so lying here is probably best...
if (key === 'Clear') {
let code = getKeycode(evt);
if (code === 'NumLock') {
return KeyTable.XK_Num_Lock;
}
}
return DOMKeyTable[key][location];
}