Commit 0b7c8d619889b7c04a6dd9936c163e0b7c801025

Ran Benita 2013-02-08T14:32:47

action: take xkb_mod_set instead of the entire keymap A couple of modiifer actions need this information, but not the entire keymap. Signed-off-by: Ran Benita <ran234@gmail.com>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c
index 5389a03..5f1fd65 100644
--- a/src/xkbcomp/action.c
+++ b/src/xkbcomp/action.c
@@ -221,9 +221,9 @@ ReportActionNotArray(struct xkb_context *ctx, enum xkb_action_type action,
 }
 
 static bool
-HandleNoAction(struct xkb_keymap *keymap, union xkb_action *action,
-               enum action_field field, const ExprDef *array_ndx,
-               const ExprDef *value)
+HandleNoAction(struct xkb_context *ctx, const struct xkb_mod_set *mods,
+               union xkb_action *action, enum action_field field,
+               const ExprDef *array_ndx, const ExprDef *value)
 
 {
     return true;
@@ -252,16 +252,17 @@ CheckBooleanFlag(struct xkb_context *ctx, enum xkb_action_type action,
 }
 
 static bool
-CheckModifierField(struct xkb_keymap *keymap, enum xkb_action_type action,
-                   const ExprDef *array_ndx, const ExprDef *value,
-                   enum xkb_action_flags *flags_inout, xkb_mod_mask_t *mods_rtrn)
+CheckModifierField(struct xkb_context *ctx, const struct xkb_mod_set *mods,
+                   enum xkb_action_type action, const ExprDef *array_ndx,
+                   const ExprDef *value, enum xkb_action_flags *flags_inout,
+                   xkb_mod_mask_t *mods_rtrn)
 {
     if (array_ndx)
-        return ReportActionNotArray(keymap->ctx, action, ACTION_FIELD_MODIFIERS);
+        return ReportActionNotArray(ctx, action, ACTION_FIELD_MODIFIERS);
 
     if (value->expr.op == EXPR_IDENT) {
         const char *valStr;
-        valStr = xkb_atom_text(keymap->ctx, value->ident.ident);
+        valStr = xkb_atom_text(ctx, value->ident.ident);
         if (valStr && (istreq(valStr, "usemodmapmods") ||
                        istreq(valStr, "modmapmods"))) {
             *mods_rtrn = 0;
@@ -270,9 +271,8 @@ CheckModifierField(struct xkb_keymap *keymap, enum xkb_action_type action,
         }
     }
 
-    if (!ExprResolveModMask(keymap->ctx, value, MOD_BOTH, &keymap->mods,
-                            mods_rtrn))
-        return ReportMismatch(keymap->ctx, action,
+    if (!ExprResolveModMask(ctx, value, MOD_BOTH, mods, mods_rtrn))
+        return ReportMismatch(ctx, action,
                               ACTION_FIELD_MODIFIERS, "modifier mask");
 
     *flags_inout &= ~ACTION_MODS_LOOKUP_MODMAP;
@@ -307,32 +307,32 @@ CheckAffectField(struct xkb_context *ctx, enum xkb_action_type action,
 }
 
 static bool
-HandleSetLatchLockMods(struct xkb_keymap *keymap, union xkb_action *action,
-                       enum action_field field, const ExprDef *array_ndx,
-                       const ExprDef *value)
+HandleSetLatchLockMods(struct xkb_context *ctx, const struct xkb_mod_set *mods,
+                       union xkb_action *action, enum action_field field,
+                       const ExprDef *array_ndx, const ExprDef *value)
 {
     struct xkb_mod_action *act = &action->mods;
     const enum xkb_action_type type = action->type;
 
     if (field == ACTION_FIELD_MODIFIERS)
-        return CheckModifierField(keymap, action->type, array_ndx, value,
+        return CheckModifierField(ctx, mods, action->type, array_ndx, value,
                                   &act->flags, &act->mods.mods);
     if ((type == ACTION_TYPE_MOD_SET || type == ACTION_TYPE_MOD_LATCH) &&
         field == ACTION_FIELD_CLEAR_LOCKS)
-        return CheckBooleanFlag(keymap->ctx, action->type, field,
+        return CheckBooleanFlag(ctx, action->type, field,
                                 ACTION_LOCK_CLEAR, array_ndx, value,
                                 &act->flags);
     if (type == ACTION_TYPE_MOD_LATCH &&
         field == ACTION_FIELD_LATCH_TO_LOCK)
-        return CheckBooleanFlag(keymap->ctx, action->type, field,
+        return CheckBooleanFlag(ctx, action->type, field,
                                 ACTION_LATCH_TO_LOCK, array_ndx, value,
                                 &act->flags);
     if (type == ACTION_TYPE_MOD_LOCK &&
         field == ACTION_FIELD_AFFECT)
-        return CheckAffectField(keymap->ctx, action->type, array_ndx, value,
+        return CheckAffectField(ctx, action->type, array_ndx, value,
                                 &act->flags);
 
-    return ReportIllegal(keymap->ctx, action->type, field);
+    return ReportIllegal(ctx, action->type, field);
 }
 
 static bool
@@ -374,34 +374,34 @@ CheckGroupField(struct xkb_context *ctx, enum xkb_action_type action,
 }
 
 static bool
-HandleSetLatchLockGroup(struct xkb_keymap *keymap, union xkb_action *action,
-                        enum action_field field, const ExprDef *array_ndx,
-                        const ExprDef *value)
+HandleSetLatchLockGroup(struct xkb_context *ctx, const struct xkb_mod_set *mods,
+                        union xkb_action *action, enum action_field field,
+                        const ExprDef *array_ndx, const ExprDef *value)
 {
     struct xkb_group_action *act = &action->group;
     const enum xkb_action_type type = action->type;
 
     if (field == ACTION_FIELD_GROUP)
-        return CheckGroupField(keymap->ctx, action->type, array_ndx, value,
+        return CheckGroupField(ctx, action->type, array_ndx, value,
                                &act->flags, &act->group);
     if ((type == ACTION_TYPE_GROUP_SET || type == ACTION_TYPE_GROUP_LATCH) &&
         field == ACTION_FIELD_CLEAR_LOCKS)
-        return CheckBooleanFlag(keymap->ctx, action->type, field,
+        return CheckBooleanFlag(ctx, action->type, field,
                                 ACTION_LOCK_CLEAR, array_ndx, value,
                                 &act->flags);
     if (type == ACTION_TYPE_GROUP_LATCH &&
         field == ACTION_FIELD_LATCH_TO_LOCK)
-        return CheckBooleanFlag(keymap->ctx, action->type, field,
+        return CheckBooleanFlag(ctx, action->type, field,
                                 ACTION_LATCH_TO_LOCK, array_ndx, value,
                                 &act->flags);
 
-    return ReportIllegal(keymap->ctx, action->type, field);
+    return ReportIllegal(ctx, action->type, field);
 }
 
 static bool
-HandleMovePtr(struct xkb_keymap *keymap, union xkb_action *action,
-              enum action_field field, const ExprDef *array_ndx,
-              const ExprDef *value)
+HandleMovePtr(struct xkb_context *ctx, const struct xkb_mod_set *mods,
+              union xkb_action *action, enum action_field field,
+              const ExprDef *array_ndx, const ExprDef *value)
 {
     struct xkb_pointer_action *act = &action->ptr;
 
@@ -411,13 +411,13 @@ HandleMovePtr(struct xkb_keymap *keymap, union xkb_action *action,
                                value->expr.op != EXPR_UNARY_PLUS);
 
         if (array_ndx)
-            return ReportActionNotArray(keymap->ctx, action->type, field);
+            return ReportActionNotArray(ctx, action->type, field);
 
-        if (!ExprResolveInteger(keymap->ctx, value, &val))
-            return ReportMismatch(keymap->ctx, action->type, field, "integer");
+        if (!ExprResolveInteger(ctx, value, &val))
+            return ReportMismatch(ctx, action->type, field, "integer");
 
         if (val < INT16_MIN || val > INT16_MAX) {
-            log_err(keymap->ctx,
+            log_err(ctx,
                     "The %s field in the %s action must be in range %d..%d; "
                     "Action definition ignored\n",
                     fieldText(field), ActionTypeText(action->type),
@@ -439,17 +439,17 @@ HandleMovePtr(struct xkb_keymap *keymap, union xkb_action *action,
         return true;
     }
     else if (field == ACTION_FIELD_ACCEL) {
-        return CheckBooleanFlag(keymap->ctx, action->type, field,
+        return CheckBooleanFlag(ctx, action->type, field,
                                 ACTION_ACCEL, array_ndx, value, &act->flags);
     }
 
-    return ReportIllegal(keymap->ctx, action->type, field);
+    return ReportIllegal(ctx, action->type, field);
 }
 
 static bool
-HandlePtrBtn(struct xkb_keymap *keymap, union xkb_action *action,
-             enum action_field field, const ExprDef *array_ndx,
-             const ExprDef *value)
+HandlePtrBtn(struct xkb_context *ctx, const struct xkb_mod_set *mods,
+             union xkb_action *action, enum action_field field,
+             const ExprDef *array_ndx, const ExprDef *value)
 {
     struct xkb_pointer_button_action *act = &action->btn;
 
@@ -457,14 +457,14 @@ HandlePtrBtn(struct xkb_keymap *keymap, union xkb_action *action,
         int btn;
 
         if (array_ndx)
-            return ReportActionNotArray(keymap->ctx, action->type, field);
+            return ReportActionNotArray(ctx, action->type, field);
 
-        if (!ExprResolveButton(keymap->ctx, value, &btn))
-            return ReportMismatch(keymap->ctx, action->type, field,
+        if (!ExprResolveButton(ctx, value, &btn))
+            return ReportMismatch(ctx, action->type, field,
                                   "integer (range 1..5)");
 
         if (btn < 0 || btn > 5) {
-            log_err(keymap->ctx,
+            log_err(ctx,
                     "Button must specify default or be in the range 1..5; "
                     "Illegal button value %d ignored\n", btn);
             return false;
@@ -475,20 +475,20 @@ HandlePtrBtn(struct xkb_keymap *keymap, union xkb_action *action,
     }
     else if (action->type == ACTION_TYPE_PTR_LOCK &&
              field == ACTION_FIELD_AFFECT) {
-        return CheckAffectField(keymap->ctx, action->type, array_ndx, value,
+        return CheckAffectField(ctx, action->type, array_ndx, value,
                                 &act->flags);
     }
     else if (field == ACTION_FIELD_COUNT) {
         int val;
 
         if (array_ndx)
-            return ReportActionNotArray(keymap->ctx, action->type, field);
+            return ReportActionNotArray(ctx, action->type, field);
 
-        if (!ExprResolveInteger(keymap->ctx, value, &val))
-            return ReportMismatch(keymap->ctx, action->type, field, "integer");
+        if (!ExprResolveInteger(ctx, value, &val))
+            return ReportMismatch(ctx, action->type, field, "integer");
 
         if (val < 0 || val > 255) {
-            log_err(keymap->ctx,
+            log_err(ctx,
                     "The count field must have a value in the range 0..255; "
                     "Illegal count %d ignored\n", val);
             return false;
@@ -498,7 +498,7 @@ HandlePtrBtn(struct xkb_keymap *keymap, union xkb_action *action,
         return true;
     }
 
-    return ReportIllegal(keymap->ctx, action->type, field);
+    return ReportIllegal(ctx, action->type, field);
 }
 
 static const LookupEntry ptrDflts[] = {
@@ -509,9 +509,9 @@ static const LookupEntry ptrDflts[] = {
 };
 
 static bool
-HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action,
-                 enum action_field field, const ExprDef *array_ndx,
-                 const ExprDef *value)
+HandleSetPtrDflt(struct xkb_context *ctx, const struct xkb_mod_set *mods,
+                 union xkb_action *action, enum action_field field,
+                 const ExprDef *array_ndx, const ExprDef *value)
 {
     struct xkb_pointer_default_action *act = &action->dflt;
 
@@ -519,10 +519,10 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action,
         unsigned int val;
 
         if (array_ndx)
-            return ReportActionNotArray(keymap->ctx, action->type, field);
+            return ReportActionNotArray(ctx, action->type, field);
 
-        if (!ExprResolveEnum(keymap->ctx, value, &val, ptrDflts))
-            return ReportMismatch(keymap->ctx, action->type, field,
+        if (!ExprResolveEnum(ctx, value, &val, ptrDflts))
+            return ReportMismatch(ctx, action->type, field,
                                   "pointer component");
         return true;
     }
@@ -531,7 +531,7 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action,
         int btn;
 
         if (array_ndx)
-            return ReportActionNotArray(keymap->ctx, action->type, field);
+            return ReportActionNotArray(ctx, action->type, field);
 
         if (value->expr.op == EXPR_NEGATE ||
             value->expr.op == EXPR_UNARY_PLUS) {
@@ -543,18 +543,18 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action,
             button = value;
         }
 
-        if (!ExprResolveButton(keymap->ctx, button, &btn))
-            return ReportMismatch(keymap->ctx, action->type, field,
+        if (!ExprResolveButton(ctx, button, &btn))
+            return ReportMismatch(ctx, action->type, field,
                                   "integer (range 1..5)");
 
         if (btn < 0 || btn > 5) {
-            log_err(keymap->ctx,
+            log_err(ctx,
                     "New default button value must be in the range 1..5; "
                     "Illegal default button value %d ignored\n", btn);
             return false;
         }
         if (btn == 0) {
-            log_err(keymap->ctx,
+            log_err(ctx,
                     "Cannot set default pointer button to \"default\"; "
                     "Illegal default button setting ignored\n");
             return false;
@@ -564,13 +564,13 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action,
         return true;
     }
 
-    return ReportIllegal(keymap->ctx, action->type, field);
+    return ReportIllegal(ctx, action->type, field);
 }
 
 static bool
-HandleSwitchScreen(struct xkb_keymap *keymap, union xkb_action *action,
-                   enum action_field field, const ExprDef *array_ndx,
-                   const ExprDef *value)
+HandleSwitchScreen(struct xkb_context *ctx, const struct xkb_mod_set *mods,
+                   union xkb_action *action, enum action_field field,
+                   const ExprDef *array_ndx, const ExprDef *value)
 {
     struct xkb_switch_screen_action *act = &action->screen;
 
@@ -579,7 +579,7 @@ HandleSwitchScreen(struct xkb_keymap *keymap, union xkb_action *action,
         int val;
 
         if (array_ndx)
-            return ReportActionNotArray(keymap->ctx, action->type, field);
+            return ReportActionNotArray(ctx, action->type, field);
 
         if (value->expr.op == EXPR_NEGATE ||
             value->expr.op == EXPR_UNARY_PLUS) {
@@ -591,12 +591,12 @@ HandleSwitchScreen(struct xkb_keymap *keymap, union xkb_action *action,
             scrn = value;
         }
 
-        if (!ExprResolveInteger(keymap->ctx, scrn, &val))
-            return ReportMismatch(keymap->ctx, action->type, field,
+        if (!ExprResolveInteger(ctx, scrn, &val))
+            return ReportMismatch(ctx, action->type, field,
                                   "integer (0..255)");
 
         if (val < 0 || val > 255) {
-            log_err(keymap->ctx,
+            log_err(ctx,
                     "Screen index must be in the range 1..255; "
                     "Illegal screen value %d ignored\n", val);
             return false;
@@ -606,18 +606,18 @@ HandleSwitchScreen(struct xkb_keymap *keymap, union xkb_action *action,
         return true;
     }
     else if (field == ACTION_FIELD_SAME) {
-        return CheckBooleanFlag(keymap->ctx, action->type, field,
+        return CheckBooleanFlag(ctx, action->type, field,
                                 ACTION_SAME_SCREEN, array_ndx, value,
                                 &act->flags);
     }
 
-    return ReportIllegal(keymap->ctx, action->type, field);
+    return ReportIllegal(ctx, action->type, field);
 }
 
 static bool
-HandleSetLockControls(struct xkb_keymap *keymap, union xkb_action *action,
-                      enum action_field field, const ExprDef *array_ndx,
-                      const ExprDef *value)
+HandleSetLockControls(struct xkb_context *ctx, const struct xkb_mod_set *mods,
+                      union xkb_action *action, enum action_field field,
+                      const ExprDef *array_ndx, const ExprDef *value)
 {
     struct xkb_controls_action *act = &action->ctrls;
 
@@ -625,27 +625,27 @@ HandleSetLockControls(struct xkb_keymap *keymap, union xkb_action *action,
         enum xkb_action_controls mask;
 
         if (array_ndx)
-            return ReportActionNotArray(keymap->ctx, action->type, field);
+            return ReportActionNotArray(ctx, action->type, field);
 
-        if (!ExprResolveMask(keymap->ctx, value, &mask, ctrlMaskNames))
-            return ReportMismatch(keymap->ctx, action->type, field,
+        if (!ExprResolveMask(ctx, value, &mask, ctrlMaskNames))
+            return ReportMismatch(ctx, action->type, field,
                                   "controls mask");
 
         act->ctrls = mask;
         return true;
     }
     else if (field == ACTION_FIELD_AFFECT) {
-        return CheckAffectField(keymap->ctx, action->type, array_ndx, value,
+        return CheckAffectField(ctx, action->type, array_ndx, value,
                                 &act->flags);
     }
 
-    return ReportIllegal(keymap->ctx, action->type, field);
+    return ReportIllegal(ctx, action->type, field);
 }
 
 static bool
-HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action,
-              enum action_field field, const ExprDef *array_ndx,
-              const ExprDef *value)
+HandlePrivate(struct xkb_context *ctx, const struct xkb_mod_set *mods,
+              union xkb_action *action, enum action_field field,
+              const ExprDef *array_ndx, const ExprDef *value)
 {
     struct xkb_private_action *act = &action->priv;
 
@@ -653,13 +653,13 @@ HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action,
         int type;
 
         if (array_ndx)
-            return ReportActionNotArray(keymap->ctx, action->type, field);
+            return ReportActionNotArray(ctx, action->type, field);
 
-        if (!ExprResolveInteger(keymap->ctx, value, &type))
-            return ReportMismatch(keymap->ctx, ACTION_TYPE_PRIVATE, field, "integer");
+        if (!ExprResolveInteger(ctx, value, &type))
+            return ReportMismatch(ctx, ACTION_TYPE_PRIVATE, field, "integer");
 
         if (type < 0 || type > 255) {
-            log_err(keymap->ctx,
+            log_err(ctx,
                     "Private action type must be in the range 0..255; "
                     "Illegal type %d ignored\n", type);
             return false;
@@ -676,7 +676,7 @@ HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action,
          * make actions like these no-ops for now.
          */
         if (type < ACTION_TYPE_PRIVATE) {
-            log_info(keymap->ctx,
+            log_info(ctx,
                      "Private actions of type %s are not supported; Ignored\n",
                      ActionTypeText(type));
             act->type = ACTION_TYPE_NONE;
@@ -693,13 +693,13 @@ HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action,
             const char *str;
             size_t len;
 
-            if (!ExprResolveString(keymap->ctx, value, &val))
-                return ReportMismatch(keymap->ctx, action->type, field, "string");
+            if (!ExprResolveString(ctx, value, &val))
+                return ReportMismatch(ctx, action->type, field, "string");
 
-            str = xkb_atom_text(keymap->ctx, val);
+            str = xkb_atom_text(ctx, val);
             len = strlen(str);
             if (len < 1 || len > 7) {
-                log_warn(keymap->ctx,
+                log_warn(ctx,
                          "A private action has 7 data bytes; "
                          "Illegal data ignored\n");
                 return false;
@@ -711,26 +711,26 @@ HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action,
         else {
             int ndx, datum;
 
-            if (!ExprResolveInteger(keymap->ctx, array_ndx, &ndx)) {
-                log_err(keymap->ctx,
+            if (!ExprResolveInteger(ctx, array_ndx, &ndx)) {
+                log_err(ctx,
                         "Array subscript must be integer; "
                         "Illegal subscript ignored\n");
                 return false;
             }
 
             if (ndx < 0 || (size_t) ndx >= sizeof(act->data)) {
-                log_err(keymap->ctx,
+                log_err(ctx,
                         "The data for a private action is %lu bytes long; "
                         "Attempt to use data[%d] ignored\n",
                         (unsigned long) sizeof(act->data), ndx);
                 return false;
             }
 
-            if (!ExprResolveInteger(keymap->ctx, value, &datum))
-                return ReportMismatch(keymap->ctx, act->type, field, "integer");
+            if (!ExprResolveInteger(ctx, value, &datum))
+                return ReportMismatch(ctx, act->type, field, "integer");
 
             if (datum < 0 || datum > 255) {
-                log_err(keymap->ctx,
+                log_err(ctx,
                         "All data for a private action must be 0..255; "
                         "Illegal datum %d ignored\n", datum);
                 return false;
@@ -741,10 +741,11 @@ HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action,
         }
     }
 
-    return ReportIllegal(keymap->ctx, ACTION_TYPE_NONE, field);
+    return ReportIllegal(ctx, ACTION_TYPE_NONE, field);
 }
 
-typedef bool (*actionHandler)(struct xkb_keymap *keymap,
+typedef bool (*actionHandler)(struct xkb_context *ctx,
+                              const struct xkb_mod_set *mods,
                               union xkb_action *action,
                               enum action_field field,
                               const ExprDef *array_ndx,
@@ -772,22 +773,23 @@ static const actionHandler handleAction[_ACTION_TYPE_NUM_ENTRIES] = {
 /***====================================================================***/
 
 bool
-HandleActionDef(ExprDef *def, struct xkb_keymap *keymap,
-                union xkb_action *action, ActionsInfo *info)
+HandleActionDef(struct xkb_context *ctx, ActionsInfo *info,
+                const struct xkb_mod_set *mods, ExprDef *def,
+                union xkb_action *action)
 {
     ExprDef *arg;
     const char *str;
-    unsigned handler_type;
+    enum xkb_action_type handler_type;
 
     if (def->expr.op != EXPR_ACTION_DECL) {
-        log_err(keymap->ctx, "Expected an action definition, found %s\n",
+        log_err(ctx, "Expected an action definition, found %s\n",
                 expr_op_type_to_string(def->expr.op));
         return false;
     }
 
-    str = xkb_atom_text(keymap->ctx, def->action.name);
+    str = xkb_atom_text(ctx, def->action.name);
     if (!stringToAction(str, &handler_type)) {
-        log_err(keymap->ctx, "Unknown action %s\n", str);
+        log_err(ctx, "Unknown action %s\n", str);
         return false;
     }
 
@@ -823,12 +825,11 @@ HandleActionDef(ExprDef *def, struct xkb_keymap *keymap,
             value = (const ExprDef *) &constTrue;
         }
 
-        if (!ExprResolveLhs(keymap->ctx, field, &elemRtrn, &fieldRtrn,
-                            &arrayRtrn))
+        if (!ExprResolveLhs(ctx, field, &elemRtrn, &fieldRtrn, &arrayRtrn))
             return false;
 
         if (elemRtrn) {
-            log_err(keymap->ctx,
+            log_err(ctx,
                     "Cannot change defaults in an action definition; "
                     "Ignoring attempt to change %s.%s\n",
                     elemRtrn, fieldRtrn);
@@ -836,12 +837,12 @@ HandleActionDef(ExprDef *def, struct xkb_keymap *keymap,
         }
 
         if (!stringToField(fieldRtrn, &fieldNdx)) {
-            log_err(keymap->ctx, "Unknown field name %s\n", fieldRtrn);
+            log_err(ctx, "Unknown field name %s\n", fieldRtrn);
             return false;
         }
 
-        if (!handleAction[handler_type](keymap, action, fieldNdx, arrayRtrn,
-                                        value))
+        if (!handleAction[handler_type](ctx, mods, action, fieldNdx,
+                                        arrayRtrn, value))
             return false;
     }
 
@@ -849,8 +850,9 @@ HandleActionDef(ExprDef *def, struct xkb_keymap *keymap,
 }
 
 bool
-SetActionField(struct xkb_keymap *keymap, const char *elem, const char *field,
-               ExprDef *array_ndx, ExprDef *value, ActionsInfo *info)
+SetActionField(struct xkb_context *ctx, ActionsInfo *info,
+               struct xkb_mod_set *mods, const char *elem,
+               const char *field, ExprDef *array_ndx, ExprDef *value)
 {
     enum xkb_action_type action;
     enum action_field action_field;
@@ -859,10 +861,10 @@ SetActionField(struct xkb_keymap *keymap, const char *elem, const char *field,
         return false;
 
     if (!stringToField(field, &action_field)) {
-        log_err(keymap->ctx, "\"%s\" is not a legal field name\n", field);
+        log_err(ctx, "\"%s\" is not a legal field name\n", field);
         return false;
     }
 
-    return handleAction[action](keymap, &info->actions[action],
+    return handleAction[action](ctx, mods, &info->actions[action],
                                 action_field, array_ndx, value);
 }
diff --git a/src/xkbcomp/action.h b/src/xkbcomp/action.h
index 82915ef..1f92e7b 100644
--- a/src/xkbcomp/action.h
+++ b/src/xkbcomp/action.h
@@ -43,11 +43,14 @@ void
 FreeActionsInfo(ActionsInfo *info);
 
 bool
-HandleActionDef(ExprDef *def, struct xkb_keymap *keymap,
-                union xkb_action *action, ActionsInfo *info);
+HandleActionDef(struct xkb_context *ctx, ActionsInfo *info,
+                const struct xkb_mod_set *mods, ExprDef *def,
+                union xkb_action *action);
 
 bool
-SetActionField(struct xkb_keymap *keymap, const char *elem, const char *field,
-               ExprDef *array_ndx, ExprDef *value, ActionsInfo *info);
+SetActionField(struct xkb_context *ctx, ActionsInfo *info,
+               struct xkb_mod_set *mods, const char *elem,
+               const char *field, ExprDef *array_ndx, ExprDef *value);
+
 
 #endif
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index e94c231..772e3f3 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -461,8 +461,8 @@ SetInterpField(CompatInfo *info, SymInterpInfo *si, const char *field,
         if (arrayNdx)
             return ReportSINotArray(info, si, field);
 
-        if (!HandleActionDef(value, info->keymap, &si->interp.action,
-                             info->actions))
+        if (!HandleActionDef(info->ctx, info->actions, &info->keymap->mods,
+                             value, &si->interp.action))
             return false;
 
         si->defined |= SI_FIELD_ACTION;
@@ -633,8 +633,8 @@ HandleGlobalVar(CompatInfo *info, VarDef *stmt)
         ret = SetLedMapField(info, &info->default_led, field, ndx,
                              stmt->value);
     else
-        ret = SetActionField(info->keymap, elem, field, ndx, stmt->value,
-                             info->actions);
+        ret = SetActionField(info->ctx, info->actions, &info->keymap->mods,
+                             elem, field, ndx, stmt->value);
     return ret;
 }
 
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index 3803ea5..310fc0c 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -754,7 +754,8 @@ AddActionsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
     for (unsigned i = 0; i < nActs; i++) {
         union xkb_action *toAct = &darray_item(groupi->levels, i).action;
 
-        if (!HandleActionDef(act, info->keymap, toAct, info->actions))
+        if (!HandleActionDef(info->ctx, info->actions, &info->keymap->mods,
+                             act, toAct))
             log_err(info->ctx,
                     "Illegal action definition for %s; "
                     "Action for group %u/level %u ignored\n",
@@ -1024,8 +1025,8 @@ HandleGlobalVar(SymbolsInfo *info, VarDef *stmt)
         ret = true;
     }
     else {
-        ret = SetActionField(info->keymap, elem, field, arrayNdx, stmt->value,
-                             info->actions);
+        ret = SetActionField(info->ctx, info->actions, &info->keymap->mods,
+                             elem, field, arrayNdx, stmt->value);
     }
 
     return ret;