Skip to content

Commit a9ea0fb

Browse files
authored
Merge pull request #9682 from keymanapp/chore/merge-master-into-package-metadata
chore: merge master into package-metadata 🎺
2 parents e0c2778 + 693aee5 commit a9ea0fb

File tree

119 files changed

+3506
-1393
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+3506
-1393
lines changed

HISTORY.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Keyman Version History
22

3+
## 17.0.185 alpha 2023-10-03
4+
5+
* chore(web): Add non-printing characters to the OSK (#9547)
6+
* feat(developer): support `store(&version) '17.0'` (#9656)
7+
* chore(developer): add test for `checkFilenameConventions == false` or unset (#9661)
8+
* feat(developer): ldml scan codes support (#9615)
9+
10+
## 17.0.184 alpha 2023-10-02
11+
12+
* fix(web): fixes toolbar refocus timing after a keyboard change (#9618)
13+
14+
## 17.0.183 alpha 2023-09-29
15+
16+
* feat(web): browser-KMW support for default subkeys (#9496)
17+
* refactor(linux): Add more tests for `keymanutil.c` ️ (#9595)
18+
319
## 17.0.182 alpha 2023-09-28
420

521
* chore(web): builds that output to web/build/publish should also clean it (#9613)

VERSION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
17.0.183
1+
17.0.186
Binary file not shown.
Binary file not shown.

android/Tests/KeyboardHarness/readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ and consists of these engineering keyboards:
1010
* web/testing/chirality/chirality.js
1111
* web/testing/platform/platformtest.js
1212

13+
test9469.kmp is another engineering keyboard to show non-printing characters on the OSK.
14+
1315
### Compiling From Command Line
1416
1. Launch a command prompt to the `android/` folder
1517
2. Compile KMEA. This will build and copy `keyman-engine.aar` to the Samples and Test projects

common/include/kmx_file.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,10 @@ namespace kmx {
6868
#define VERSION_150 0x00000F00
6969

7070
#define VERSION_160 0x00001000
71+
#define VERSION_170 0x00001100
7172

7273
#define VERSION_MIN VERSION_50
73-
#define VERSION_MAX VERSION_160
74+
#define VERSION_MAX VERSION_170
7475

7576
//
7677
// Backspace types

common/web/keyboard-processor/src/keyboards/activeLayout.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ export class ActiveKey implements LayoutKey {
4848
_baseKeyEvent: KeyEvent;
4949
isMnemonic: boolean = false;
5050

51+
/**
52+
* Only available on subkeys, but we don't distinguish between base keys and subkeys
53+
* at this level yet in KMW.
54+
*/
55+
default?: boolean;
56+
5157
proportionalPad: number;
5258
proportionalX: number;
5359
proportionalWidth: number;

common/web/keyboard-processor/src/keyboards/defaultLayouts.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export type LayoutKey = {
2222
"nextlayer"?: string,
2323
"pad"?: string | number,
2424
"sk"?: LayoutKey[]
25+
"default"?: boolean
2526
}
2627

2728
export type LayoutRow = {

common/web/types/src/consts/virtual-key-constants.ts

Lines changed: 81 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ export const USVirtualKeyCodes = {
122122
*/
123123
K_oE2:226,
124124
K_OE2:226,
125-
k_oC1:193, // ISO B11, ABNT-2 key to left of right shift, not on US keyboard
126-
k_OC1:193,
125+
K_oC1:193, // ISO B11, ABNT-2 key to left of right shift, not on US keyboard
126+
K_OC1:193,
127127
'K_?C1':193,
128128
'k_?C1':193,
129129
K_oDF:0xDF,
@@ -144,125 +144,90 @@ export const USVirtualKeyCodes = {
144144

145145
const k = USVirtualKeyCodes;
146146

147-
export type KeyMap = number[][];
147+
/** Map a CLDR scancode to a US VKey ala USVirtualKeyCodes */
148+
export const CLDRScanToUSVirtualKeyCodes = {
149+
0x02: k.K_1,
150+
0x03: k.K_2,
151+
0x04: k.K_3,
152+
0x05: k.K_4,
153+
0x06: k.K_5,
154+
0x07: k.K_6,
155+
0x08: k.K_7,
156+
0x09: k.K_8,
157+
0x0A: k.K_9,
158+
0x0B: k.K_0,
159+
0x0C: k.K_HYPHEN,
160+
0x0D: k.K_EQUAL,
148161

149-
export const USVirtualKeyMap: KeyMap = [
150-
// ` 1 2 3 4 5 6 7 8 9 0 - = [bksp]
151-
[ k.K_BKQUOTE, k.K_1, k.K_2, k.K_3, k.K_4, k.K_5, k.K_6, k.K_7, k.K_8, k.K_9, k.K_0, k.K_HYPHEN, k.K_EQUAL ],
152-
// [tab] Q W E R T Y U I O P [ ] \
153-
[ k.K_Q, k.K_W, k.K_E, k.K_R, k.K_T, k.K_Y, k.K_U, k.K_I, k.K_O, k.K_P, k.K_LBRKT, k.K_RBRKT, k.K_BKSLASH ],
154-
// [caps] A S D F G H J K L ; ' [enter]
155-
[ k.K_A, k.K_S, k.K_D, k.K_F, k.K_G, k.K_H, k.K_J, k.K_K, k.K_L, k.K_COLON, k.K_QUOTE ],
156-
// [shift] Z X C V B N M , . / [shift] *=oE2
157-
[ k.K_Z, k.K_X, k.K_C, k.K_V, k.K_B, k.K_N, k.K_M, k.K_COMMA, k.K_PERIOD, k.K_SLASH ],
158-
// space
159-
[ k.K_SPACE ],
160-
];
162+
0x10: k.K_Q,
163+
0x11: k.K_W,
164+
0x12: k.K_E,
165+
0x13: k.K_R,
166+
0x14: k.K_T,
167+
0x15: k.K_Y,
168+
0x16: k.K_U,
169+
0x17: k.K_I,
170+
0x18: k.K_O,
171+
0x19: k.K_P,
172+
0x1A: k.K_LBRKT,
173+
0x1B: k.K_RBRKT,
161174

162-
export const ISOVirtualKeyMap: KeyMap = [
163-
// ` 1 2 3 4 5 6 7 8 9 0 - = [bksp]
164-
[ k.K_BKQUOTE, k.K_1, k.K_2, k.K_3, k.K_4, k.K_5, k.K_6, k.K_7, k.K_8, k.K_9, k.K_0, k.K_HYPHEN, k.K_EQUAL ],
165-
// [tab] Q W E R T Y U I O P [ ]
166-
[ k.K_Q, k.K_W, k.K_E, k.K_R, k.K_T, k.K_Y, k.K_U, k.K_I, k.K_O, k.K_P, k.K_LBRKT, k.K_RBRKT ],
167-
// [caps] A S D F G H J K L ; ' \ [enter]
168-
[ k.K_A, k.K_S, k.K_D, k.K_F, k.K_G, k.K_H, k.K_J, k.K_K, k.K_L, k.K_COLON, k.K_QUOTE, k.K_BKSLASH ],
169-
// [shift] * Z X C V B N M , . / [shift] *=oE2
170-
[ k.K_oE2, k.K_Z, k.K_X, k.K_C, k.K_V, k.K_B, k.K_N, k.K_M, k.K_COMMA, k.K_PERIOD, k.K_SLASH ],
171-
// space
172-
[ k.K_SPACE ],
173-
];
175+
0x1E: k.K_A,
176+
0x1F: k.K_S,
177+
0x20: k.K_D,
178+
0x21: k.K_F,
179+
0x22: k.K_G,
180+
0x23: k.K_H,
181+
0x24: k.K_J,
182+
0x25: k.K_K,
183+
0x26: k.K_L,
184+
0x27: k.K_COLON,
185+
0x28: k.K_QUOTE,
186+
0x29: k.K_BKQUOTE,
174187

175-
export const JISVirtualKeyMap: KeyMap = [
176-
// [Hankaku/Zenkaku] 1 2 3 4 5 6 7 8 9 0 - ^ ¥ [bksp]
177-
[ k.K_1, k.K_2, k.K_3, k.K_4, k.K_5, k.K_6, k.K_7, k.K_8, k.K_9, k.K_0, k.K_HYPHEN, k.K_EQUAL, k.K_BKSLASH /* YEN */ ],
178-
// [tab] Q W E R T Y U I O P @«`» [ [enter]
179-
[ k.K_Q, k.K_W, k.K_E, k.K_R, k.K_T, k.K_Y, k.K_U, k.K_I, k.K_O, k.K_P, k.K_BKQUOTE, k.K_LBRKT ],
180-
// [caps] A S D F G H J K L ; : ] [enter]
181-
[ k.K_A, k.K_S, k.K_D, k.K_F, k.K_G, k.K_H, k.K_J, k.K_K, k.K_L, k.K_COLON, k.K_QUOTE, k.K_RBRKT ],
182-
// [shift] Z X C V B N M , . / _ [shift]
183-
[ k.K_Z, k.K_X, k.K_C, k.K_V, k.K_B, k.K_N, k.K_M, k.K_COMMA, k.K_PERIOD, k.K_SLASH, k.K_oE2 /* ろ */ ],
184-
// space
185-
[ k.K_SPACE ],
186-
];
188+
0x2B: k.K_BKSLASH,
189+
0x2C: k.K_Z,
190+
0x2D: k.K_X,
191+
0x2E: k.K_C,
192+
0x2F: k.K_V,
193+
0x30: k.K_B,
194+
0x31: k.K_N,
195+
0x32: k.K_M,
196+
0x33: k.K_COMMA,
197+
0x34: k.K_PERIOD,
198+
0x35: k.K_SLASH,
187199

188-
export const ABNT2VirtualKeyMap: KeyMap = [
189-
// ' 1 2 3 4 5 6 7 8 9 0 - = [bksp]
190-
[ k.K_BKQUOTE, k.K_1, k.K_2, k.K_3, k.K_4, k.K_5, k.K_6, k.K_7, k.K_8, k.K_9, k.K_0, k.K_HYPHEN, k.K_EQUAL ],
191-
// [tab] Q W E R T Y U I O P ´ [
192-
[ k.K_Q, k.K_W, k.K_E, k.K_R, k.K_T, k.K_Y, k.K_U, k.K_I, k.K_O, k.K_P, k.K_LBRKT, k.K_RBRKT ],
193-
// [caps] A S D F G H J K L ç ~ ] [enter]
194-
[ k.K_A, k.K_S, k.K_D, k.K_F, k.K_G, k.K_H, k.K_J, k.K_K, k.K_L, k.K_COLON, k.K_QUOTE, k.K_BKSLASH ],
195-
// [shift] \ Z X C V B N M , . ; / [shift]
196-
[ k.K_oE2, k.K_Z, k.K_X, k.K_C, k.K_V, k.K_B, k.K_N, k.K_M, k.K_COMMA, k.K_PERIOD, k.K_SLASH, k.k_oC1 /* ABNT2 */ ],
197-
// space
198-
[ k.K_SPACE ],
199-
];
200+
0x39: k.K_SPACE,
200201

201-
/**
202-
* Map from a hardware constant to a keymap
203-
* For the 'key' see constants.layr_list_hardware_map
204-
*/
205-
export const HardwareToKeymap: Map<string, KeyMap> = new Map(
206-
[
207-
["us", USVirtualKeyMap],
208-
["iso", ISOVirtualKeyMap],
209-
["jis", JISVirtualKeyMap],
210-
["abnt2", ABNT2VirtualKeyMap],
211-
]
212-
);
202+
0x56: k.K_oE2, // << Same as 0x7D; found on iso, abnt2
203+
0x73: k.K_oC1,
204+
0x7D: k.K_oE2, // << Same as 0x56; found on jis
205+
206+
};
207+
208+
export type KeyMap = number[][];
213209

214210
/**
215-
* Maps LDML VKey Names from CLDR VKey Enum in TR35 to Keyman virtual key codes
211+
* Convert a scan code numerical KeyMap to VKeys
212+
* @param scans keymap to convert
213+
* @param badScans output: set of not-found scancodes
214+
* @returns
216215
*/
217-
export const LdmlVkeyNames: Record<string, number> = {
218-
'SPACE': k.K_SPACE, // 0x20, // A03
219-
'0': k.K_0, // 0x30, // E10
220-
'1': k.K_1, // 0x31, // E01
221-
'2': k.K_2, // 0x32, // E02
222-
'3': k.K_3, // 0x33, // E03
223-
'4': k.K_4, // 0x34, // E04
224-
'5': k.K_5, // 0x35, // E05
225-
'6': k.K_6, // 0x36, // E06
226-
'7': k.K_7, // 0x37, // E07
227-
'8': k.K_8, // 0x38, // E08
228-
'9': k.K_9, // 0x39, // E09
229-
'A': k.K_A, // 0x41, // C01
230-
'B': k.K_B, // 0x42, // B05
231-
'C': k.K_C, // 0x43, // B03
232-
'D': k.K_D, // 0x44, // C03
233-
'E': k.K_E, // 0x45, // D03
234-
'F': k.K_F, // 0x46, // C04
235-
'G': k.K_G, // 0x47, // C05
236-
'H': k.K_H, // 0x48, // C06
237-
'I': k.K_I, // 0x49, // D08
238-
'J': k.K_J, // 0x4A, // C07
239-
'K': k.K_K, // 0x4B, // C08
240-
'L': k.K_L, // 0x4C, // C09
241-
'M': k.K_M, // 0x4D, // B07
242-
'N': k.K_N, // 0x4E, // B06
243-
'O': k.K_O, // 0x4F, // D09
244-
'P': k.K_P, // 0x50, // D10
245-
'Q': k.K_Q, // 0x51, // D01
246-
'R': k.K_R, // 0x52, // D04
247-
'S': k.K_S, // 0x53, // C02
248-
'T': k.K_T, // 0x54, // D05
249-
'U': k.K_U, // 0x55, // D07
250-
'V': k.K_V, // 0x56, // B05
251-
'W': k.K_W, // 0x57, // D02
252-
'X': k.K_X, // 0x58, // B02
253-
'Y': k.K_Y, // 0x59, // D06
254-
'Z': k.K_Z, // 0x5A, // B01
255-
'SEMICOLON': k.K_COLON, // 0xBA, // C10
256-
'EQUAL': k.K_EQUAL, // 0xBB, // E12
257-
'COMMA': k.K_COMMA, // 0xBC, // B08
258-
'HYPHEN': k.K_HYPHEN, // 0xBD, // E11
259-
'PERIOD': k.K_PERIOD, // 0xBE, // B09
260-
'SLASH': k.K_SLASH, // 0xBF, // B10
261-
'GRAVE': k.K_BKQUOTE, // 0xC0, // E00
262-
'LBRACKET': k.K_LBRKT, // 0xDB, // D11
263-
'BACKSLASH': k.K_BKSLASH, // 0xDC, // D13
264-
'RBRACKET': k.K_RBRKT, // 0xDD, // D12
265-
'QUOTE': k.K_QUOTE, // 0xDE, // C11
266-
'LESS-THAN': k.K_oE2, // 0xE2, // B00 102nd key on European layouts, right of left shift.
267-
'ABNT2': k.k_oC1, // 0xC1, // B11 Extra key, left of right-shift, ABNT2
268-
};
216+
export function CLDRScanToKeyMap(scans: KeyMap, badScans?: Set<number>): KeyMap {
217+
return scans.map((row) => row.map((scan) => CLDRScanToVkey(scan, badScans)));
218+
}
219+
220+
/** Convert one scan code to vkey, or undefined */
221+
export function CLDRScanToVkey(scan: number, badScans?: Set<number>): number {
222+
/** typescript fun to index the scan table */
223+
function hasScanCode(key: PropertyKey): key is keyof typeof CLDRScanToUSVirtualKeyCodes {
224+
return key in CLDRScanToUSVirtualKeyCodes;
225+
}
226+
if (hasScanCode(scan)) {
227+
return CLDRScanToUSVirtualKeyCodes[scan];
228+
} else {
229+
badScans?.add(scan);
230+
return undefined;
231+
}
232+
}
233+

common/web/types/src/kmx/kmx-plus-builder/build-layr.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { BUILDER_SECTION } from "./builder-section.js";
1313
* List of layers, the <layers> element
1414
*/
1515
interface BUILDER_LAYR_LIST {
16-
hardware: number; // hardware indicator
16+
hardware: BUILDER_STR_REF; // hardware or 'touch'
1717
layer: number; // index of first layer in the list, in the
1818
count: number; // number of layer entries in the list
1919
minDeviceWidth: number; // width in millimeters
@@ -82,7 +82,7 @@ export function build_layr(kmxplus: KMXPlusData, sect_strs: BUILDER_STRS, sect_l
8282

8383
layr.lists = kmxplus.layr.lists.map((list) => {
8484
const blist: BUILDER_LAYR_LIST = {
85-
hardware: list.hardware,
85+
hardware: build_strs_index(sect_strs, list.hardware),
8686
layer: null, // to be set below
8787
_layers: list.layers,
8888
count: list.layers.length,
@@ -92,6 +92,7 @@ export function build_layr(kmxplus: KMXPlusData, sect_strs: BUILDER_STRS, sect_l
9292
});
9393
// now sort the lists
9494
layr.lists.sort((a, b) => {
95+
// sort by string #
9596
if (a.hardware < b.hardware) {
9697
return -1;
9798
} else if (a.hardware > b.hardware) {

common/web/types/src/kmx/kmx-plus-builder/build-vkey.ts

Lines changed: 0 additions & 43 deletions
This file was deleted.

common/web/types/src/kmx/kmx-plus-builder/kmx-plus-builder.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { BUILDER_STRS, build_strs } from './build-strs.js';
1515
import { BUILDER_TRAN, build_tran } from './build-tran.js';
1616
import { BUILDER_USET, build_uset } from './build-uset.js';
1717
import { BUILDER_VARS, build_vars } from './build-vars.js';
18-
import { BUILDER_VKEY, build_vkey } from './build-vkey.js';
1918

2019
type BUILDER_BKSP = BUILDER_TRAN;
2120
// type BUILDER_FINL = BUILDER_TRAN;
@@ -36,7 +35,6 @@ type SectionBuilders = {
3635
tran?: BUILDER_TRAN;
3736
uset?: BUILDER_USET;
3837
vars?: BUILDER_VARS;
39-
vkey?: BUILDER_VKEY;
4038
};
4139

4240
export default class KMXPlusBuilder {
@@ -73,7 +71,6 @@ export default class KMXPlusBuilder {
7371
this.emitSection(file, this.file.COMP_PLUS_TRAN, this.sect.tran);
7472
this.emitSection(file, this.file.COMP_PLUS_USET, this.sect.uset);
7573
this.emitSection(file, this.file.COMP_PLUS_VARS, this.sect.vars);
76-
this.emitSection(file, this.file.COMP_PLUS_VKEY, this.sect.vkey);
7774

7875
return file;
7976
}
@@ -100,7 +97,6 @@ export default class KMXPlusBuilder {
10097
this.sect.tran = build_tran(this.file.kmxplus.tran, this.sect.strs, this.sect.elem);
10198
this.sect.uset = build_uset(this.file.kmxplus, this.sect.strs);
10299
this.sect.vars = build_vars(this.file.kmxplus, this.sect.strs, this.sect.elem, this.sect.list);
103-
this.sect.vkey = build_vkey(this.file.kmxplus);
104100

105101
// Finalize the sect (index) section
106102

@@ -138,7 +134,6 @@ export default class KMXPlusBuilder {
138134
offset = this.finalize_sect_item(this.sect.tran, offset);
139135
offset = this.finalize_sect_item(this.sect.uset, offset);
140136
offset = this.finalize_sect_item(this.sect.vars, offset);
141-
offset = this.finalize_sect_item(this.sect.vkey, offset);
142137

143138
this.sect.sect.total = offset;
144139
}

0 commit comments

Comments
 (0)