map keysyms to keycodes
This commit is contained in:
parent
9a6ca9b5b0
commit
8a56f238ad
@ -101,11 +101,21 @@ void XKey(unsigned long key, int down) {
|
||||
Display *display = getXDisplay();
|
||||
KeyCode code = XKeysymToKeycode(display, key);
|
||||
|
||||
if (code != 0) {
|
||||
// Map non-existing keysyms to new keycodes
|
||||
if(code == 0) {
|
||||
int min, max, numcodes;
|
||||
XDisplayKeycodes(display, &min, &max);
|
||||
XGetKeyboardMapping(display, min, max-min, &numcodes);
|
||||
|
||||
code = (max-min+1)*numcodes;
|
||||
KeySym keysym_list[numcodes];
|
||||
for(int i=0;i<numcodes;i++) keysym_list[i] = key;
|
||||
XChangeKeyboardMapping(display, code, numcodes, keysym_list, 1);
|
||||
}
|
||||
|
||||
XTestFakeKeyEvent(display, code, down, CurrentTime);
|
||||
XSync(display, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void XClipboardSet(char *src) {
|
||||
|
Reference in New Issue
Block a user