1
>
/*---------------------------------------------------------------------------------------------
fallbackKeyboardMapper.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { ResolvedKeybinding, KeyCodeChord, Keybinding } from '../../../../base/common/keybindings.js';
7
>
import { OperatingSystem } from '../../../../base/common/platform.js';
8
>
import { IKeyboardEvent } from '../../../../platform/keybinding/common/keybinding.js';
9
>
import { USLayoutResolvedKeybinding } from '../../../../platform/keybinding/common/usLayoutResolvedKeybinding.js';
10
>
import { IKeyboardMapper } from '../../../../platform/keyboardLayout/common/keyboardMapper.js';
11
>
12
>
/**
13
>
* A keyboard mapper to be used when reading the keymap from the OS fails.
14
>
*/
15
>
export class FallbackKeyboardMapper implements IKeyboardMapper {
16
>
17
>
constructor(
18
>
private readonly _mapAltGrToCtrlAlt: boolean,
19
>
private readonly _OS: OperatingSystem,
20
>
) { }
21
>
22
>
public dumpDebugInfo(): string {
23
return 'FallbackKeyboardMapper dispatching on keyCode';
24
}
26
>
public resolveKeyboardEvent(keyboardEvent: IKeyboardEvent): ResolvedKeybinding {
27
const ctrlKey = keyboardEvent.ctrlKey || (this._mapAltGrToCtrlAlt && keyboardEvent.altGraphKey);
28
const altKey = keyboardEvent.altKey || (this._mapAltGrToCtrlAlt && keyboardEvent.altGraphKey);