switch from deprecated XKeycodeToKeysym() to XkbKeycodeToKeysym()

This commit is contained in:
speedie 2023-02-10 11:32:17 +01:00
parent 1ee4ff68f4
commit 9c0a2f59b2
2 changed files with 11 additions and 8 deletions

2
draw.c
View file

@ -168,7 +168,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
{
char buf[1024];
int ty;
unsigned int ew;
unsigned int ew = 0;
XftDraw *d = NULL;
size_t i, len;
int render = x || y || w || h;

View file

@ -20,6 +20,7 @@
static char fribidi_text[BUFSIZ] = "";
#endif
#include <X11/XKBlib.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
@ -1136,7 +1137,8 @@ keypress(XEvent *e)
ev = &e->xkey;
len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status);
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
//keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
keysym = XkbKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0, 0);
for (i = 0; i < LENGTH(keys); i++) {
if (keysym == keys[i].keysym && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state) && keys[i].func)
@ -1580,10 +1582,11 @@ setup(void)
types = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
dock = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DOCK", False);
if (!clineheight)
if (!clineheight) {
reqlineheight += lineheight;
else
} else {
reqlineheight = clineheight;
}
/* calculate menu geometry */
bh = drw->font->h + 2 + reqlineheight;
@ -1758,8 +1761,8 @@ usage(void)
"spmenu -ra <symbol> Set the right arrow to <symbol>\n"
"spmenu -wm Spawn spmenu as a window manager controlled client/window. Useful for testing\n"
"spmenu -v Print spmenu version to stdout\n"
"\n"
"- Appearance arguments -\n"
"\n", stdout);
fputs("- Appearance arguments -\n"
"spmenu -fn <font> Set the spmenu font to <font>\n"
"spmenu -nif <color> Set the normal item foreground color\n"
"spmenu -nib <color> Set the normal item background color\n"
@ -1799,8 +1802,8 @@ usage(void)
"spmenu -sgr13 Set the SGR 13 color\n"
"spmenu -sgr14 Set the SGR 14 color\n"
"spmenu -sgr15 Set the SGR 15 color\n"
"\n"
"- dmenu compatibility -\n"
"\n", stdout);
fputs("- dmenu compatibility -\n"
"spmenu -nb <color> Set the normal background color\n"
"spmenu -nf <color> Set the normal foreground color\n"
"spmenu -sb <color> Set the selected background color\n"