Compare commits

...

7 Commits
1.2 ... 1.4

4 changed files with 24 additions and 28 deletions

View File

@ -9,3 +9,5 @@ d352e9dc112ee96aa5cad961a0ed880ae9ce7276 0.3
d046c818ea467555cc338751c9bf3024609f1f12 0.9 d046c818ea467555cc338751c9bf3024609f1f12 0.9
9e11140d4cc3eecac3b0ab752f91528fd5e04be8 1.0 9e11140d4cc3eecac3b0ab752f91528fd5e04be8 1.0
e8c1e9733752db12f2dbd1fa93c46f5806242ba9 1.1 e8c1e9733752db12f2dbd1fa93c46f5806242ba9 1.1
bee7fe6d1189174d0204ca3195b83cdc1bb4f82e 1.2
2eb9997be51cb1b11a8900728ccc0904f9371157 1.3

View File

@ -1,5 +1,5 @@
# dmenu version # dmenu version
VERSION = 1.2 VERSION = 1.4
# Customize below to fit your system # Customize below to fit your system

35
main.c
View File

@ -11,7 +11,6 @@
#include <unistd.h> #include <unistd.h>
#include <sys/select.h> #include <sys/select.h>
#include <sys/time.h> #include <sys/time.h>
#include <X11/cursorfont.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include <X11/keysym.h> #include <X11/keysym.h>
@ -286,18 +285,24 @@ main(int argc, char *argv[]) {
timeout.tv_sec = 3; timeout.tv_sec = 3;
/* command line args */ /* command line args */
for(i = 1; i < argc; i++) for(i = 1; i < argc; i++)
if(!strncmp(argv[i], "-font", 6)) if(!strncmp(argv[i], "-font", 6)) {
font = argv[++i]; if(++i < argc) font = argv[i];
else if(!strncmp(argv[i], "-normbg", 8)) }
normbg = argv[++i]; else if(!strncmp(argv[i], "-normbg", 8)) {
else if(!strncmp(argv[i], "-normfg", 8)) if(++i < argc) normbg = argv[i];
normfg = argv[++i]; }
else if(!strncmp(argv[i], "-selbg", 7)) else if(!strncmp(argv[i], "-normfg", 8)) {
selbg = argv[++i]; if(++i < argc) normfg = argv[i];
else if(!strncmp(argv[i], "-selfg", 7)) }
selfg = argv[++i]; else if(!strncmp(argv[i], "-selbg", 7)) {
else if(!strncmp(argv[i], "-t", 3)) if(++i < argc) selbg = argv[i];
timeout.tv_sec = atoi(argv[++i]); }
else if(!strncmp(argv[i], "-selfg", 7)) {
if(++i < argc) selfg = argv[i];
}
else if(!strncmp(argv[i], "-t", 3)) {
if(++i < argc) timeout.tv_sec = atoi(argv[i]);
}
else if(!strncmp(argv[i], "-v", 3)) { else if(!strncmp(argv[i], "-v", 3)) {
fputs("dmenu-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout); fputs("dmenu-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
@ -340,7 +345,6 @@ main(int argc, char *argv[]) {
DefaultDepth(dpy, screen), CopyFromParent, DefaultDepth(dpy, screen), CopyFromParent,
DefaultVisual(dpy, screen), DefaultVisual(dpy, screen),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
XDefineCursor(dpy, win, XCreateFontCursor(dpy, XC_xterm));
/* pixmap */ /* pixmap */
dc.drawable = XCreatePixmap(dpy, root, mw, mh, DefaultDepth(dpy, screen)); dc.drawable = XCreatePixmap(dpy, root, mw, mh, DefaultDepth(dpy, screen));
dc.gc = XCreateGC(dpy, root, 0, 0); dc.gc = XCreateGC(dpy, root, 0, 0);
@ -356,7 +360,7 @@ main(int argc, char *argv[]) {
XSync(dpy, False); XSync(dpy, False);
/* main event loop */ /* main event loop */
while(running && !XNextEvent(dpy, &ev)) { while(running && !XNextEvent(dpy, &ev))
switch (ev.type) { switch (ev.type) {
default: /* ignore all crap */ default: /* ignore all crap */
break; break;
@ -368,7 +372,6 @@ main(int argc, char *argv[]) {
drawmenu(); drawmenu();
break; break;
} }
}
/* cleanup */ /* cleanup */
while(allitems) { while(allitems) {

13
util.c
View File

@ -9,21 +9,12 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
/* static */
static void
badmalloc(unsigned int size) {
eprint("fatal: could not malloc() %u bytes\n", size);
}
/* extern */
void * void *
emalloc(unsigned int size) { emalloc(unsigned int size) {
void *res = malloc(size); void *res = malloc(size);
if(!res) if(!res)
badmalloc(size); eprint("fatal: could not malloc() %u bytes\n", size);
return res; return res;
} }
@ -42,6 +33,6 @@ estrdup(const char *str) {
void *res = strdup(str); void *res = strdup(str);
if(!res) if(!res)
badmalloc(strlen(str)); eprint("fatal: could not malloc() %u bytes\n", strlen(str));
return res; return res;
} }