From 9c0a2f59b224a6a34746f4cd0e4a52ba44f26aea Mon Sep 17 00:00:00 2001 From: speedie Date: Fri, 10 Feb 2023 11:32:17 +0100 Subject: [PATCH] switch from deprecated XKeycodeToKeysym() to XkbKeycodeToKeysym() --- draw.c | 2 +- spmenu.c | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/draw.c b/draw.c index c83118d..e80bf50 100644 --- a/draw.c +++ b/draw.c @@ -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; diff --git a/spmenu.c b/spmenu.c index 7b2b52b..c4aec0f 100644 --- a/spmenu.c +++ b/spmenu.c @@ -20,6 +20,7 @@ static char fribidi_text[BUFSIZ] = ""; #endif +#include #include #include #include @@ -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 Set the right arrow to \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 Set the spmenu font to \n" "spmenu -nif Set the normal item foreground color\n" "spmenu -nib 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 Set the normal background color\n" "spmenu -nf Set the normal foreground color\n" "spmenu -sb Set the selected background color\n"