aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnselm R.Garbe <arg@10ksloc.org>2006-08-16 19:25:04 +0200
committerAnselm R.Garbe <arg@10ksloc.org>2006-08-16 19:25:04 +0200
commitbbb2cc2a729cac8d0b2f0233924ad0491f00c2d7 (patch)
treeb004c275a08dd3c4d7aed6223a9802511d380ff3
parent02ddc93c9483214533824576cc219bd2f269ddc2 (diff)
fixed a typo in config.mk, fixed cleanup code in dmenu (now frees all allocated stuff)
-rw-r--r--config.mk2
-rw-r--r--main.c19
2 files changed, 16 insertions, 5 deletions
diff --git a/config.mk b/config.mk
index 06bf870..fd06d4b 100644
--- a/config.mk
+++ b/config.mk
@@ -11,7 +11,7 @@ X11INC = /usr/X11R6/include
11X11LIB = /usr/X11R6/lib 11X11LIB = /usr/X11R6/lib
12 12
13# includes and libs 13# includes and libs
14INCS = _I. -I/usr/include -I${X11INC} 14INCS = -I. -I/usr/include -I${X11INC}
15LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 15LIBS = -L/usr/lib -lc -L${X11LIB} -lX11
16 16
17# flags 17# flags
diff --git a/main.c b/main.c
index 3b9a24b..2f20efb 100644
--- a/main.c
+++ b/main.c
@@ -29,7 +29,7 @@ static int mx, my, mw, mh;
29static int ret = 0; 29static int ret = 0;
30static int nitem = 0; 30static int nitem = 0;
31static unsigned int cmdw = 0; 31static unsigned int cmdw = 0;
32static Bool done = False; 32static Bool running = True;
33static Item *allitems = NULL; /* first of all items */ 33static Item *allitems = NULL; /* first of all items */
34static Item *item = NULL; /* first of pattern matching items */ 34static Item *item = NULL; /* first of pattern matching items */
35static Item *sel = NULL; 35static Item *sel = NULL;
@@ -219,11 +219,11 @@ kpress(XKeyEvent * e)
219 else if(text) 219 else if(text)
220 fprintf(stdout, "%s", text); 220 fprintf(stdout, "%s", text);
221 fflush(stdout); 221 fflush(stdout);
222 done = True; 222 running = False;
223 break; 223 break;
224 case XK_Escape: 224 case XK_Escape:
225 ret = 1; 225 ret = 1;
226 done = True; 226 running = False;
227 break; 227 break;
228 case XK_BackSpace: 228 case XK_BackSpace:
229 if((i = len)) { 229 if((i = len)) {
@@ -290,6 +290,7 @@ int
290main(int argc, char *argv[]) 290main(int argc, char *argv[])
291{ 291{
292 char *maxname; 292 char *maxname;
293 Item *i;
293 XEvent ev; 294 XEvent ev;
294 XSetWindowAttributes wa; 295 XSetWindowAttributes wa;
295 296
@@ -349,7 +350,7 @@ main(int argc, char *argv[])
349 XSync(dpy, False); 350 XSync(dpy, False);
350 351
351 /* main event loop */ 352 /* main event loop */
352 while(!done && !XNextEvent(dpy, &ev)) { 353 while(running && !XNextEvent(dpy, &ev)) {
353 switch (ev.type) { 354 switch (ev.type) {
354 case KeyPress: 355 case KeyPress:
355 kpress(&ev.xkey); 356 kpress(&ev.xkey);
@@ -364,6 +365,16 @@ main(int argc, char *argv[])
364 } 365 }
365 366
366 XUngrabKeyboard(dpy, CurrentTime); 367 XUngrabKeyboard(dpy, CurrentTime);
368 while(allitems) {
369 i = allitems->next;
370 free(allitems->text);
371 free(allitems);
372 allitems = i;
373 }
374 if(dc.font.set)
375 XFreeFontSet(dpy, dc.font.set);
376 else
377 XFreeFont(dpy, dc.font.xfont);
367 XFreePixmap(dpy, dc.drawable); 378 XFreePixmap(dpy, dc.drawable);
368 XFreeGC(dpy, dc.gc); 379 XFreeGC(dpy, dc.gc);
369 XDestroyWindow(dpy, win); 380 XDestroyWindow(dpy, win);