Hash :
1ff77ecd
Author :
Date :
2009-03-05T18:20:15
Rename headers to XKBcommon* and install in extensions directory Following the kbproto convention, the headers will be named XKBcommon.h and XKBcommonint.h. Furthermore, they'll be installed in X11/extensions directory with the rest of the XKB headers.
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
#include "X11/extensions/XKBcommon.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
static void print_keysym(const char *s)
{
KeySym ks = XkbcStringToKeysym(s);
if (ks == NoSymbol)
printf("NoSymbol\n");
else
printf("0x%lX\n", ks);
}
static void print_string(KeySym ks)
{
char *s = XkbcKeysymToString(ks);
printf("%s\n", s ? s : "NULL");
}
int main(int argc, char *argv[])
{
int mode;
KeySym sym;
if (argc < 3) {
fprintf(stderr, "error: not enough arguments\n");
exit(EXIT_FAILURE);
}
if (strcmp(argv[1], "-k") == 0) {
mode = 0;
sym = strtoul(argv[2], NULL, 16);
}
else if (strcmp(argv[1], "-s") == 0)
mode = 1;
else {
fprintf(stderr, "error: unrecognized argument \"%s\"\n", argv[1]);
exit(EXIT_FAILURE);
}
if (mode == 0)
print_string(sym);
else
print_keysym(argv[2]);
return 0;
}