react-x11 2.15.0 → 2.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/wayland/xkb.js +19 -4
package/package.json
CHANGED
package/src/wayland/xkb.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
// xkb_types `type "FOUR_LEVEL" { modifiers= Shift+LevelThree;
|
|
18
18
|
// map[Shift]= 2; ... }` modifier set -> level
|
|
19
19
|
// xkb_symbols `key <AD01> { [ q, Q ] };` keycode -> keysyms per level,
|
|
20
|
-
// with `symbols[Group2]` and `type=` where given
|
|
20
|
+
// with `symbols[Group2]`/`symbols[2]` and `type=` where given
|
|
21
21
|
// `modifier_map Mod5 { <LVL3> }` real modifier -> keycodes
|
|
22
22
|
// xkb_compat `interpret ISO_Level3_Shift { virtualModifier= LevelThree; }`
|
|
23
23
|
// keysym -> virtual modifier
|
|
@@ -187,17 +187,32 @@ export class XkbKeymap {
|
|
|
187
187
|
// explicit per-group or global type
|
|
188
188
|
const typeAll = body.match(/(?:^|[,{\s])type\s*=\s*"([^"]+)"/);
|
|
189
189
|
const typeByGroup = new Map();
|
|
190
|
-
for (const t of body.matchAll(/type\[Group(\d)\]\s*=\s*"([^"]+)"/g))
|
|
190
|
+
for (const t of body.matchAll(/type\[(?:Group)?(\d)\]\s*=\s*"([^"]+)"/g))
|
|
191
191
|
typeByGroup.set(+t[1], t[2]);
|
|
192
192
|
// symbols[GroupN]= [ a, b ] and the bare form { [ a, b ] }
|
|
193
|
+
//
|
|
194
|
+
// The group subscript has two spellings, and the one this file was
|
|
195
|
+
// written against is the one a compositor never sends. `xkbcomp -xkb`
|
|
196
|
+
// writes `symbols[Group1]`; **libxkbcommon writes `symbols[1]`**, and
|
|
197
|
+
// libxkbcommon is what serialises the keymap on the other end of
|
|
198
|
+
// `wl_keyboard.keymap` — so every keymap that reaches this parser for
|
|
199
|
+
// real uses the bare number. Both are accepted, because a keymap also
|
|
200
|
+
// arrives here from `xkbcomp` output in a test or a bug report.
|
|
193
201
|
const lists = [];
|
|
194
202
|
for (const g of body.matchAll(
|
|
195
|
-
/symbols\[Group(\d)\]\s*=\s*\[([^\]]*)\]/g,
|
|
203
|
+
/symbols\[(?:Group)?(\d)\]\s*=\s*\[([^\]]*)\]/g,
|
|
196
204
|
)) {
|
|
197
205
|
lists[+g[1] - 1] = g[2];
|
|
198
206
|
}
|
|
199
207
|
if (lists.length === 0) {
|
|
200
|
-
|
|
208
|
+
// The bare form, `key <ESC> { [ Escape ] };` — the list is the one
|
|
209
|
+
// bracket that is *not* a subscript, which is what the leading
|
|
210
|
+
// delimiter says: a subscript is always glued to the word in front
|
|
211
|
+
// of it (`symbols[`, `type[`, `actions[`). Matching any bracket at
|
|
212
|
+
// all is how an unrecognised subscript spelling used to end up here
|
|
213
|
+
// and take `[1]` for the symbol list, which decodes every key on the
|
|
214
|
+
// keyboard to the keysym named `1`.
|
|
215
|
+
const bare = body.match(/(?:^|[,{\s])\[([^\]]*)\]/);
|
|
201
216
|
if (bare) lists[0] = bare[1];
|
|
202
217
|
}
|
|
203
218
|
for (let gi = 0; gi < lists.length; gi++) {
|