more cleanup

This commit is contained in:
mbattista 2021-04-10 23:48:23 +00:00
parent 82062637ae
commit 1038dd109a
2 changed files with 4 additions and 4 deletions

View File

@ -126,9 +126,9 @@ KeyCode XkbKeysymToKeycode(KeySym keysym) {
return keycode; return keycode;
} }
int XKey(unsigned long key, int down) { void XKey(unsigned long key, int down) {
Display *display = getXDisplay(); Display *display = getXDisplay();
KeyCode code = -2; KeyCode code = 0;
code = XkbKeysymToKeycode(key); code = XkbKeysymToKeycode(key);
if (!code) { if (!code) {
@ -142,7 +142,7 @@ int XKey(unsigned long key, int down) {
XChangeKeyboardMapping(display, code, numcodes, keysym_list, 1); XChangeKeyboardMapping(display, code, numcodes, keysym_list, 1);
} }
if (!code) if (!code)
return -1; return;
XTestFakeKeyEvent(display, code, down, CurrentTime); XTestFakeKeyEvent(display, code, down, CurrentTime);
XSync(display, 0); XSync(display, 0);
} }

View File

@ -27,7 +27,7 @@
void XMove(int x, int y); void XMove(int x, int y);
void XScroll(int x, int y); void XScroll(int x, int y);
void XButton(unsigned int button, int down); void XButton(unsigned int button, int down);
int XKey(unsigned long key, int down); void XKey(unsigned long key, int down);
void XClipboardSet(char *src); void XClipboardSet(char *src);
char *XClipboardGet(); char *XClipboardGet();