keysyms.c 15.9 KB
Newer Older
Jonathan Landis's avatar
Jonathan Landis committed
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
/*
 * Copyright © 2008 Ian Osgood <iano@quirkster.com>
 * Copyright © 2008 Jamey Sharp <jamey@minilop.net>
 * Copyright © 2008 Josh Triplett <josh@freedesktop.org>
 * Copyright © 2008 Ulrich Eckhardt <doomster@knuut.de>
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use, copy,
 * modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 * Except as contained in this notice, the names of the authors or
 * their institutions shall not be used in advertising or otherwise to
 * promote the sale, use or other dealings in this Software without
 * prior written authorization from the authors.
 */

32
#include <stdlib.h>
Josh Triplett's avatar
Josh Triplett committed
33

34
#include <xcb/xcb.h>
Josh Triplett's avatar
Josh Triplett committed
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#define XK_MISCELLANY
#define XK_XKB_KEYS
#define XK_LATIN1
#define XK_LATIN2
#define XK_LATIN3
#define XK_LATIN4
#define XK_CYRILLIC
#define XK_GREEK
#define XK_ARMENIAN
#include <X11/keysymdef.h>

#include "xcb_keysyms.h"

/* Private declaration */
enum tag_t {
  TAG_COOKIE,
  TAG_VALUE
};

struct _XCBKeySymbols
{
56
  xcb_connection_t *c;
Josh Triplett's avatar
Josh Triplett committed
57
58
  enum tag_t     tag;
  union {
59
60
    xcb_get_keyboard_mapping_cookie_t cookie;
    xcb_get_keyboard_mapping_reply_t *reply;
Josh Triplett's avatar
Josh Triplett committed
61
62
63
  } u;
};

64
65
66
static void xcb_convert_case(xcb_keysym_t  sym,
			   xcb_keysym_t *lower,
			   xcb_keysym_t *upper);
Josh Triplett's avatar
Josh Triplett committed
67

68
69
static void xcb_key_symbols_get_reply (xcb_key_symbols_t    *syms,
				   xcb_generic_error_t **e);
Josh Triplett's avatar
Josh Triplett committed
70
71
72

/* public implementation */

73
74
xcb_key_symbols_t *
xcb_key_symbols_alloc (xcb_connection_t *c)
Josh Triplett's avatar
Josh Triplett committed
75
{
76
77
78
  xcb_key_symbols_t *syms;
  xcb_keycode_t     min_keycode;
  xcb_keycode_t     max_keycode;
Josh Triplett's avatar
Josh Triplett committed
79

80
  if (!c || xcb_connection_has_error(c))
Josh Triplett's avatar
Josh Triplett committed
81
82
    return NULL;

83
  syms = malloc (sizeof (xcb_key_symbols_t));
84
85
  if (!syms)
    return NULL;
Josh Triplett's avatar
Josh Triplett committed
86
87
88
89

  syms->c = c;
  syms->tag = TAG_COOKIE;

90
91
  min_keycode = xcb_get_setup (c)->min_keycode;
  max_keycode = xcb_get_setup (c)->max_keycode;
Josh Triplett's avatar
Josh Triplett committed
92
  
93
  syms->u.cookie = xcb_get_keyboard_mapping(c,
Josh Triplett's avatar
Josh Triplett committed
94
					 min_keycode,
95
					 max_keycode - min_keycode + 1);
Josh Triplett's avatar
Josh Triplett committed
96
97
98
99
100
  
  return syms;
}

void
101
xcb_key_symbols_free (xcb_key_symbols_t *syms)
Josh Triplett's avatar
Josh Triplett committed
102
103
104
105
106
107
108
109
110
111
{
  if (syms)
    {
      if (syms->tag == TAG_VALUE)
	free (syms->u.reply);
      free (syms);
      syms = NULL;
    }
}

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
/*  Use of the 'col' parameter:

A list of KeySyms is associated with each KeyCode. The list is intended
to convey the set of symbols on the corresponding key. If the list
(ignoring trailing NoSymbol entries) is a single KeySym ``K'', then the
list is treated as if it were the list ``K NoSymbol K NoSymbol''. If the
list (ignoring trailing NoSymbol entries) is a pair of KeySyms ``K1
K2'', then the list is treated as if it were the list ``K1 K2 K1 K2''.
If the list (ignoring trailing NoSymbol entries) is a triple of KeySyms
``K1 K2 K3'', then the list is treated as if it were the list ``K1 K2 K3
NoSymbol''. When an explicit ``void'' element is desired in the list,
the value VoidSymbol can be used.

The first four elements of the list are split into two groups of
KeySyms. Group 1 contains the first and second KeySyms; Group 2 contains
the third and fourth KeySyms. Within each group, if the second element
of the group is NoSymbol , then the group should be treated as if the
second element were the same as the first element, except when the first
element is an alphabetic KeySym ``K'' for which both lowercase and
uppercase forms are defined. In that case, the group should be treated
as if the first element were the lowercase form of ``K'' and the second
element were the uppercase form of ``K.''

The standard rules for obtaining a KeySym from a KeyPress event make use
of only the Group 1 and Group 2 KeySyms; no interpretation of other
KeySyms in the list is given. Which group to use is determined by the
modifier state. Switching between groups is controlled by the KeySym
named MODE SWITCH, by attaching that KeySym to some KeyCode and
attaching that KeyCode to any one of the modifiers Mod1 through Mod5.
This modifier is called the group modifier. For any KeyCode, Group 1 is
used when the group modifier is off, and Group 2 is used when the group
modifier is on.

The Lock modifier is interpreted as CapsLock when the KeySym named
XK_Caps_Lock is attached to some KeyCode and that KeyCode is attached to
the Lock modifier. The Lock modifier is interpreted as ShiftLock when
the KeySym named XK_Shift_Lock is attached to some KeyCode and that
KeyCode is attached to the Lock modifier. If the Lock modifier could be
interpreted as both CapsLock and ShiftLock, the CapsLock interpretation
is used.

The operation of keypad keys is controlled by the KeySym named
XK_Num_Lock, by attaching that KeySym to some KeyCode and attaching that
KeyCode to any one of the modifiers Mod1 through Mod5 . This modifier is
called the numlock modifier. The standard KeySyms with the prefix
``XK_KP_'' in their name are called keypad KeySyms; these are KeySyms
with numeric value in the hexadecimal range 0xFF80 to 0xFFBD inclusive.
In addition, vendor-specific KeySyms in the hexadecimal range 0x11000000
to 0x1100FFFF are also keypad KeySyms.

Within a group, the choice of KeySym is determined by applying the first
rule that is satisfied from the following list:

* The numlock modifier is on and the second KeySym is a keypad KeySym. In
  this case, if the Shift modifier is on, or if the Lock modifier is on
  and is interpreted as ShiftLock, then the first KeySym is used,
  otherwise the second KeySym is used.

* The Shift and Lock modifiers are both off. In this case, the first
  KeySym is used.

* The Shift modifier is off, and the Lock modifier is on and is
  interpreted as CapsLock. In this case, the first KeySym is used, but
  if that KeySym is lowercase alphabetic, then the corresponding
  uppercase KeySym is used instead.

* The Shift modifier is on, and the Lock modifier is on and is
  interpreted as CapsLock. In this case, the second KeySym is used, but
  if that KeySym is lowercase alphabetic, then the corresponding
  uppercase KeySym is used instead.

* The Shift modifier is on, or the Lock modifier is on and is
  interpreted as ShiftLock, or both. In this case, the second KeySym is
  used.

*/

189
xcb_keysym_t xcb_key_symbols_get_keysym (xcb_key_symbols_t *syms,
190
191
				  xcb_keycode_t     keycode,
				  int            col)
Josh Triplett's avatar
Josh Triplett committed
192
{
193
  xcb_keysym_t *keysyms;
194
  xcb_keysym_t  keysym_null = { XCB_NO_SYMBOL };
195
196
197
198
  xcb_keysym_t  lsym;
  xcb_keysym_t  usym;
  xcb_keycode_t min_keycode;
  xcb_keycode_t max_keycode;
Josh Triplett's avatar
Josh Triplett committed
199
200
  int        per;
  
201
  if (!syms || xcb_connection_has_error(syms->c))
Josh Triplett's avatar
Josh Triplett committed
202
203
    return keysym_null;
  
204
  xcb_key_symbols_get_reply (syms, NULL);
205
206
207

  if (!syms->u.reply)
    return keysym_null;
Josh Triplett's avatar
Josh Triplett committed
208
  
209
210
211
  keysyms = xcb_get_keyboard_mapping_keysyms (syms->u.reply);
  min_keycode = xcb_get_setup (syms->c)->min_keycode;
  max_keycode = xcb_get_setup (syms->c)->max_keycode;
Josh Triplett's avatar
Josh Triplett committed
212
213
214

  per = syms->u.reply->keysyms_per_keycode;
  if ((col < 0) || ((col >= per) && (col > 3)) ||
215
216
      (keycode < min_keycode) ||
      (keycode > max_keycode))
Josh Triplett's avatar
Josh Triplett committed
217
218
    return keysym_null;

219
  keysyms = &keysyms[(keycode - min_keycode) * per];
Josh Triplett's avatar
Josh Triplett committed
220
221
222
223
  if (col < 4)
    {
      if (col > 1)
	{
224
	  while ((per > 2) && (keysyms[per - 1] == XCB_NO_SYMBOL))
Josh Triplett's avatar
Josh Triplett committed
225
226
227
228
	    per--;
	  if (per < 3)
	    col -= 2;
	}
229
      if ((per <= (col|1)) || (keysyms[col|1] == XCB_NO_SYMBOL))
Josh Triplett's avatar
Josh Triplett committed
230
	{
231
	  xcb_convert_case(keysyms[col&~1], &lsym, &usym);
Josh Triplett's avatar
Josh Triplett committed
232
233
	  if (!(col & 1))
	    return lsym;
234
	  else if (usym == lsym)
Josh Triplett's avatar
Josh Triplett committed
235
236
237
238
239
240
241
242
	    return keysym_null;
	  else
	    return usym;
	}
    }
  return keysyms[col];
}

243
244
245
xcb_keycode_t *
xcb_key_symbols_get_keycode(xcb_key_symbols_t *syms,
                            xcb_keysym_t      keysym)
Josh Triplett's avatar
Josh Triplett committed
246
{
247
248
  xcb_keysym_t ks;
  int j, nresult = 0;
249
  xcb_keycode_t i, min, max, *result = NULL, *result_np = NULL;
250

251
  if(syms && !xcb_connection_has_error(syms->c))
252
253
254
255
256
  {
      xcb_key_symbols_get_reply (syms, NULL);
      min = xcb_get_setup(syms->c)->min_keycode;
      max = xcb_get_setup(syms->c)->max_keycode;

257
258
259
      if (!syms->u.reply)
        return NULL;

260
261
      for(i = min; i && i <= max; i++)
          for(j = 0; j < syms->u.reply->keysyms_per_keycode; j++)
262
263
264
265
266
          {
              ks = xcb_key_symbols_get_keysym(syms, i, j);
              if(ks == keysym)
              {
                  nresult++;
267
268
269
270
271
272
273
274
275
276
                  result_np = realloc(result,
                                      sizeof(xcb_keycode_t) * (nresult + 1));

                  if(result_np == NULL)
                  {
                      free(result);
                      return NULL;
                  }

                  result = result_np;
277
278
                  result[nresult - 1] = i;
                  result[nresult] = XCB_NO_SYMBOL;
279
                  break;
280
281
282
              }
          }
  }
Josh Triplett's avatar
Josh Triplett committed
283
  
284
  return result;
Josh Triplett's avatar
Josh Triplett committed
285
286
}

287
xcb_keysym_t
288
289
290
xcb_key_press_lookup_keysym (xcb_key_symbols_t    *syms,
			 xcb_key_press_event_t *event,
			 int               col)
Josh Triplett's avatar
Josh Triplett committed
291
{
292
  return xcb_key_symbols_get_keysym (syms, event->detail, col);
Josh Triplett's avatar
Josh Triplett committed
293
294
}

295
xcb_keysym_t
296
297
298
xcb_key_release_lookup_keysym (xcb_key_symbols_t      *syms,
			   xcb_key_release_event_t *event,
			   int                 col)
Josh Triplett's avatar
Josh Triplett committed
299
{
300
  return xcb_key_symbols_get_keysym (syms, event->detail, col);
Josh Triplett's avatar
Josh Triplett committed
301
302
303
}

int
304
305
xcb_refresh_keyboard_mapping (xcb_key_symbols_t         *syms,
			   xcb_mapping_notify_event_t *event)
Josh Triplett's avatar
Josh Triplett committed
306
{
307
  if (event->request == XCB_MAPPING_KEYBOARD && syms && !xcb_connection_has_error(syms->c)) {
Josh Triplett's avatar
Josh Triplett committed
308
    if (syms->tag == TAG_VALUE) {
309
310
      xcb_keycode_t     min_keycode;
      xcb_keycode_t     max_keycode;
Josh Triplett's avatar
Josh Triplett committed
311
312
313
314
315
316

      if (syms->u.reply) {
	free (syms->u.reply);
	syms->u.reply = NULL;
      }
      syms->tag = TAG_COOKIE;
317
318
      min_keycode = xcb_get_setup (syms->c)->min_keycode;
      max_keycode = xcb_get_setup (syms->c)->max_keycode;
Josh Triplett's avatar
Josh Triplett committed
319
  
320
      syms->u.cookie = xcb_get_keyboard_mapping(syms->c,
Josh Triplett's avatar
Josh Triplett committed
321
					     min_keycode,
322
					     max_keycode - min_keycode + 1);
Josh Triplett's avatar
Josh Triplett committed
323
324
325
326
327
328
329
330
331
332
333
      
    }
    return 1;
  } 
  return 0;
}


/* Tests for classes of symbols */

int
334
xcb_is_keypad_key (xcb_keysym_t keysym)
Josh Triplett's avatar
Josh Triplett committed
335
{
336
  return ((keysym >= XK_KP_Space) && (keysym <= XK_KP_Equal));
Josh Triplett's avatar
Josh Triplett committed
337
338
339
}

int
340
xcb_is_private_keypad_key (xcb_keysym_t keysym)
Josh Triplett's avatar
Josh Triplett committed
341
{
342
  return ((keysym >= 0x11000000) && (keysym <= 0x1100FFFF));
Josh Triplett's avatar
Josh Triplett committed
343
344
345
}

int
346
xcb_is_cursor_key (xcb_keysym_t keysym)
Josh Triplett's avatar
Josh Triplett committed
347
{
348
  return ((keysym >= XK_Home) && (keysym <= XK_Select));
Josh Triplett's avatar
Josh Triplett committed
349
350
351
}

int
352
xcb_is_pf_key (xcb_keysym_t keysym)
Josh Triplett's avatar
Josh Triplett committed
353
{
354
  return ((keysym >= XK_KP_F1) && (keysym <= XK_KP_F4));
Josh Triplett's avatar
Josh Triplett committed
355
356
357
}

int
358
xcb_is_function_key (xcb_keysym_t keysym)
Josh Triplett's avatar
Josh Triplett committed
359
{
360
  return ((keysym >= XK_F1) && (keysym <= XK_F35));
Josh Triplett's avatar
Josh Triplett committed
361
362
363
}

int
364
xcb_is_misc_function_key (xcb_keysym_t keysym)
Josh Triplett's avatar
Josh Triplett committed
365
{
366
  return ((keysym >= XK_Select) && (keysym <= XK_Break));
Josh Triplett's avatar
Josh Triplett committed
367
368
369
}

int
370
xcb_is_modifier_key (xcb_keysym_t keysym)
Josh Triplett's avatar
Josh Triplett committed
371
{
372
  return  (((keysym >= XK_Shift_L)  && (keysym <= XK_Hyper_R)) ||
373
	   ((keysym >= XK_ISO_Lock) && (keysym <= XK_ISO_Level5_Lock)) ||
374
375
	   (keysym == XK_Mode_switch) ||
	   (keysym == XK_Num_Lock));
Josh Triplett's avatar
Josh Triplett committed
376
377
378
379
380
}

/* private functions */

void
381
382
383
xcb_convert_case(xcb_keysym_t  sym,
	       xcb_keysym_t *lower,
	       xcb_keysym_t *upper)
Josh Triplett's avatar
Josh Triplett committed
384
{
385
386
  *lower = sym;
  *upper = sym;
Josh Triplett's avatar
Josh Triplett committed
387

388
  switch(sym >> 8)
Josh Triplett's avatar
Josh Triplett committed
389
390
    {
    case 0: /* Latin 1 */
391
392
393
394
395
396
397
398
399
400
401
402
      if ((sym >= XK_A) && (sym <= XK_Z))
	*lower += (XK_a - XK_A);
      else if ((sym >= XK_a) && (sym <= XK_z))
	*upper -= (XK_a - XK_A);
      else if ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis))
	*lower += (XK_agrave - XK_Agrave);
      else if ((sym >= XK_agrave) && (sym <= XK_odiaeresis))
	*upper -= (XK_agrave - XK_Agrave);
      else if ((sym >= XK_Ooblique) && (sym <= XK_Thorn))
	*lower += (XK_oslash - XK_Ooblique);
      else if ((sym >= XK_oslash) && (sym <= XK_thorn))
	*upper -= (XK_oslash - XK_Ooblique);
Josh Triplett's avatar
Josh Triplett committed
403
404
      break;
    case 1: /* Latin 2 */
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
      /* Assume the KeySym is a legal value (ignore discontinuities) */
      if (sym == XK_Aogonek)
	*lower = XK_aogonek;
      else if (sym >= XK_Lstroke && sym <= XK_Sacute)
	*lower += (XK_lstroke - XK_Lstroke);
      else if (sym >= XK_Scaron && sym <= XK_Zacute)
	*lower += (XK_scaron - XK_Scaron);
      else if (sym >= XK_Zcaron && sym <= XK_Zabovedot)
	*lower += (XK_zcaron - XK_Zcaron);
      else if (sym == XK_aogonek)
	*upper = XK_Aogonek;
      else if (sym >= XK_lstroke && sym <= XK_sacute)
	*upper -= (XK_lstroke - XK_Lstroke);
      else if (sym >= XK_scaron && sym <= XK_zacute)
	*upper -= (XK_scaron - XK_Scaron);
      else if (sym >= XK_zcaron && sym <= XK_zabovedot)
	*upper -= (XK_zcaron - XK_Zcaron);
      else if (sym >= XK_Racute && sym <= XK_Tcedilla)
	*lower += (XK_racute - XK_Racute);
      else if (sym >= XK_racute && sym <= XK_tcedilla)
	*upper -= (XK_racute - XK_Racute);
Josh Triplett's avatar
Josh Triplett committed
426
427
      break;
    case 2: /* Latin 3 */
428
429
430
431
432
433
434
435
436
437
438
439
440
      /* Assume the KeySym is a legal value (ignore discontinuities) */
      if (sym >= XK_Hstroke && sym <= XK_Hcircumflex)
	*lower += (XK_hstroke - XK_Hstroke);
      else if (sym >= XK_Gbreve && sym <= XK_Jcircumflex)
	*lower += (XK_gbreve - XK_Gbreve);
      else if (sym >= XK_hstroke && sym <= XK_hcircumflex)
	*upper -= (XK_hstroke - XK_Hstroke);
      else if (sym >= XK_gbreve && sym <= XK_jcircumflex)
	*upper -= (XK_gbreve - XK_Gbreve);
      else if (sym >= XK_Cabovedot && sym <= XK_Scircumflex)
	*lower += (XK_cabovedot - XK_Cabovedot);
      else if (sym >= XK_cabovedot && sym <= XK_scircumflex)
	*upper -= (XK_cabovedot - XK_Cabovedot);
Josh Triplett's avatar
Josh Triplett committed
441
442
      break;
    case 3: /* Latin 4 */
443
444
445
446
447
448
449
450
451
452
453
454
455
      /* Assume the KeySym is a legal value (ignore discontinuities) */
      if (sym >= XK_Rcedilla && sym <= XK_Tslash)
	*lower += (XK_rcedilla - XK_Rcedilla);
      else if (sym >= XK_rcedilla && sym <= XK_tslash)
	*upper -= (XK_rcedilla - XK_Rcedilla);
      else if (sym == XK_ENG)
	*lower = XK_eng;
      else if (sym == XK_eng)
	*upper = XK_ENG;
      else if (sym >= XK_Amacron && sym <= XK_Umacron)
	*lower += (XK_amacron - XK_Amacron);
      else if (sym >= XK_amacron && sym <= XK_umacron)
	*upper -= (XK_amacron - XK_Amacron);
Josh Triplett's avatar
Josh Triplett committed
456
457
      break;
    case 6: /* Cyrillic */
458
459
460
461
462
463
464
465
466
      /* Assume the KeySym is a legal value (ignore discontinuities) */
      if (sym >= XK_Serbian_DJE && sym <= XK_Serbian_DZE)
	*lower -= (XK_Serbian_DJE - XK_Serbian_dje);
      else if (sym >= XK_Serbian_dje && sym <= XK_Serbian_dze)
	*upper += (XK_Serbian_DJE - XK_Serbian_dje);
      else if (sym >= XK_Cyrillic_YU && sym <= XK_Cyrillic_HARDSIGN)
	*lower -= (XK_Cyrillic_YU - XK_Cyrillic_yu);
      else if (sym >= XK_Cyrillic_yu && sym <= XK_Cyrillic_hardsign)
	*upper += (XK_Cyrillic_YU - XK_Cyrillic_yu);
Josh Triplett's avatar
Josh Triplett committed
467
468
      break;
    case 7: /* Greek */
469
470
471
472
473
474
475
476
477
478
479
480
      /* Assume the KeySym is a legal value (ignore discontinuities) */
      if (sym >= XK_Greek_ALPHAaccent && sym <= XK_Greek_OMEGAaccent)
	*lower += (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent);
      else if (sym >= XK_Greek_alphaaccent && sym <= XK_Greek_omegaaccent &&
	       sym != XK_Greek_iotaaccentdieresis &&
	       sym != XK_Greek_upsilonaccentdieresis)
	*upper -= (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent);
      else if (sym >= XK_Greek_ALPHA && sym <= XK_Greek_OMEGA)
	*lower += (XK_Greek_alpha - XK_Greek_ALPHA);
      else if (sym >= XK_Greek_alpha && sym <= XK_Greek_omega &&
	       sym != XK_Greek_finalsmallsigma)
	*upper -= (XK_Greek_alpha - XK_Greek_ALPHA);
Josh Triplett's avatar
Josh Triplett committed
481
482
      break;
    case 0x14: /* Armenian */
483
484
485
      if (sym >= XK_Armenian_AYB && sym <= XK_Armenian_fe) {
	*lower = sym | 1;
	*upper = sym & ~1;
Josh Triplett's avatar
Josh Triplett committed
486
487
488
489
490
491
      }
      break;
    }
}

void
492
493
xcb_key_symbols_get_reply (xcb_key_symbols_t    *syms,
		       xcb_generic_error_t **e)
Josh Triplett's avatar
Josh Triplett committed
494
495
496
497
498
499
500
{
  if (!syms)
    return;

  if (syms->tag == TAG_COOKIE)
    {
      syms->tag = TAG_VALUE;
501
      syms->u.reply = xcb_get_keyboard_mapping_reply(syms->c,
Josh Triplett's avatar
Josh Triplett committed
502
503
504
505
						 syms->u.cookie,
						 e);
    }
}