diff options
author | Anselm R.Garbe <arg@10ksloc.org> | 2006-08-16 19:25:04 +0200 |
---|---|---|
committer | Anselm R.Garbe <arg@10ksloc.org> | 2006-08-16 19:25:04 +0200 |
commit | bbb2cc2a729cac8d0b2f0233924ad0491f00c2d7 (patch) | |
tree | b004c275a08dd3c4d7aed6223a9802511d380ff3 | |
parent | 02ddc93c9483214533824576cc219bd2f269ddc2 (diff) |
fixed a typo in config.mk, fixed cleanup code in dmenu (now frees all allocated stuff)
-rw-r--r-- | config.mk | 2 | ||||
-rw-r--r-- | main.c | 19 |
2 files changed, 16 insertions, 5 deletions
@@ -11,7 +11,7 @@ X11INC = /usr/X11R6/include | |||
11 | X11LIB = /usr/X11R6/lib | 11 | X11LIB = /usr/X11R6/lib |
12 | 12 | ||
13 | # includes and libs | 13 | # includes and libs |
14 | INCS = _I. -I/usr/include -I${X11INC} | 14 | INCS = -I. -I/usr/include -I${X11INC} |
15 | LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 | 15 | LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 |
16 | 16 | ||
17 | # flags | 17 | # flags |
@@ -29,7 +29,7 @@ static int mx, my, mw, mh; | |||
29 | static int ret = 0; | 29 | static int ret = 0; |
30 | static int nitem = 0; | 30 | static int nitem = 0; |
31 | static unsigned int cmdw = 0; | 31 | static unsigned int cmdw = 0; |
32 | static Bool done = False; | 32 | static Bool running = True; |
33 | static Item *allitems = NULL; /* first of all items */ | 33 | static Item *allitems = NULL; /* first of all items */ |
34 | static Item *item = NULL; /* first of pattern matching items */ | 34 | static Item *item = NULL; /* first of pattern matching items */ |
35 | static Item *sel = NULL; | 35 | static 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 | |||
290 | main(int argc, char *argv[]) | 290 | main(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); |