Fix menu scancode. (#586)

* Fix menu scancode.

* Change the old menu key scancode 118 to 101.

* validate scancodes
This commit is contained in:
László Monda
2018-03-11 22:56:12 +01:00
committed by GitHub
parent e84dbf2c15
commit e8fe0f8d3e
12 changed files with 261 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
import { Component, Input, OnChanges } from '@angular/core';
import { Select2OptionData, Select2TemplateFunction } from 'ng2-select2';
import { KeyAction, KeystrokeAction, KeystrokeType } from 'uhk-common';
import { KeyAction, KeystrokeAction, KeystrokeType, SCANCODES, SECONDARY_ROLES } from 'uhk-common';
import { Tab } from '../tab';
import { MapperService } from '../../../../services/mapper.service';
@@ -35,8 +35,8 @@ export class KeypressTabComponent extends Tab implements OnChanges {
id: '0',
text: 'None'
}];
this.scanCodeGroups = this.scanCodeGroups.concat(require('./scancodes.json'));
this.secondaryRoleGroups = require('./secondaryRole.json');
this.scanCodeGroups = this.scanCodeGroups.concat(SCANCODES);
this.secondaryRoleGroups = SECONDARY_ROLES;
this.leftModifierSelects = Array(this.leftModifiers.length).fill(false);
this.rightModifierSelects = Array(this.rightModifiers.length).fill(false);
this.selectedScancodeOption = this.scanCodeGroups[0];

View File

@@ -1,60 +0,0 @@
[
{
"id": "-1",
"text": "None"
},
{
"text": "Layer switcher",
"children": [
{
"id": "8",
"text": "Mod"
},
{
"id": "9",
"text": "Fn"
},
{
"id": "10",
"text": "Mouse"
}
]
},
{
"text": "Modifier",
"children": [
{
"id": "0",
"text": "LShift"
},
{
"id": "1",
"text": "LCtrl"
},
{
"id": "2",
"text": "LSuper"
},
{
"id": "3",
"text": "LAlt"
},
{
"id": "4",
"text": "RShift"
},
{
"id": "5",
"text": "RCtrl"
},
{
"id": "6",
"text": "RSuper"
},
{
"id": "7",
"text": "RAlt"
}
]
}
]

View File

@@ -94,7 +94,7 @@ export class CaptureService {
this.mapping.set(88, 27); // X
this.mapping.set(89, 28); // Y
this.mapping.set(90, 29); // Z
this.mapping.set(93, 118); // Menu
this.mapping.set(93, 101); // Menu
this.mapping.set(96, 98); // Num pad 0
this.mapping.set(97, 89); // Num pad 1
this.mapping.set(98, 90); // Num pad 2

View File

@@ -190,6 +190,7 @@ export class MapperService {
this.basicScanCodeTextMap.set(98, ['Insert', '0']);
this.basicScanCodeTextMap.set(99, ['Del', '.']);
this.basicScanCodeTextMap.set(100, ['ISO key', '|']);
this.basicScanCodeTextMap.set(101, ['Menu']);
this.basicScanCodeTextMap.set(104, ['F13']);
this.basicScanCodeTextMap.set(105, ['F14']);
this.basicScanCodeTextMap.set(106, ['F15']);
@@ -202,7 +203,6 @@ export class MapperService {
this.basicScanCodeTextMap.set(113, ['F22']);
this.basicScanCodeTextMap.set(114, ['F23']);
this.basicScanCodeTextMap.set(115, ['F24']);
this.basicScanCodeTextMap.set(118, ['Menu']);
this.basicScanCodeTextMap.set(176, ['00']);
this.basicScanCodeTextMap.set(177, ['000']);
@@ -236,7 +236,7 @@ export class MapperService {
this.basicScancodeIcons.set(80, 'icon-kbd__mod--arrow-left');
this.basicScancodeIcons.set(81, 'icon-kbd__mod--arrow-down');
this.basicScancodeIcons.set(82, 'icon-kbd__mod--arrow-up');
this.basicScancodeIcons.set(118, 'icon-kbd__mod--menu');
this.basicScancodeIcons.set(101, 'icon-kbd__mod--menu');
this.mediaScancodeIcons = new Map<number, string>();
this.mediaScancodeIcons.set(138, 'icon-kbd__fn--browser');

View File

@@ -495,7 +495,7 @@
{
"keyActionType": "keystroke",
"type": "basic",
"scancode": 118
"scancode": 101
},
{
"keyActionType": "keystroke",
@@ -1501,7 +1501,7 @@
{
"keyActionType": "keystroke",
"type": "basic",
"scancode": 118
"scancode": 101
},
{
"keyActionType": "keystroke",
@@ -2517,7 +2517,7 @@
{
"keyActionType": "keystroke",
"type": "basic",
"scancode": 118
"scancode": 101
},
{
"keyActionType": "keystroke",
@@ -3520,7 +3520,7 @@
{
"keyActionType": "keystroke",
"type": "basic",
"scancode": 118
"scancode": 101
},
{
"keyActionType": "keystroke",
@@ -4533,7 +4533,7 @@
{
"keyActionType": "keystroke",
"type": "basic",
"scancode": 118
"scancode": 101
},
{
"keyActionType": "keystroke",
@@ -5534,7 +5534,7 @@
{
"keyActionType": "keystroke",
"type": "basic",
"scancode": 118
"scancode": 101
},
{
"keyActionType": "keystroke",
@@ -6547,7 +6547,7 @@
{
"keyActionType": "keystroke",
"type": "basic",
"scancode": 118
"scancode": 101
},
{
"keyActionType": "keystroke",