diff options
| -rw-r--r-- | config.mk | 2 | ||||
| -rw-r--r-- | dmenu.c | 13 |
2 files changed, 7 insertions, 8 deletions
| @@ -19,7 +19,7 @@ INCS = -I. -I/usr/include -I${X11INC} | |||
| 19 | LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${XINERAMALIBS} | 19 | LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${XINERAMALIBS} |
| 20 | 20 | ||
| 21 | # flags | 21 | # flags |
| 22 | CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} | 22 | CPPFLAGS = -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} |
| 23 | CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} | 23 | CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} |
| 24 | LDFLAGS = -s ${LIBS} | 24 | LDFLAGS = -s ${LIBS} |
| 25 | 25 | ||
| @@ -1,5 +1,4 @@ | |||
| 1 | /* See LICENSE file for copyright and license details. */ | 1 | /* See LICENSE file for copyright and license details. */ |
| 2 | #define _BSD_SOURCE | ||
| 3 | #include <ctype.h> | 2 | #include <ctype.h> |
| 4 | #include <locale.h> | 3 | #include <locale.h> |
| 5 | #include <stdarg.h> | 4 | #include <stdarg.h> |
| @@ -141,7 +140,7 @@ cistrstr(const char *s, const char *sub) { | |||
| 141 | do { | 140 | do { |
| 142 | do { | 141 | do { |
| 143 | if((csub = *s++) == 0) | 142 | if((csub = *s++) == 0) |
| 144 | return (NULL); | 143 | return NULL; |
| 145 | } | 144 | } |
| 146 | while(tolower(csub) != c); | 145 | while(tolower(csub) != c); |
| 147 | } | 146 | } |
| @@ -318,7 +317,7 @@ kpress(XKeyEvent * e) { | |||
| 318 | 317 | ||
| 319 | len = strlen(text); | 318 | len = strlen(text); |
| 320 | buf[0] = 0; | 319 | buf[0] = 0; |
| 321 | num = XLookupString(e, buf, sizeof buf, &ksym, 0); | 320 | num = XLookupString(e, buf, sizeof buf, &ksym, NULL); |
| 322 | if(IsKeypadKey(ksym)) { | 321 | if(IsKeypadKey(ksym)) { |
| 323 | if(ksym == XK_KP_Enter) | 322 | if(ksym == XK_KP_Enter) |
| 324 | ksym = XK_Return; | 323 | ksym = XK_Return; |
| @@ -534,7 +533,7 @@ readstdin(void) { | |||
| 534 | maxname = p; | 533 | maxname = p; |
| 535 | max = len; | 534 | max = len; |
| 536 | } | 535 | } |
| 537 | if((new = (Item *)malloc(sizeof(Item))) == NULL) | 536 | if(!(new = (Item *)malloc(sizeof(Item)))) |
| 538 | eprint("fatal: could not malloc() %u bytes\n", sizeof(Item)); | 537 | eprint("fatal: could not malloc() %u bytes\n", sizeof(Item)); |
| 539 | new->next = new->left = new->right = NULL; | 538 | new->next = new->left = new->right = NULL; |
| 540 | new->text = p; | 539 | new->text = p; |
| @@ -593,7 +592,7 @@ setup(Bool topbar) { | |||
| 593 | initfont(font); | 592 | initfont(font); |
| 594 | 593 | ||
| 595 | /* menu window */ | 594 | /* menu window */ |
| 596 | wa.override_redirect = 1; | 595 | wa.override_redirect = True; |
| 597 | wa.background_pixmap = ParentRelative; | 596 | wa.background_pixmap = ParentRelative; |
| 598 | wa.event_mask = ExposureMask | ButtonPressMask | KeyPressMask; | 597 | wa.event_mask = ExposureMask | ButtonPressMask | KeyPressMask; |
| 599 | 598 | ||
| @@ -631,7 +630,7 @@ setup(Bool topbar) { | |||
| 631 | 630 | ||
| 632 | /* pixmap */ | 631 | /* pixmap */ |
| 633 | dc.drawable = XCreatePixmap(dpy, root, mw, mh, DefaultDepth(dpy, screen)); | 632 | dc.drawable = XCreatePixmap(dpy, root, mw, mh, DefaultDepth(dpy, screen)); |
| 634 | dc.gc = XCreateGC(dpy, root, 0, 0); | 633 | dc.gc = XCreateGC(dpy, root, 0, NULL); |
| 635 | XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); | 634 | XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
| 636 | if(!dc.font.set) | 635 | if(!dc.font.set) |
| 637 | XSetFont(dpy, dc.gc, dc.font.xfont->fid); | 636 | XSetFont(dpy, dc.gc, dc.font.xfont->fid); |
| @@ -702,7 +701,7 @@ main(int argc, char *argv[]) { | |||
| 702 | " [-p <prompt>] [-sb <color>] [-sf <color>] [-v]\n"); | 701 | " [-p <prompt>] [-sb <color>] [-sf <color>] [-v]\n"); |
| 703 | if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) | 702 | if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) |
| 704 | fprintf(stderr, "warning: no locale support\n"); | 703 | fprintf(stderr, "warning: no locale support\n"); |
| 705 | if(!(dpy = XOpenDisplay(0))) | 704 | if(!(dpy = XOpenDisplay(NULL))) |
| 706 | eprint("dmenu: cannot open display\n"); | 705 | eprint("dmenu: cannot open display\n"); |
| 707 | screen = DefaultScreen(dpy); | 706 | screen = DefaultScreen(dpy); |
| 708 | root = RootWindow(dpy, screen); | 707 | root = RootWindow(dpy, screen); |
