summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2022-10-26 09:43:17 +0200
committerRafael Marçalo <raroma09@gmail.com>2022-10-27 12:57:03 +0100
commit043a456627fdd9d9da4d74edb77f5b19be28c9cb (patch)
treedddec7b275c250dc57818ca5dceae2bf648ad521
parent37d67e5ab29ec672f7c70e34bb64a2de9e760b21 (diff)
dmenu: small XmbLookupString code improvements
* Increase the length of composed strings to the same limit as st (32 to 64 bytes). * Initialize ksym to NoSymbol to be safe: currently this is not an issue though. * Add comments to clarify the return values of XmbLookupString a bit.
-rw-r--r--dmenu.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/dmenu.c b/dmenu.c
index 89bbfbe..df21ba1 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -330,19 +330,19 @@ movewordedge(int dir)
static void
keypress(XKeyEvent *ev)
{
- char buf[32];
+ char buf[64];
int len;
- KeySym ksym;
+ KeySym ksym = NoSymbol;
Status status;
len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status);
switch (status) {
default: /* XLookupNone, XBufferOverflow */
return;
- case XLookupChars:
+ case XLookupChars: /* composed string from input method */
goto insert;
case XLookupKeySym:
- case XLookupBoth:
+ case XLookupBoth: /* a KeySym and a string are returned: use keysym */
break;
}