1
0
Fork 0

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.
This commit is contained in:
Hiltjo Posthuma 2022-10-26 09:43:17 +02:00
parent 1d2b462acf
commit e42c036634

View file

@ -324,19 +324,19 @@ movewordedge(int dir)
static void static void
keypress(XKeyEvent *ev) keypress(XKeyEvent *ev)
{ {
char buf[32]; char buf[64];
int len; int len;
KeySym ksym; KeySym ksym = NoSymbol;
Status status; Status status;
len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status); len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status);
switch (status) { switch (status) {
default: /* XLookupNone, XBufferOverflow */ default: /* XLookupNone, XBufferOverflow */
return; return;
case XLookupChars: case XLookupChars: /* composed string from input method */
goto insert; goto insert;
case XLookupKeySym: case XLookupKeySym:
case XLookupBoth: case XLookupBoth: /* a KeySym and a string are returned: use keysym */
break; break;
} }