Guest User

[dwm] fix keysyms processing

a guest
Sep 29th, 2017
110
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff -up a/config.mk b/config.mk
  2. --- a/config.mk 2017-09-29 13:06:55.783472647 -0700
  3. +++ b/config.mk 2017-09-29 13:00:20.246627033 -0700
  4. @@ -27,7 +27,7 @@ LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS}
  5. # flags
  6. CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
  7. #CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
  8. -CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
  9. +CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
  10. LDFLAGS = -s ${LIBS}
  11.  
  12. # Solaris
  13. diff -up a/dwm.c b/dwm.c
  14. --- a/dwm.c 2017-09-29 13:06:55.785472631 -0700
  15. +++ b/dwm.c 2017-09-29 13:01:22.039135243 -0700
  16. @@ -988,16 +988,18 @@ void
  17. keypress(XEvent *e)
  18. {
  19. unsigned int i;
  20. - KeySym keysym;
  21. + KeySym *keysym;
  22. XKeyEvent *ev;
  23. + int keysyms;
  24.  
  25. ev = &e->xkey;
  26. - keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
  27. + keysym = XGetKeyboardMapping(dpy, (KeyCode)ev->keycode, 1, &keysyms);
  28. for (i = 0; i < LENGTH(keys); i++)
  29. - if (keysym == keys[i].keysym
  30. + if (keysym[0] == keys[i].keysym
  31. && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state)
  32. && keys[i].func)
  33. keys[i].func(&(keys[i].arg));
  34. + XFree(keysym);
  35. }
  36.  
  37. void
RAW Paste Data