]> git.armaanb.net Git - dmenu.git/blobdiff - dmenu.c
no exe should be unquoted, agreed to Peter Hartlich
[dmenu.git] / dmenu.c
diff --git a/dmenu.c b/dmenu.c
index b07671c04dbc2d4c1604669088db3cccc5216ee7..3d3a9284a028972e3cc9db8d00ab22e0acdaf4df 100644 (file)
--- a/dmenu.c
+++ b/dmenu.c
@@ -1,5 +1,6 @@
 /* See LICENSE file for copyright and license details. */
 #include <ctype.h>
+#include <limits.h>
 #include <locale.h>
 #include <stdarg.h>
 #include <stdlib.h>
@@ -295,7 +296,7 @@ grabkeyboard(void) {
 
        for(len = 1000; len; len--) {
                if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime)
-                       == GrabSuccess)
+               == GrabSuccess)
                        break;
                usleep(1000);
        }
@@ -353,16 +354,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 +535,7 @@ match(char *pattern) {
        }
        if(lprefix) {
                if(itemend) {
-                       itemend->right - lprefix;
+                       itemend->right = lprefix;
                        lprefix->left = itemend;
                }
                else
@@ -631,7 +630,7 @@ setup(int x, int y, int w) {
        mw = w ? w : DisplayWidth(dpy, screen);
        mh = dc.font.height + 2;
        if(y < 0) {
-               if(y == (int)(unsigned int)-1)
+               if(y == INT_MIN)
                        y = DisplayHeight(dpy, screen) - mh;
                else
                        y = (-1 * y) - mh;
@@ -709,12 +708,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;
+                                       y = INT_MIN;
                                else
                                        y = atoi(argv[i]);
-                       }
                }
                else if(!strcmp(argv[i], "-w")) {
                        if(++i < argc) w = atoi(argv[i]);