XKeycodeToKeysym --> XGetKeyboardMapping (XKeycodeToKeysym is allegedly deprecated)

This commit is contained in:
bakkeby 2020-09-18 10:39:07 +02:00
parent 7275ca47ff
commit 8aa21b0311

12
dwm.c
View File

@ -2054,16 +2054,18 @@ keypress(XEvent *e)
#endif // KEYMODES_PATCH #endif // KEYMODES_PATCH
{ {
unsigned int i; unsigned int i;
KeySym keysym; int keysyms_return;
KeySym* keysym;
XKeyEvent *ev; XKeyEvent *ev;
ev = &e->xkey; ev = &e->xkey;
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); keysym = XGetKeyboardMapping(dpy, (KeyCode)ev->keycode, 1, &keysyms_return);
for (i = 0; i < LENGTH(keys); i++) for (i = 0; i < LENGTH(keys); i++)
if (keysym == keys[i].keysym if (*keysym == keys[i].keysym
&& CLEANMASK(keys[i].mod) == CLEANMASK(ev->state) && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state)
&& keys[i].func) && keys[i].func)
keys[i].func(&(keys[i].arg)); keys[i].func(&(keys[i].arg));
XFree(keysym);
} }
void void