dmenu: small XmbLookupString code improvements e42c0366
* 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.
Hiltjo Posthuma · 2022-10-26 09:43 1 file(s) · +4 −4
dmenu.c +4 −4
324 324
static void
325 325
keypress(XKeyEvent *ev)
326 326
{
327 -
	char buf[32];
327 +
	char buf[64];
328 328
	int len;
329 -
	KeySym ksym;
329 +
	KeySym ksym = NoSymbol;
330 330
	Status status;
331 331
332 332
	len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status);
333 333
	switch (status) {
334 334
	default: /* XLookupNone, XBufferOverflow */
335 335
		return;
336 -
	case XLookupChars:
336 +
	case XLookupChars: /* composed string from input method */
337 337
		goto insert;
338 338
	case XLookupKeySym:
339 -
	case XLookupBoth:
339 +
	case XLookupBoth: /* a KeySym and a string are returned: use keysym */
340 340
		break;
341 341
	}
342 342