/* See LICENSE file for copyright and license details. */
#include <ctype.h>
+#include <limits.h>
#include <locale.h>
#include <stdarg.h>
#include <stdlib.h>
unsigned int cmdw = 0;
unsigned int mw, mh;
unsigned int promptw = 0;
-unsigned int nitem = 0;
unsigned int numlockmask = 0;
Bool running = True;
Display *dpy;
for(len = 1000; len; len--) {
if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime)
- == GrabSuccess)
+ == GrabSuccess)
break;
usleep(1000);
}
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) {
return;
plen = strlen(pattern);
item = lexact = lprefix = lsubstr = itemend = exactend = prefixend = substrend = NULL;
- nitem = 0;
for(i = allitems; i; i = i->next)
- if(!fstrncmp(pattern, i->text, plen + 1)) {
+ if(!fstrncmp(pattern, i->text, plen + 1))
appenditem(i, &lexact, &exactend);
- nitem++;
- }
- else if(!fstrncmp(pattern, i->text, plen)) {
+ else if(!fstrncmp(pattern, i->text, plen))
appenditem(i, &lprefix, &prefixend);
- nitem++;
- }
- else if(fstrstr(i->text, pattern)) {
+ else if(fstrstr(i->text, pattern))
appenditem(i, &lsubstr, &substrend);
- nitem++;
- }
if(lexact) {
item = lexact;
itemend = exactend;
}
if(lprefix) {
if(itemend) {
- itemend->right - lprefix;
+ itemend->right = lprefix;
lprefix->left = itemend;
}
else
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;
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]);