Skip to content

Commit d0c49c8

Browse files
committed
symbols: Add tests for multiple actions per level
1 parent b6035e9 commit d0c49c8

File tree

4 files changed

+368
-1
lines changed

4 files changed

+368
-1
lines changed

test/data/keymaps/stringcomp.data

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,6 +1728,12 @@ xkb_symbols "pc_us_ru_2_ca(multix)_3_de(neo)_4_inet(evdev)" {
17281728
type= "CTRL+ALT",
17291729
symbols[Group1]= [ F12, F12, F12, F12, XF86Switch_VT_12 ]
17301730
};
1731+
key <AB11> {
1732+
symbols[Group1]= [ Control_L, { Control_L, Mode_switch } ],
1733+
actions[Group1]= [ SetMods(modifiers=Control), { SetMods(modifiers=Control), SetGroup(group=+1) } ],
1734+
symbols[Group2]= [ { Control_L, Mode_switch }, Control_L ],
1735+
actions[Group2]= [ { SetMods(modifiers=Control), SetGroup(group=+1) }, SetMods(modifiers=Control) ]
1736+
};
17311737
key <KATA> { [ Katakana ] };
17321738
key <HIRA> { [ Hiragana ] };
17331739
key <HENK> { [ Henkan_Mode ] };

test/data/symbols/awesome

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ xkb_symbols "awesome" {
1919
key <AC01> { [ a, A, Return, Return ] };
2020
key <AC02> { [ s, S, Left] };
2121
key <AC03> { [ d, D, Down] };
22-
key <AC04> { [ f, F, Righ] };
22+
key <AC04> { [ f, F, Right] };
2323
key <AC05> { [ g, G, BackSpace, BackSpace ] };
2424

2525
key <AB05> { [ b, B, Delete, Delete ] };
26+
27+
key <LCTL> {
28+
symbols[1] = [ {Control_L, ISO_Next_Group } ],
29+
actions[1] = [ {SetMods(modifiers=Control), SetGroup(group=+1) } ]
30+
};
2631
};

test/data/symbols/multiple_actions

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
default alphanumeric_keys modifier_keys
2+
xkb_symbols "basic" {
3+
name[1] = "Multiple actions";
4+
5+
virtual_modifiers Alt, Super, LevelThree;
6+
7+
// Multiple keysyms but no actions: OK
8+
key <LCTL> {
9+
symbols[1] = [ { Control_L, ISO_Group_Shift } ]
10+
};
11+
// Multiple actions but no keysyms: OK, but will use NoSymbol
12+
key <RCTL> {
13+
actions[1] = [ { SetMods(modifiers=Control), SetGroup(group=+1) } ]
14+
};
15+
// Multiple keysyms and matching actions
16+
key <LVL3> {
17+
virtualModifiers = LevelThree,
18+
symbols[1] = [ { ISO_Level3_Shift, ISO_Group_Shift } ],
19+
actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ]
20+
};
21+
// Multiple actions and matching keysyms
22+
key <MDSW> {
23+
virtualModifiers = LevelThree,
24+
actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ],
25+
symbols[1] = [ { ISO_Level3_Shift, ISO_Group_Shift } ]
26+
};
27+
28+
// Incompatible actions and keysyms count: error
29+
key <LALT> {
30+
symbols[1] = [ { Alt_L } ],
31+
actions[1] = [ { SetMods(modifiers=Alt), SetGroup(group=+1) } ]
32+
};
33+
key <RALT> {
34+
symbols[1] = [ { Alt_R, ISO_Group_Shift } ],
35+
actions[1] = [ { SetMods(modifiers=Alt) } ]
36+
};
37+
key <LWIN> {
38+
symbols[1] = [ { Super_L, ISO_Group_Shift } ],
39+
actions[1] = [ { SetMods(modifiers=Super), SetGroup(group=+1), NoAction() } ]
40+
};
41+
key <RWIN> {
42+
symbols[1] = [ { Super_R, ISO_Group_Shift , NoSymbol } ],
43+
actions[1] = [ { SetMods(modifiers=Super), SetGroup(group=+1) } ]
44+
};
45+
46+
// Incompatible categories
47+
key <AB11> {
48+
symbols[1] = [ { Control_L, Shift_L } ]
49+
};
50+
modifier_map Control { <AB11> };
51+
key <AE13> {
52+
symbols[1] = [ { Control_L, Shift_L } ],
53+
actions[1] = [ { SetMods(modifiers=Control), SetMods(modifiers=Shift) } ]
54+
};
55+
56+
// Various overrides, different keysyms, no explicit actions
57+
key <AB01> { [ x ] };
58+
key <AB01> { [ { Control_L, ISO_Group_Shift } ] };
59+
60+
key <AB02> { [ { Control_L, ISO_Group_Shift } ] };
61+
key <AB02> { [ x ] };
62+
63+
// Various overrides, no keysyms, explicit actions
64+
key <AB03> { actions[1] = [ { SetMods(modifiers=LevelThree) } ] };
65+
key <AB03> { actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ] };
66+
67+
key <AB04> { actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ] };
68+
key <AB04> { actions[1] = [ { SetMods(modifiers=LevelThree) } ] };
69+
70+
// Various overrides, different keysyms & actions
71+
key <AB05> {
72+
virtualModifiers = LevelThree,
73+
symbols[1] = [ Control_L ],
74+
actions[1] = [ SetMods(modifiers=Control) ]
75+
};
76+
key <AB05> {
77+
symbols[1] = [ { ISO_Level3_Shift, ISO_Group_Shift } ],
78+
actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ]
79+
};
80+
81+
key <AB06> {
82+
virtualModifiers = LevelThree,
83+
symbols[1] = [ { ISO_Level3_Shift, ISO_Group_Shift } ],
84+
actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ]
85+
};
86+
key <AB06> {
87+
symbols[1] = [ Control_L ],
88+
actions[1] = [ SetMods(modifiers=Control) ]
89+
};
90+
91+
// Various overrides, same keysyms but different actions
92+
key <AB07> {
93+
virtualModifiers = LevelThree,
94+
symbols[1] = [ { ISO_Level3_Shift, ISO_Group_Shift } ],
95+
actions[1] = [ { SetMods(modifiers=Control), Private(type=254, data="foo") } ]
96+
};
97+
key <AB07> {
98+
symbols[1] = [ { ISO_Level3_Shift, ISO_Group_Shift } ],
99+
actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ]
100+
};
101+
102+
// Mix various number of keysyms/actions
103+
key <AC01> {
104+
symbols[1] = [ ISO_Level3_Shift , { ISO_Level3_Shift, ISO_Group_Shift } ]
105+
};
106+
key <AC02> {
107+
actions[1] = [ SetMods(modifiers=LevelThree), { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ]
108+
};
109+
key <AC03> {
110+
symbols[1] = [ ISO_Level3_Shift , { ISO_Level3_Shift, ISO_Group_Shift } ],
111+
actions[1] = [ SetMods(modifiers=LevelThree), { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ]
112+
};
113+
key <AC04> {
114+
symbols[1] = [ { ISO_Level3_Shift, ISO_Group_Shift }, ISO_Level3_Shift ]
115+
};
116+
key <AC05> {
117+
actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) }, SetMods(modifiers=LevelThree) ]
118+
};
119+
key <AC06> {
120+
symbols[1] = [ { ISO_Level3_Shift, ISO_Group_Shift }, ISO_Level3_Shift ],
121+
actions[1] = [ { SetMods(modifiers=LevelThree), SetGroup(group=+1) }, SetMods(modifiers=LevelThree) ]
122+
};
123+
key <AC07> {
124+
symbols[1] = [ ISO_Level3_Shift , { ISO_Level3_Shift, ISO_Group_Shift }, { ISO_Level3_Shift, ISO_Group_Shift } ]
125+
};
126+
key <AC08> {
127+
actions[1] = [ SetMods(modifiers=LevelThree), { SetMods(modifiers=LevelThree), SetGroup(group=+1) }, { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ]
128+
};
129+
key <AC09> {
130+
symbols[1] = [ ISO_Level3_Shift , { ISO_Level3_Shift, ISO_Group_Shift }, { ISO_Level3_Shift, ISO_Group_Shift } ],
131+
actions[1] = [ SetMods(modifiers=LevelThree), { SetMods(modifiers=LevelThree), SetGroup(group=+1) }, { SetMods(modifiers=LevelThree), SetGroup(group=+1) } ]
132+
};
133+
134+
// Using modifier_map (may trigger multiple interprets)
135+
key <AD01> { symbols[1] = [ { a, b } ] };
136+
modifier_map Shift { <AD01> };
137+
138+
// Our only alphanum key ✨
139+
key <AE02> { [ 2, at ] };
140+
};

0 commit comments

Comments
 (0)