[hackers] [dmenu] dmenu: small XmbLookupString code improvements || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Wed, 26 Oct 2022 09:53:50 +0200 (CEST)

commit e42c03663442f5fb2f66dd59cc5bfdc61c53192c
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Wed Oct 26 09:43:17 2022 +0200
Commit: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
CommitDate: Wed Oct 26 09:43:17 2022 +0200

    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.

diff --git a/dmenu.c b/dmenu.c
index 7cf253b..e7be8af 100644
--- a/dmenu.c
+++ b/dmenu.c
_AT_@ -324,19 +324,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;
         }
 
Received on Wed Oct 26 2022 - 09:53:50 CEST

This archive was generated by hypermail 2.3.0 : Wed Oct 26 2022 - 10:00:37 CEST