Commit 70c775f69d2a5ac529468a7d296523ecc171f547

Daniel Stone 2012-09-10T20:38:46

kbproto unentanglement: action flags Signed-off-by: Daniel Stone <daniel@fooishbar.org>

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
diff --git a/src/keymap-dump.c b/src/keymap-dump.c
index cca6313..6a139a1 100644
--- a/src/keymap-dump.c
+++ b/src/keymap-dump.c
@@ -385,16 +385,16 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
     case ACTION_TYPE_MOD_SET:
     case ACTION_TYPE_MOD_LATCH:
     case ACTION_TYPE_MOD_LOCK:
-        if (action->mods.flags & XkbSA_UseModMapMods)
+        if (action->mods.flags & ACTION_MODS_LOOKUP_MODMAP)
             args = "modMapMods";
         else
             args = VModMaskText(keymap, action->mods.mods.mods);
         write_buf(buf, "%s%s(modifiers=%s%s%s)%s", prefix, type, args,
                   (action->type != ACTION_TYPE_MOD_LOCK &&
-                   (action->mods.flags & XkbSA_ClearLocks)) ?
+                   (action->mods.flags & ACTION_LOCK_CLEAR)) ?
                    ",clearLocks" : "",
                   (action->type != ACTION_TYPE_MOD_LOCK &&
-                   (action->mods.flags & XkbSA_LatchToLock)) ?
+                   (action->mods.flags & ACTION_LATCH_TO_LOCK)) ?
                    ",latchToLock" : "",
                   suffix);
         break;
@@ -403,15 +403,15 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
     case ACTION_TYPE_GROUP_LATCH:
     case ACTION_TYPE_GROUP_LOCK:
         write_buf(buf, "%s%s(group=%s%d%s%s)%s", prefix, type,
-                  (!(action->group.flags & XkbSA_GroupAbsolute) &&
+                  (!(action->group.flags & ACTION_ABSOLUTE_SWITCH) &&
                    action->group.group > 0) ? "+" : "",
-                  (action->group.flags & XkbSA_GroupAbsolute) ?
+                  (action->group.flags & ACTION_ABSOLUTE_SWITCH) ?
                   action->group.group + 1 : action->group.group,
                   (action->type != ACTION_TYPE_GROUP_LOCK &&
-                   (action->group.flags & XkbSA_ClearLocks)) ?
+                   (action->group.flags & ACTION_LOCK_CLEAR)) ?
                   ",clearLocks" : "",
                   (action->type != ACTION_TYPE_GROUP_LOCK &&
-                   (action->group.flags & XkbSA_LatchToLock)) ?
+                   (action->group.flags & ACTION_LATCH_TO_LOCK)) ?
                   ",latchToLock" : "",
                   suffix);
         break;
@@ -422,27 +422,28 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
 
     case ACTION_TYPE_PTR_MOVE:
         write_buf(buf, "%s%s(x=%s%d,y=%s%d%s)%s", prefix, type,
-                  (!(action->ptr.flags & XkbSA_MoveAbsoluteX) &&
+                  (!(action->ptr.flags & ACTION_ABSOLUTE_X) &&
                    action->ptr.x >= 0) ? "+" : "",
                   action->ptr.x,
-                  (!(action->ptr.flags & XkbSA_MoveAbsoluteY) &&
+                  (!(action->ptr.flags & ACTION_ABSOLUTE_Y) &&
                    action->ptr.y >= 0) ? "+" : "",
                   action->ptr.y,
-                  (action->ptr.flags & XkbSA_NoAcceleration) ? ",!accel" : "",
+                  (action->ptr.flags & ACTION_NO_ACCEL) ? ",!accel" : "",
                   suffix);
         break;
 
     case ACTION_TYPE_PTR_LOCK:
-        switch (action->btn.flags & (XkbSA_LockNoUnlock | XkbSA_LockNoLock)) {
-        case XkbSA_LockNoUnlock:
+        switch (action->btn.flags &
+                 (ACTION_LOCK_NO_LOCK | ACTION_LOCK_NO_UNLOCK)) {
+        case ACTION_LOCK_NO_UNLOCK:
             args = ",affect=lock";
             break;
 
-        case XkbSA_LockNoLock:
+        case ACTION_LOCK_NO_LOCK:
             args = ",affect=unlock";
             break;
 
-        case XkbSA_LockNoLock | XkbSA_LockNoUnlock:
+        case ACTION_LOCK_NO_LOCK | ACTION_LOCK_NO_UNLOCK:
             args = ",affect=neither";
             break;
 
@@ -467,7 +468,7 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
         write_buf(buf, "%s%s(", prefix, type);
         if (action->dflt.affect == XkbSA_AffectDfltBtn)
             write_buf(buf, "affect=button,button=%s%d",
-                      (!(action->dflt.flags & XkbSA_DfltBtnAbsolute) &&
+                      (!(action->dflt.flags & ACTION_ABSOLUTE_SWITCH) &&
                        action->dflt.value >= 0) ? "+" : "",
                       action->dflt.value);
         write_buf(buf, ")%s", suffix);
@@ -475,10 +476,10 @@ write_action(struct xkb_keymap *keymap, struct buf *buf,
 
     case ACTION_TYPE_SWITCH_VT:
         write_buf(buf, "%s%s(screen=%s%d,%ssame)%s", prefix, type,
-                  (!(action->screen.flags & XkbSA_SwitchAbsolute) &&
+                  (!(action->screen.flags & ACTION_ABSOLUTE_SWITCH) &&
                    action->screen.screen >= 0) ? "+" : "",
                   action->screen.screen,
-                  (action->screen.flags & XkbSA_SwitchApplication) ? "!" : "",
+                  (action->screen.flags & ACTION_SAME_SCREEN) ? "!" : "",
                   suffix);
         break;
 
diff --git a/src/state.c b/src/state.c
index d62677c..d6f4a53 100644
--- a/src/state.c
+++ b/src/state.c
@@ -161,7 +161,7 @@ xkb_filter_group_set_func(struct xkb_filter *filter, xkb_keycode_t kc,
                           enum xkb_key_direction direction)
 {
     if (kc != filter->kc) {
-        filter->action.group.flags &= ~XkbSA_ClearLocks;
+        filter->action.group.flags &= ~ACTION_LOCK_CLEAR;
         return 1;
     }
 
@@ -173,11 +173,11 @@ xkb_filter_group_set_func(struct xkb_filter *filter, xkb_keycode_t kc,
         return 0;
     }
 
-    if (filter->action.group.flags & XkbSA_GroupAbsolute)
+    if (filter->action.group.flags & ACTION_ABSOLUTE_SWITCH)
         filter->state->base_group = filter->action.group.group;
     else
         filter->state->base_group = -filter->action.group.group;
-    if (filter->action.group.flags & XkbSA_ClearLocks)
+    if (filter->action.group.flags & ACTION_LOCK_CLEAR)
         filter->state->locked_group = 0;
 
     filter->func = NULL;
@@ -197,7 +197,7 @@ xkb_filter_group_set_new(struct xkb_state *state, xkb_keycode_t kc,
     filter->func = xkb_filter_group_set_func;
     filter->action = *action;
 
-    if (action->group.flags & XkbSA_GroupAbsolute) {
+    if (action->group.flags & ACTION_ABSOLUTE_SWITCH) {
         filter->action.group.group = filter->state->base_group;
         filter->state->base_group = action->group.group;
     }
@@ -239,7 +239,7 @@ xkb_filter_group_lock_new(struct xkb_state *state, xkb_keycode_t kc,
     filter->func = xkb_filter_group_lock_func;
     filter->action = *action;
 
-    if (action->group.flags & XkbSA_GroupAbsolute)
+    if (action->group.flags & ACTION_ABSOLUTE_SWITCH)
         filter->state->locked_group = action->group.group;
     else
         filter->state->locked_group += action->group.group;
@@ -252,7 +252,7 @@ xkb_filter_mod_set_func(struct xkb_filter *filter, xkb_keycode_t kc,
                         enum xkb_key_direction direction)
 {
     if (kc != filter->kc) {
-        filter->action.mods.flags &= ~XkbSA_ClearLocks;
+        filter->action.mods.flags &= ~ACTION_LOCK_CLEAR;
         return 1;
     }
 
@@ -265,7 +265,7 @@ xkb_filter_mod_set_func(struct xkb_filter *filter, xkb_keycode_t kc,
     }
 
     filter->state->clear_mods = filter->action.mods.mods.mask;
-    if (filter->action.mods.flags & XkbSA_ClearLocks)
+    if (filter->action.mods.flags & ACTION_LOCK_CLEAR)
         filter->state->locked_mods &= ~filter->action.mods.mods.mask;
 
     filter->func = NULL;
@@ -367,7 +367,7 @@ xkb_filter_mod_latch_func(struct xkb_filter *filter, xkb_keycode_t kc,
             action->mods.flags == filter->action.mods.flags &&
             action->mods.mods.mask == filter->action.mods.mods.mask) {
             filter->action = *action;
-            if (filter->action.mods.flags & XkbSA_LatchToLock) {
+            if (filter->action.mods.flags & ACTION_LATCH_TO_LOCK) {
                 filter->action.type = ACTION_TYPE_MOD_LOCK;
                 filter->func = xkb_filter_mod_lock_func;
                 filter->state->locked_mods |= filter->action.mods.mods.mask;
@@ -397,7 +397,7 @@ xkb_filter_mod_latch_func(struct xkb_filter *filter, xkb_keycode_t kc,
          * stage, so set PENDING and move our modifier from base to
          * latched. */
         if (latch == NO_LATCH ||
-            ((filter->action.mods.flags & XkbSA_ClearLocks) &&
+            ((filter->action.mods.flags & ACTION_LOCK_CLEAR) &&
              (filter->state->locked_mods & filter->action.mods.mods.mask) ==
              filter->action.mods.mods.mask)) {
             /* XXX: We might be a bit overenthusiastic about clearing
diff --git a/src/xkb-priv.h b/src/xkb-priv.h
index d9ec6a0..a36ebbe 100644
--- a/src/xkb-priv.h
+++ b/src/xkb-priv.h
@@ -153,6 +153,19 @@ enum xkb_action_type {
     ACTION_TYPE_LAST
 };
 
+enum xkb_action_flags {
+    ACTION_LOCK_CLEAR = (1 << 0),
+    ACTION_LATCH_TO_LOCK = (1 << 1),
+    ACTION_LOCK_NO_LOCK = (1 << 2),
+    ACTION_LOCK_NO_UNLOCK = (1 << 3),
+    ACTION_MODS_LOOKUP_MODMAP = (1 << 4),
+    ACTION_ABSOLUTE_SWITCH = (1 << 5),
+    ACTION_ABSOLUTE_X = (1 << 6),
+    ACTION_ABSOLUTE_Y = (1 << 7),
+    ACTION_NO_ACCEL = (1 << 8),
+    ACTION_SAME_SCREEN = (1 << 9),
+};
+
 struct xkb_mods {
     xkb_mod_mask_t mods;       /* original real+virtual mods in definition */
     xkb_mod_mask_t mask;       /* computed effective mask */
@@ -160,37 +173,38 @@ struct xkb_mods {
 
 struct xkb_mod_action {
     enum xkb_action_type type;
-    uint8_t flags;
+    enum xkb_action_flags flags;
     struct xkb_mods mods;
 };
 
 struct xkb_group_action {
     enum xkb_action_type type;
-    uint8_t flags;
+    enum xkb_action_flags flags;
     int32_t group;
 };
 
 struct xkb_controls_action {
     enum xkb_action_type type;
-    uint8_t flags;
+    enum xkb_action_flags flags;
     uint32_t ctrls;
 };
 
 struct xkb_pointer_default_action {
     enum xkb_action_type type;
-    uint8_t flags;
+    enum xkb_action_flags flags;
     uint8_t affect;
     int8_t value;
 };
 
 struct xkb_switch_screen_action {
     enum xkb_action_type type;
-    uint8_t flags;
+    enum xkb_action_flags flags;
     int8_t screen;
 };
 
 struct xkb_redirect_key_action {
     enum xkb_action_type type;
+    enum xkb_action_flags flags;
     xkb_keycode_t new_kc;
     uint8_t mods_mask;
     uint8_t mods;
@@ -200,20 +214,21 @@ struct xkb_redirect_key_action {
 
 struct xkb_pointer_action {
     enum xkb_action_type type;
-    uint8_t flags;
+    enum xkb_action_flags flags;
     int16_t x;
     int16_t y;
 };
 
 struct xkb_pointer_button_action {
     enum xkb_action_type type;
-    uint8_t flags;
+    enum xkb_action_flags flags;
     uint8_t count;
     int8_t button;
 };
 
 struct xkb_private_action {
     enum xkb_action_type type;
+    enum xkb_action_flags flags;
     uint8_t data[7];
 };
 
diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c
index 1ef9498..f5b3264 100644
--- a/src/xkbcomp/action.c
+++ b/src/xkbcomp/action.c
@@ -213,15 +213,15 @@ HandleNoAction(struct xkb_keymap *keymap, union xkb_action *action,
 static bool
 CheckLatchLockFlags(struct xkb_keymap *keymap, enum xkb_action_type action,
                     enum action_field field, const ExprDef * value,
-                    unsigned *flags_inout)
+                    enum xkb_action_flags *flags_inout)
 {
-    unsigned tmp;
+    enum xkb_action_flags tmp;
     bool result;
 
     if (field == ACTION_FIELD_CLEAR_LOCKS)
-        tmp = XkbSA_ClearLocks;
+        tmp = ACTION_LOCK_CLEAR;
     else if (field == ACTION_FIELD_LATCH_TO_LOCK)
-        tmp = XkbSA_LatchToLock;
+        tmp = ACTION_LATCH_TO_LOCK;
     else
         return false;           /* WSGO! */
 
@@ -238,7 +238,7 @@ CheckLatchLockFlags(struct xkb_keymap *keymap, enum xkb_action_type action,
 
 static bool
 CheckModifierField(struct xkb_keymap *keymap, enum xkb_action_type action,
-                   const ExprDef *value, unsigned *flags_inout,
+                   const ExprDef *value, enum xkb_action_flags *flags_inout,
                    xkb_mod_mask_t *mods_rtrn)
 {
     if (value->op == EXPR_IDENT) {
@@ -248,7 +248,7 @@ CheckModifierField(struct xkb_keymap *keymap, enum xkb_action_type action,
                        istreq(valStr, "modmapmods"))) {
 
             *mods_rtrn = 0;
-            *flags_inout |= XkbSA_UseModMapMods;
+            *flags_inout |= ACTION_MODS_LOOKUP_MODMAP;
             return true;
         }
     }
@@ -257,7 +257,7 @@ CheckModifierField(struct xkb_keymap *keymap, enum xkb_action_type action,
         return ReportMismatch(keymap, action,
                               ACTION_FIELD_MODIFIERS, "modifier mask");
 
-    *flags_inout &= ~XkbSA_UseModMapMods;
+    *flags_inout &= ~ACTION_MODS_LOOKUP_MODMAP;
     return true;
 }
 
@@ -267,8 +267,7 @@ HandleSetLatchMods(struct xkb_keymap *keymap, union xkb_action *action,
                    const ExprDef *value)
 {
     struct xkb_mod_action *act = &action->mods;
-    unsigned rtrn;
-    unsigned t1;
+    enum xkb_action_flags rtrn, t1;
     xkb_mod_mask_t t2;
 
     if (array_ndx != NULL) {
@@ -314,7 +313,7 @@ HandleLockMods(struct xkb_keymap *keymap, union xkb_action *action,
                const ExprDef *value)
 {
     struct xkb_mod_action *act = &action->mods;
-    unsigned t1;
+    enum xkb_action_flags t1;
     xkb_mod_mask_t t2;
 
     if (array_ndx && field == ACTION_FIELD_MODIFIERS)
@@ -339,17 +338,17 @@ HandleLockMods(struct xkb_keymap *keymap, union xkb_action *action,
 
 static bool
 CheckGroupField(struct xkb_keymap *keymap, unsigned action,
-                const ExprDef *value, unsigned *flags_inout,
+                const ExprDef *value, enum xkb_action_flags *flags_inout,
                 xkb_group_index_t *grp_rtrn)
 {
     const ExprDef *spec;
 
     if (value->op == EXPR_NEGATE || value->op == EXPR_UNARY_PLUS) {
-        *flags_inout &= ~XkbSA_GroupAbsolute;
+        *flags_inout &= ~ACTION_ABSOLUTE_SWITCH;
         spec = value->value.child;
     }
     else {
-        *flags_inout |= XkbSA_GroupAbsolute;
+        *flags_inout |= ACTION_ABSOLUTE_SWITCH;
         spec = value;
     }
 
@@ -371,8 +370,7 @@ HandleSetLatchGroup(struct xkb_keymap *keymap, union xkb_action *action,
                     const ExprDef *value)
 {
     struct xkb_group_action *act = &action->group;
-    unsigned rtrn;
-    unsigned t1;
+    enum xkb_action_flags rtrn, t1;
     xkb_group_index_t t2;
 
     if (array_ndx != NULL) {
@@ -419,7 +417,7 @@ HandleLockGroup(struct xkb_keymap *keymap, union xkb_action *action,
                 const ExprDef *value)
 {
     struct xkb_group_action *act = &action->group;
-    unsigned t1;
+    enum xkb_action_flags t1;
     xkb_group_index_t t2;
 
     if ((array_ndx != NULL) && (field == ACTION_FIELD_GROUP))
@@ -460,12 +458,12 @@ HandleMovePtr(struct xkb_keymap *keymap, union xkb_action *action,
 
         if (field == ACTION_FIELD_X) {
             if (absolute)
-                act->flags |= XkbSA_MoveAbsoluteX;
+                act->flags |= ACTION_ABSOLUTE_X;
             act->x = val;
         }
         else {
             if (absolute)
-                act->flags |= XkbSA_MoveAbsoluteY;
+                act->flags |= ACTION_ABSOLUTE_Y;
             act->y = val;
         }
 
@@ -478,9 +476,9 @@ HandleMovePtr(struct xkb_keymap *keymap, union xkb_action *action,
             return ReportMismatch(keymap, action->type, field, "boolean");
 
         if (set)
-            act->flags &= ~XkbSA_NoAcceleration;
+            act->flags &= ~ACTION_NO_ACCEL;
         else
-            act->flags |= XkbSA_NoAcceleration;
+            act->flags |= ACTION_NO_ACCEL;
     }
 
     return ReportIllegal(keymap, action->type, field);
@@ -488,9 +486,9 @@ HandleMovePtr(struct xkb_keymap *keymap, union xkb_action *action,
 
 static const LookupEntry lockWhich[] = {
     { "both", 0 },
-    { "lock", XkbSA_LockNoUnlock },
-    { "neither", (XkbSA_LockNoLock | XkbSA_LockNoUnlock) },
-    { "unlock", XkbSA_LockNoLock },
+    { "lock", ACTION_LOCK_NO_UNLOCK },
+    { "neither", (ACTION_LOCK_NO_LOCK | ACTION_LOCK_NO_UNLOCK) },
+    { "unlock", ACTION_LOCK_NO_LOCK },
     { NULL, 0 }
 };
 
@@ -523,7 +521,7 @@ HandlePtrBtn(struct xkb_keymap *keymap, union xkb_action *action,
     }
     else if (action->type == ACTION_TYPE_PTR_LOCK &&
              field == ACTION_FIELD_AFFECT) {
-        unsigned int val;
+        enum xkb_action_flags val;
 
         if (array_ndx)
             return ReportActionNotArray(keymap, action->type, field);
@@ -532,7 +530,7 @@ HandlePtrBtn(struct xkb_keymap *keymap, union xkb_action *action,
             return ReportMismatch(keymap, action->type, field,
                                   "lock or unlock");
 
-        act->flags &= ~(XkbSA_LockNoLock | XkbSA_LockNoUnlock);
+        act->flags &= ~(ACTION_LOCK_NO_LOCK | ACTION_LOCK_NO_UNLOCK);
         act->flags |= val;
         return true;
     }
@@ -593,11 +591,11 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action,
             return ReportActionNotArray(keymap, action->type, field);
 
         if (value->op == EXPR_NEGATE || value->op == EXPR_UNARY_PLUS) {
-            act->flags &= ~XkbSA_DfltBtnAbsolute;
+            act->flags &= ~ACTION_ABSOLUTE_SWITCH;
             button = value->value.child;
         }
         else {
-            act->flags |= XkbSA_DfltBtnAbsolute;
+            act->flags |= ACTION_ABSOLUTE_SWITCH;
             button = value;
         }
 
@@ -640,11 +638,11 @@ HandleSwitchScreen(struct xkb_keymap *keymap, union xkb_action *action,
             return ReportActionNotArray(keymap, action->type, field);
 
         if (value->op == EXPR_NEGATE || value->op == EXPR_UNARY_PLUS) {
-            act->flags &= ~XkbSA_SwitchAbsolute;
+            act->flags &= ~ACTION_ABSOLUTE_SWITCH;
             scrn = value->value.child;
         }
         else {
-            act->flags |= XkbSA_SwitchAbsolute;
+            act->flags |= ACTION_ABSOLUTE_SWITCH;
             scrn = value;
         }
 
@@ -672,9 +670,9 @@ HandleSwitchScreen(struct xkb_keymap *keymap, union xkb_action *action,
             return ReportMismatch(keymap, action->type, field, "boolean");
 
         if (set)
-            act->flags &= ~XkbSA_SwitchApplication;
+            act->flags &= ~ACTION_SAME_SCREEN;
         else
-            act->flags |= XkbSA_SwitchApplication;
+            act->flags |= ACTION_SAME_SCREEN;
 
         return true;
     }
diff --git a/src/xkbcomp/keymap.c b/src/xkbcomp/keymap.c
index aa113fd..210ccac 100644
--- a/src/xkbcomp/keymap.c
+++ b/src/xkbcomp/keymap.c
@@ -61,7 +61,7 @@ UpdateActionMods(struct xkb_keymap *keymap, union xkb_action *act,
         return;
     }
 
-    if (flags & XkbSA_UseModMapMods) {
+    if (flags & ACTION_MODS_LOOKUP_MODMAP) {
         /* XXX: what's that. */
         mods->mods &= 0xff;
         mods->mods |= rmodmask;