Commit ace1e5df6d2f9cd7ecf5fa5088d5c79fbd1edd64

Kristian Høgsberg 2012-05-09T09:05:00

Use our own keysyms

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
diff --git a/Makefile.am b/Makefile.am
index dcd9f24..c50880b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -93,7 +93,7 @@ makekeys_makekeys_CFLAGS = $(AM_CFLAGS) $(CFLAGS_FOR_BUILD)
 makekeys_makekeys_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS_FOR_BUILD)
 
 src/ks_tables.h: $(KEYSYMDEFS) $(top_builddir)/makekeys/makekeys$(EXEEXT)
-	$(top_builddir)/makekeys/makekeys $(KEYSYMDEFS) > $@
+	$(top_builddir)/makekeys/makekeys $(top_srcdir)/include/xkbcommon/xkbcommon-keysyms.h > $@
 
 # Tests
 
diff --git a/include/xkbcommon/xkbcommon.h b/include/xkbcommon/xkbcommon.h
index c80fad8..2c7ad22 100644
--- a/include/xkbcommon/xkbcommon.h
+++ b/include/xkbcommon/xkbcommon.h
@@ -85,6 +85,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 #include <xkbcommon/xkbcommon-keysyms.h>
 
+#define XKB_KEY_NoSymbol	     0L	/* special KeySym */
+
 typedef uint32_t xkb_keycode_t;
 typedef uint32_t xkb_keysym_t;
 typedef uint32_t xkb_mod_index_t;
@@ -97,8 +99,6 @@ typedef uint32_t xkb_led_index_t;
 #define XKB_KEYCODE_INVALID             (0xffffffff)
 #define XKB_LED_INVALID                 (0xffffffff)
 
-#define XKB_KEYSYM_NO_SYMBOL            0
-
 #define XKB_KEYCODE_MAX                 (0xffffffff - 1)
 #define xkb_keycode_is_legal_ext(kc)    (kc <= XKB_KEYCODE_MAX)
 #define xkb_keycode_is_legal_x11(kc)    (kc <= XKB_KEYCODE_MAX)
diff --git a/makekeys/makekeys.c b/makekeys/makekeys.c
index 1b873aa..9d77cdf 100644
--- a/makekeys/makekeys.c
+++ b/makekeys/makekeys.c
@@ -32,8 +32,8 @@ from The Open Group.
  */
 
 #include "xkbcommon/xkbcommon.h"
+#include "xkbcommon/xkbcommon-keysyms.h"
 
-#include <X11/keysymdef.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -62,40 +62,19 @@ parse_line(const char *buf, char *key, xkb_keysym_t *val, char *prefix)
 {
     int i;
     char alias[128];
-    char *tmp, *tmpa;
 
     /* See if we can catch a straight XK_foo 0x1234-style definition first;
      * the trickery around tmp is to account for prefices. */
     i = sscanf(buf, "#define %127s 0x%"SCNx32, key, val);
-    if (i == 2 && (tmp = strstr(key, "XK_"))) {
-        memcpy(prefix, key, tmp - key);
-        prefix[tmp - key] = '\0';
-        tmp += 3;
-        memmove(key, tmp, strlen(tmp) + 1);
+    if (i == 2 && strncmp(key, "XKB_KEY_", 8) == 0) {
+        prefix[0] = '\0';
+        memmove(key, key + 8, strlen(key + 8) + 1);
         return 1;
     }
 
-    /* Now try to catch alias (XK_foo XK_bar) definitions, and resolve them
-     * immediately: if the target is in the form XF86XK_foo, we need to
-     * canonicalise this to XF86foo before we do the lookup. */
     i = sscanf(buf, "#define %127s %127s", key, alias);
-    if (i == 2 && (tmp = strstr(key, "XK_")) && (tmpa = strstr(alias, "XK_"))) {
-        memcpy(prefix, key, tmp - key);
-        prefix[tmp - key] = '\0';
-        tmp += 3;
-        memmove(key, tmp, strlen(tmp) + 1);
-        memmove(tmpa, tmpa + 3, strlen(tmpa + 3) + 1);
-
-        for (i = ksnum - 1; i >= 0; i--) {
-            if (strcmp(info[i].name, alias) == 0) {
-                *val = info[i].val;
-                return 1;
-            }
-        }
-
-        fprintf(stderr, "can't find matching definition %s for keysym %s%s\n",
-                alias, prefix, key);
-    }
+    if (i == 2)
+	    fprintf(stderr, "can't parse keysym definition: %s", buf);
 
     return 0;
 }
@@ -128,7 +107,7 @@ main(int argc, char *argv[])
             if (!parse_line(buf, key, &val, prefix))
                 continue;
 
-            if (val == XK_VoidSymbol)
+            if (val == XKB_KEY_VoidSymbol)
                 val = 0;
             if (val > 0x1fffffff) {
                 fprintf(stderr, "ignoring illegal keysym (%s, %"PRIx32")\n", key,
@@ -154,9 +133,9 @@ main(int argc, char *argv[])
         fclose(fptr);
     }
 
-    /* Special case XKB_KEYSYM_NO_SYMBOL. */
+    /* Special case XKB_KEY_NoSymbol. */
     info[ksnum].name = strdup("NoSymbol");
-    info[ksnum].val = XKB_KEYSYM_NO_SYMBOL;
+    info[ksnum].val = XKB_KEY_NoSymbol;
     ksnum++;
 
     printf("/* This file is generated from keysymdef.h. */\n");
diff --git a/src/keysym.c b/src/keysym.c
index 5079419..1a9c7ec 100644
--- a/src/keysym.c
+++ b/src/keysym.c
@@ -28,7 +28,6 @@ authorization from the authors.
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <X11/keysymdef.h>
 
 #include "ks_tables.h"
 #include "xkbmisc.h"
@@ -47,7 +46,7 @@ xkb_keysym_to_string(xkb_keysym_t ks, char *buffer, size_t size)
     }
 
     /* Not listed in keysymdef.h for hysterical raisins. */
-    if (ks == XKB_KEYSYM_NO_SYMBOL) {
+    if (ks == XKB_KEY_NoSymbol) {
         snprintf(buffer, size, "NoSymbol");
         return;
     }
@@ -117,7 +116,7 @@ xkb_string_to_keysym(const char *s)
             val = (entry[2] << 24) | (entry[3] << 16) |
                   (entry[4] << 8)  | entry[5];
             if (!val)
-                val = XK_VoidSymbol;
+                val = XKB_KEY_VoidSymbol;
             return val;
         }
 
@@ -132,20 +131,20 @@ xkb_string_to_keysym(const char *s)
     if (*s == 'U') {
         val = strtoul(&s[1], &tmp, 16);
         if (tmp && *tmp != '\0')
-            return XKB_KEYSYM_NO_SYMBOL;
+            return XKB_KEY_NoSymbol;
 
         if (val < 0x20 || (val > 0x7e && val < 0xa0))
-            return XKB_KEYSYM_NO_SYMBOL;
+            return XKB_KEY_NoSymbol;
         if (val < 0x100)
             return val;
         if (val > 0x10ffff)
-            return XKB_KEYSYM_NO_SYMBOL;
+            return XKB_KEY_NoSymbol;
         return val | 0x01000000;
     }
     else if (s[0] == '0' && s[1] == 'x') {
         val = strtoul(&s[2], &tmp, 16);
         if (tmp && *tmp != '\0')
-            return XKB_KEYSYM_NO_SYMBOL;
+            return XKB_KEY_NoSymbol;
 
         return val;
     }
@@ -157,12 +156,12 @@ xkb_string_to_keysym(const char *s)
         xkb_keysym_t ret;
         tmp = strdup(s);
         if (!tmp)
-            return XKB_KEYSYM_NO_SYMBOL;
+            return XKB_KEY_NoSymbol;
         memmove(&tmp[4], &tmp[5], strlen(s) - 5 + 1);
         ret = xkb_string_to_keysym(tmp);
         free(tmp);
         return ret;
     }
 
-    return XKB_KEYSYM_NO_SYMBOL;
+    return XKB_KEY_NoSymbol;
 }
diff --git a/src/misc.c b/src/misc.c
index f15631e..c2d17d5 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -28,7 +28,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #include "xkbmisc.h"
 #include "xkbcommon/xkbcommon.h"
 #include "XKBcommonint.h"
-#include <X11/keysym.h>
 
 #define mapSize(m) (sizeof(m) / sizeof(struct xkb_kt_map_entry))
 static struct xkb_kt_map_entry map2Level[]= {
@@ -192,69 +191,69 @@ _XkbcKSCheckCase(xkb_keysym_t ks)
 
     switch (set) {
     case 0: /* latin 1 */
-        if ((ks >= XK_A && ks <= XK_Z) ||
-            (ks >= XK_Agrave && ks <= XK_THORN && ks != XK_multiply))
+        if ((ks >= XKB_KEY_A && ks <= XKB_KEY_Z) ||
+            (ks >= XKB_KEY_Agrave && ks <= XKB_KEY_THORN && ks != XKB_KEY_multiply))
             rtrn |= _XkbKSUpper;
-        if ((ks >= XK_a && ks <= XK_z) ||
-            (ks >= XK_agrave && ks <= XK_ydiaeresis))
+        if ((ks >= XKB_KEY_a && ks <= XKB_KEY_z) ||
+            (ks >= XKB_KEY_agrave && ks <= XKB_KEY_ydiaeresis))
             rtrn |= _XkbKSLower;
         break;
     case 1: /* latin 2 */
-        if ((ks >= XK_Aogonek && ks <= XK_Zabovedot && ks != XK_breve) ||
-            (ks >= XK_Racute && ks<=XK_Tcedilla))
+        if ((ks >= XKB_KEY_Aogonek && ks <= XKB_KEY_Zabovedot && ks != XKB_KEY_breve) ||
+            (ks >= XKB_KEY_Racute && ks<=XKB_KEY_Tcedilla))
             rtrn |= _XkbKSUpper;
-        if ((ks >= XK_aogonek && ks <= XK_zabovedot && ks != XK_caron) ||
-            (ks >= XK_racute && ks <= XK_tcedilla))
+        if ((ks >= XKB_KEY_aogonek && ks <= XKB_KEY_zabovedot && ks != XKB_KEY_caron) ||
+            (ks >= XKB_KEY_racute && ks <= XKB_KEY_tcedilla))
             rtrn |= _XkbKSLower;
         break;
     case 2: /* latin 3 */
-        if ((ks >= XK_Hstroke && ks <= XK_Jcircumflex) ||
-            (ks >= XK_Cabovedot && ks <= XK_Scircumflex))
+        if ((ks >= XKB_KEY_Hstroke && ks <= XKB_KEY_Jcircumflex) ||
+            (ks >= XKB_KEY_Cabovedot && ks <= XKB_KEY_Scircumflex))
             rtrn |= _XkbKSUpper;
-        if ((ks >= XK_hstroke && ks <= XK_jcircumflex) ||
-            (ks >= XK_cabovedot && ks <= XK_scircumflex))
+        if ((ks >= XKB_KEY_hstroke && ks <= XKB_KEY_jcircumflex) ||
+            (ks >= XKB_KEY_cabovedot && ks <= XKB_KEY_scircumflex))
             rtrn |= _XkbKSLower;
         break;
     case 3: /* latin 4 */
-        if ((ks >= XK_Rcedilla && ks <= XK_Tslash) ||
-            (ks == XK_ENG) ||
-            (ks >= XK_Amacron && ks <= XK_Umacron))
+        if ((ks >= XKB_KEY_Rcedilla && ks <= XKB_KEY_Tslash) ||
+            (ks == XKB_KEY_ENG) ||
+            (ks >= XKB_KEY_Amacron && ks <= XKB_KEY_Umacron))
             rtrn |= _XkbKSUpper;
-        if ((ks >= XK_rcedilla && ks <= XK_tslash) ||
-            (ks == XK_eng) ||
-            (ks >= XK_amacron && ks <= XK_umacron))
+        if ((ks >= XKB_KEY_rcedilla && ks <= XKB_KEY_tslash) ||
+            (ks == XKB_KEY_eng) ||
+            (ks >= XKB_KEY_amacron && ks <= XKB_KEY_umacron))
             rtrn |= _XkbKSLower;
         break;
     case 18: /* latin 8 */
-        if ((ks == XK_Wcircumflex) ||
-            (ks == XK_Ycircumflex) ||
-            (ks == XK_Babovedot) ||
-            (ks == XK_Dabovedot) ||
-            (ks == XK_Fabovedot) ||
-            (ks == XK_Mabovedot) ||
-            (ks == XK_Pabovedot) ||
-            (ks == XK_Sabovedot) ||
-            (ks == XK_Tabovedot) ||
-            (ks == XK_Wdiaeresis) ||
-            (ks == XK_Ygrave))
+        if ((ks == XKB_KEY_Wcircumflex) ||
+            (ks == XKB_KEY_Ycircumflex) ||
+            (ks == XKB_KEY_Babovedot) ||
+            (ks == XKB_KEY_Dabovedot) ||
+            (ks == XKB_KEY_Fabovedot) ||
+            (ks == XKB_KEY_Mabovedot) ||
+            (ks == XKB_KEY_Pabovedot) ||
+            (ks == XKB_KEY_Sabovedot) ||
+            (ks == XKB_KEY_Tabovedot) ||
+            (ks == XKB_KEY_Wdiaeresis) ||
+            (ks == XKB_KEY_Ygrave))
             rtrn |= _XkbKSUpper;
-        if ((ks == XK_wcircumflex) ||
-            (ks == XK_ycircumflex) ||
-            (ks == XK_babovedot) ||
-            (ks == XK_dabovedot) ||
-            (ks == XK_fabovedot) ||
-            (ks == XK_mabovedot) ||
-            (ks == XK_pabovedot) ||
-            (ks == XK_sabovedot) ||
-            (ks == XK_tabovedot) ||
-            (ks == XK_wdiaeresis) ||
-            (ks == XK_ygrave))
+        if ((ks == XKB_KEY_wcircumflex) ||
+            (ks == XKB_KEY_ycircumflex) ||
+            (ks == XKB_KEY_babovedot) ||
+            (ks == XKB_KEY_dabovedot) ||
+            (ks == XKB_KEY_fabovedot) ||
+            (ks == XKB_KEY_mabovedot) ||
+            (ks == XKB_KEY_pabovedot) ||
+            (ks == XKB_KEY_sabovedot) ||
+            (ks == XKB_KEY_tabovedot) ||
+            (ks == XKB_KEY_wdiaeresis) ||
+            (ks == XKB_KEY_ygrave))
             rtrn |= _XkbKSLower;
         break;
     case 19: /* latin 9 */
-        if (ks == XK_OE || ks == XK_Ydiaeresis)
+        if (ks == XKB_KEY_OE || ks == XKB_KEY_Ydiaeresis)
             rtrn |= _XkbKSUpper;
-        if (ks == XK_oe)
+        if (ks == XKB_KEY_oe)
             rtrn |= _XkbKSLower;
         break;
     }
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index 18d1615..13c1ede 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -777,8 +777,8 @@ CopyInterps(CompatInfo * info,
     for (si = info->interps; si; si = (SymInterpInfo *) si->defs.next)
     {
         if (((si->interp.match & XkbSI_OpMask) != pred) ||
-            (needSymbol && (si->interp.sym == XKB_KEYSYM_NO_SYMBOL)) ||
-            ((!needSymbol) && (si->interp.sym != XKB_KEYSYM_NO_SYMBOL)))
+            (needSymbol && (si->interp.sym == XKB_KEY_NoSymbol)) ||
+            ((!needSymbol) && (si->interp.sym != XKB_KEY_NoSymbol)))
             continue;
         if (compat->num_si >= compat->size_si)
         {
@@ -892,7 +892,7 @@ UpdateActionMods(struct xkb_keymap *xkb, union xkb_action *act, uint32_t rmodmas
 /**
  * Find an interpretation which applies to this particular level, either by
  * finding an exact match for the symbol and modifier combination, or a
- * generic XKB_KEYSYM_NO_SYMBOL match.
+ * generic XKB_KEY_NoSymbol match.
  */
 static struct xkb_sym_interpret *
 FindInterpForKey(struct xkb_keymap *xkb, xkb_keycode_t key, uint32_t group, uint32_t level)
@@ -912,7 +912,7 @@ FindInterpForKey(struct xkb_keymap *xkb, xkb_keycode_t key, uint32_t group, uint
         bool found;
 
         if ((num_syms > 1 || interp->sym != syms[0]) &&
-            interp->sym != XKB_KEYSYM_NO_SYMBOL)
+            interp->sym != XKB_KEY_NoSymbol)
             continue;
 
         if (level == 0 || !(interp->match & XkbSI_LevelOneOnly))
@@ -941,7 +941,7 @@ FindInterpForKey(struct xkb_keymap *xkb, xkb_keycode_t key, uint32_t group, uint
             break;
         }
 
-        if (found && interp->sym != XKB_KEYSYM_NO_SYMBOL)
+        if (found && interp->sym != XKB_KEY_NoSymbol)
             return interp;
         else if (found && !ret)
             ret = interp;
diff --git a/src/xkbcomp/expr.c b/src/xkbcomp/expr.c
index c33e78e..6078429 100644
--- a/src/xkbcomp/expr.c
+++ b/src/xkbcomp/expr.c
@@ -985,7 +985,7 @@ ExprResolveKeySym(ExprDef * expr,
         str = XkbcAtomText(expr->value.str);
         if (str) {
             sym = xkb_string_to_keysym(str);
-            if (sym != XKB_KEYSYM_NO_SYMBOL) {
+            if (sym != XKB_KEY_NoSymbol) {
                 val_rtrn->uval = sym;
                 return true;
             }
diff --git a/src/xkbcomp/parseutils.c b/src/xkbcomp/parseutils.c
index 06183c5..637a667 100644
--- a/src/xkbcomp/parseutils.c
+++ b/src/xkbcomp/parseutils.c
@@ -29,8 +29,6 @@
 #include "xkbpath.h"
 #include "xkbparse.h"
 
-#include <X11/keysym.h>
-
 ParseCommon *
 AppendStmt(ParseCommon * to, ParseCommon * append)
 {
@@ -540,17 +538,17 @@ LookupKeysym(const char *str, xkb_keysym_t *sym_rtrn)
     if ((!str) || (strcasecmp(str, "any") == 0) ||
         (strcasecmp(str, "nosymbol") == 0))
     {
-        *sym_rtrn = XKB_KEYSYM_NO_SYMBOL;
+        *sym_rtrn = XKB_KEY_NoSymbol;
         return 1;
     }
     else if ((strcasecmp(str, "none") == 0) ||
              (strcasecmp(str, "voidsymbol") == 0))
     {
-        *sym_rtrn = XK_VoidSymbol;
+        *sym_rtrn = XKB_KEY_VoidSymbol;
         return 1;
     }
     sym = xkb_string_to_keysym(str);
-    if (sym != XKB_KEYSYM_NO_SYMBOL)
+    if (sym != XKB_KEY_NoSymbol)
     {
         *sym_rtrn = sym;
         return 1;
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index 9582d8e..07adbb5 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -30,7 +30,6 @@
 #include "expr.h"
 #include "parseutils.h"
 
-#include <X11/keysym.h>
 #include <stdlib.h>
 
 #include "expr.h"
@@ -1079,7 +1078,7 @@ AddSymbolsToKey(KeyInfo * key,
                      value->value.list.syms[i], longText(key->name), ndx + 1,
                      XkbcAtomText(info->groupNames[ndx]), nSyms);
                 while (--j >= 0)
-                    key->syms[ndx][key->symsMapIndex[ndx][i] + j] = NoSymbol;
+                    key->syms[ndx][key->symsMapIndex[ndx][i] + j] = XKB_KEY_NoSymbol;
                 key->symsMapIndex[ndx][i] = -1;
                 key->symsMapNumEntries[ndx][i] = 0;
                 break;
diff --git a/src/xkbcomp/xkbparse.y b/src/xkbcomp/xkbparse.y
index ffccc75..0245792 100644
--- a/src/xkbcomp/xkbparse.y
+++ b/src/xkbcomp/xkbparse.y
@@ -31,7 +31,6 @@
 
 #include "parseutils.h"
 #include "xkbmisc.h"
-#include <X11/keysym.h>
 #include <stdlib.h>
 
 extern int yylex(union YYSTYPE *val, struct YYLTYPE *loc, void *scanner);
diff --git a/src/xkbmisc.h b/src/xkbmisc.h
index b9b9a39..eac6e57 100644
--- a/src/xkbmisc.h
+++ b/src/xkbmisc.h
@@ -64,7 +64,7 @@ _XkbcKSCheckCase(xkb_keysym_t sym);
 #define XkbcKSIsLower(k) (_XkbcKSCheckCase(k) & _XkbKSLower)
 #define XkbcKSIsUpper(k) (_XkbcKSCheckCase(k) & _XkbKSUpper)
 
-#define XkbKSIsKeypad(k) (((k) >= XK_KP_Space) && ((k) <= XK_KP_Equal))
+#define XkbKSIsKeypad(k) (((k) >= XKB_KEY_KP_Space) && ((k) <= XKB_KEY_KP_Equal))
 
 /***====================================================================***/
 
diff --git a/test/state.c b/test/state.c
index d698476..14c5229 100644
--- a/test/state.c
+++ b/test/state.c
@@ -26,7 +26,6 @@
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <X11/keysym.h>
 #include <linux/input.h>
 
 #include "xkbcommon/xkbcommon.h"
@@ -135,7 +134,7 @@ test_update_key(struct xkb_keymap *xkb)
                                         XKB_STATE_LOCKED));
     assert(xkb_state_led_name_is_active(state, "Caps Lock"));
     num_syms = xkb_key_get_syms(state, KEY_Q + EVDEV_OFFSET, &syms);
-    assert(num_syms == 1 && syms[0] == XK_Q);
+    assert(num_syms == 1 && syms[0] == XKB_KEY_Q);
 
     /* Caps unlocked */
     xkb_state_update_key(state, KEY_CAPSLOCK + EVDEV_OFFSET, XKB_KEY_DOWN);
@@ -144,7 +143,7 @@ test_update_key(struct xkb_keymap *xkb)
                                          XKB_STATE_EFFECTIVE));
     assert(!xkb_state_led_name_is_active(state, "Caps Lock"));
     num_syms = xkb_key_get_syms(state, KEY_Q + EVDEV_OFFSET, &syms);
-    assert(num_syms == 1 && syms[0] == XK_q);
+    assert(num_syms == 1 && syms[0] == XKB_KEY_q);
 
     xkb_state_unref(state);
 }
diff --git a/test/xkey.c b/test/xkey.c
index 3024a4d..68ffa71 100644
--- a/test/xkey.c
+++ b/test/xkey.c
@@ -35,7 +35,7 @@ int
 main(void)
 {
     assert(test_string("Undo", 0xFF65));
-    assert(test_string("ThisKeyShouldNotExist", XKB_KEYSYM_NO_SYMBOL));
+    assert(test_string("ThisKeyShouldNotExist", XKB_KEY_NoSymbol));
     assert(test_string("XF86_Switch_VT_5", 0x1008FE05));
     assert(test_string("VoidSymbol", 0xFFFFFF));
     assert(test_string("U4567", 0x1004567));