X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=dmenu.c;h=b5638b62725b4fd557c7c12e99f9798cd26b0331;hb=07d82c0c2a377fa7cadfa91a8d89123fc7321a2a;hp=b07671c04dbc2d4c1604669088db3cccc5216ee7;hpb=015f51ac46adac6befd81754a8f01676eaf1f6a4;p=dmenu.git diff --git a/dmenu.c b/dmenu.c index b07671c..b5638b6 100644 --- a/dmenu.c +++ b/dmenu.c @@ -295,7 +295,7 @@ grabkeyboard(void) { for(len = 1000; len; len--) { if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime) - == GrabSuccess) + == GrabSuccess) break; usleep(1000); } @@ -353,16 +353,14 @@ kpress(XKeyEvent * e) { len = strlen(text); buf[0] = 0; num = XLookupString(e, buf, sizeof buf, &ksym, 0); - if(IsKeypadKey(ksym)) { - if(ksym == XK_KP_Enter) { + if(IsKeypadKey(ksym)) + if(ksym == XK_KP_Enter) ksym = XK_Return; - } else if(ksym >= XK_KP_0 && ksym <= XK_KP_9) { + else if(ksym >= XK_KP_0 && ksym <= XK_KP_9) ksym = (ksym - XK_KP_0) + XK_0; - } - } if(IsFunctionKey(ksym) || IsKeypadKey(ksym) - || IsMiscFunctionKey(ksym) || IsPFKey(ksym) - || IsPrivateKeypadKey(ksym)) + || IsMiscFunctionKey(ksym) || IsPFKey(ksym) + || IsPrivateKeypadKey(ksym)) return; /* first check if a control mask is omitted */ if(e->state & ControlMask) { @@ -536,7 +534,7 @@ match(char *pattern) { } if(lprefix) { if(itemend) { - itemend->right - lprefix; + itemend->right = lprefix; lprefix->left = itemend; } else @@ -709,12 +707,11 @@ main(int argc, char *argv[]) { if(++i < argc) x = atoi(argv[i]); } else if(!strcmp(argv[i], "-y")) { - if(++i < argc) { + if(++i < argc) if(!strcmp(argv[i], "-0")) y = (int)(unsigned int)-1; else y = atoi(argv[i]); - } } else if(!strcmp(argv[i], "-w")) { if(++i < argc) w = atoi(argv[i]);