new input

This commit is contained in:
csf 2022-04-25 18:27:15 +08:00
parent 5c99aca3fe
commit 37d4dce4ad
2 changed files with 5 additions and 5 deletions

View File

@ -55,9 +55,9 @@ export function mapKey(name: string, isDesktop: Boolean) {
return KeyEvent.fromPartial({ unicode: chr }); return KeyEvent.fromPartial({ unicode: chr });
else return KeyEvent.fromPartial({ chr }); else return KeyEvent.fromPartial({ chr });
} }
const control_key = controlKeyFromJSON(name); const control_key = controlKeyFromJSON(tmp);
if (control_key == ControlKey.UNRECOGNIZED) { if (control_key == ControlKey.UNRECOGNIZED) {
console.error("Unknown control key " + name); console.error("Unknown control key " + tmp);
} }
return KeyEvent.fromPartial({ control_key }); return KeyEvent.fromPartial({ control_key });
} }

View File

@ -563,13 +563,13 @@ export default class Connection {
) { ) {
const key_event = mapKey(name, globals.isDesktop()); const key_event = mapKey(name, globals.isDesktop());
if (!key_event) return; if (!key_event) return;
if (alt && (name == "Alt" || name == "RAlt")) { if (alt && (name == "VK_MENU" || name == "RAlt")) {
alt = false; alt = false;
} }
if (ctrl && (name == "Control" || name == "RControl")) { if (ctrl && (name == "VK_CONTROL" || name == "RControl")) {
ctrl = false; ctrl = false;
} }
if (shift && (name == "Shift" || name == "RShift")) { if (shift && (name == "VK_SHIFT" || name == "RShift")) {
shift = false; shift = false;
} }
if (command && (name == "Meta" || name == "RWin")) { if (command && (name == "Meta" || name == "RWin")) {