Xinqi Bao's Git
projects
/
dmenu.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
though sticking to |uniq
[dmenu.git]
/
dmenu.c
diff --git
a/dmenu.c
b/dmenu.c
index
b07671c
..
3d3a928
100644
(file)
--- a/
dmenu.c
+++ b/
dmenu.c
@@
-1,5
+1,6
@@
/* See LICENSE file for copyright and license details. */
#include <ctype.h>
/* See LICENSE file for copyright and license details. */
#include <ctype.h>
+#include <limits.h>
#include <locale.h>
#include <stdarg.h>
#include <stdlib.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)
for(len = 1000; len; len--) {
if(XGrabKeyboard(dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime)
-
== GrabSuccess)
+ == GrabSuccess)
break;
usleep(1000);
}
break;
usleep(1000);
}
@@
-353,16
+354,14
@@
kpress(XKeyEvent * e) {
len = strlen(text);
buf[0] = 0;
num = XLookupString(e, buf, sizeof buf, &ksym, 0);
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;
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;
ksym = (ksym - XK_KP_0) + XK_0;
- }
- }
if(IsFunctionKey(ksym) || IsKeypadKey(ksym)
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;
/* first check if a control mask is omitted */
if(e->state & ControlMask) {
@@
-536,7
+535,7
@@
match(char *pattern) {
}
if(lprefix) {
if(itemend) {
}
if(lprefix) {
if(itemend) {
- itemend->right
-
lprefix;
+ itemend->right
=
lprefix;
lprefix->left = itemend;
}
else
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) {
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;
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) x = atoi(argv[i]);
}
else if(!strcmp(argv[i], "-y")) {
- if(++i < argc)
{
+ if(++i < argc)
if(!strcmp(argv[i], "-0"))
if(!strcmp(argv[i], "-0"))
- y =
(int)(unsigned int)-1
;
+ y =
INT_MIN
;
else
y = atoi(argv[i]);
else
y = atoi(argv[i]);
- }
}
else if(!strcmp(argv[i], "-w")) {
if(++i < argc) w = atoi(argv[i]);
}
else if(!strcmp(argv[i], "-w")) {
if(++i < argc) w = atoi(argv[i]);