blob: 600b565915bcaf8906feea5c36484d222d895ffa (
plain)
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
|
#!/usr/bin/env python
from __future__ import print_function
import re
import os
prefix = os.environ.get('X11_HEADERS_PREFIX', '/usr')
HEADERS = [
prefix + '/include/X11/keysymdef.h',
prefix + '/include/X11/XF86keysym.h',
prefix + '/include/X11/Sunkeysym.h',
prefix + '/include/X11/DECkeysym.h',
prefix + '/include/X11/HPkeysym.h',
]
print('''#ifndef _XKBCOMMON_KEYSYMS_H
#define _XKBCOMMON_KEYSYMS_H
/* This file is autogenerated; please do not commit directly. */
#define XKB_KEY_NoSymbol 0x000000 /* Special KeySym */
''')
for path in HEADERS:
with open(path) as header:
for line in header:
if '#ifdef' in line or '#ifndef' in line or '#endif' in line:
continue
# Remove #define _OSF_Keysyms and such.
if '#define _' in line:
continue
# Handle a duplicate definition in HPkeysyms.h which kicks in if
# it's not already defined.
if 'XK_Ydiaeresis' in line and '0x100000ee' in line:
continue
line = re.sub(r'#define\s*(\w*)XK_', r'#define XKB_KEY_\1', line)
print(line, end='')
print('\n\n#endif')
|