mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
simplify xorg condition.
This commit is contained in:
parent
80550350a8
commit
ac7200c630
@ -52,33 +52,33 @@ void XScroll(int x, int y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void XButton(unsigned int button, int down) {
|
void XButton(unsigned int button, int down) {
|
||||||
if (button != 0) {
|
if (button == 0) return;
|
||||||
Display *display = getXDisplay();
|
|
||||||
XTestFakeButtonEvent(display, button, down, CurrentTime);
|
Display *display = getXDisplay();
|
||||||
XSync(display, 0);
|
XTestFakeButtonEvent(display, button, down, CurrentTime);
|
||||||
}
|
XSync(display, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XKey(unsigned long key, int down) {
|
void XKey(unsigned long key, int down) {
|
||||||
if (key != 0) {
|
if (key == 0) return;
|
||||||
Display *display = getXDisplay();
|
|
||||||
KeyCode code = XKeysymToKeycode(display, key);
|
|
||||||
|
|
||||||
// Map non-existing keysyms to new keycodes
|
Display *display = getXDisplay();
|
||||||
if (code == 0) {
|
KeyCode code = XKeysymToKeycode(display, key);
|
||||||
int min, max, numcodes;
|
|
||||||
XDisplayKeycodes(display, &min, &max);
|
|
||||||
XGetKeyboardMapping(display, min, max-min, &numcodes);
|
|
||||||
|
|
||||||
code = (max-min+1)*numcodes;
|
// Map non-existing keysyms to new keycodes
|
||||||
KeySym keysym_list[numcodes];
|
if (code == 0) {
|
||||||
for(int i=0;i<numcodes;i++) keysym_list[i] = key;
|
int min, max, numcodes;
|
||||||
XChangeKeyboardMapping(display, code, numcodes, keysym_list, 1);
|
XDisplayKeycodes(display, &min, &max);
|
||||||
}
|
XGetKeyboardMapping(display, min, max-min, &numcodes);
|
||||||
|
|
||||||
XTestFakeKeyEvent(display, code, down, CurrentTime);
|
code = (max-min+1)*numcodes;
|
||||||
XSync(display, 0);
|
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 XGetScreenConfigurations() {
|
void XGetScreenConfigurations() {
|
||||||
|
Loading…
Reference in New Issue
Block a user