Xinqi Bao's Git
projects
/
dmenu.git
/ commitdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
02ddc93
)
fixed a typo in config.mk, fixed cleanup code in dmenu (now frees all allocated stuff)
author
Anselm R.Garbe <
[email protected]
>
Wed, 16 Aug 2006 17:25:04 +0000
(19:25 +0200)
committer
Anselm R.Garbe <
[email protected]
>
Wed, 16 Aug 2006 17:25:04 +0000
(19:25 +0200)
config.mk
patch
|
blob
|
history
main.c
patch
|
blob
|
history
diff --git
a/config.mk
b/config.mk
index
06bf870
..
fd06d4b
100644
(file)
--- a/
config.mk
+++ b/
config.mk
@@
-11,7
+11,7
@@
X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib
# includes and libs
X11LIB = /usr/X11R6/lib
# includes and libs
-INCS =
_
I. -I/usr/include -I${X11INC}
+INCS =
-
I. -I/usr/include -I${X11INC}
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11
# flags
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11
# flags
diff --git
a/main.c
b/main.c
index
3b9a24b
..
2f20efb
100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-29,7
+29,7
@@
static int mx, my, mw, mh;
static int ret = 0;
static int nitem = 0;
static unsigned int cmdw = 0;
static int ret = 0;
static int nitem = 0;
static unsigned int cmdw = 0;
-static Bool
done = Fals
e;
+static Bool
running = Tru
e;
static Item *allitems = NULL; /* first of all items */
static Item *item = NULL; /* first of pattern matching items */
static Item *sel = NULL;
static Item *allitems = NULL; /* first of all items */
static Item *item = NULL; /* first of pattern matching items */
static Item *sel = NULL;
@@
-219,11
+219,11
@@
kpress(XKeyEvent * e)
else if(text)
fprintf(stdout, "%s", text);
fflush(stdout);
else if(text)
fprintf(stdout, "%s", text);
fflush(stdout);
-
done = Tru
e;
+
running = Fals
e;
break;
case XK_Escape:
ret = 1;
break;
case XK_Escape:
ret = 1;
-
done = Tru
e;
+
running = Fals
e;
break;
case XK_BackSpace:
if((i = len)) {
break;
case XK_BackSpace:
if((i = len)) {
@@
-290,6
+290,7
@@
int
main(int argc, char *argv[])
{
char *maxname;
main(int argc, char *argv[])
{
char *maxname;
+ Item *i;
XEvent ev;
XSetWindowAttributes wa;
XEvent ev;
XSetWindowAttributes wa;
@@
-349,7
+350,7
@@
main(int argc, char *argv[])
XSync(dpy, False);
/* main event loop */
XSync(dpy, False);
/* main event loop */
- while(
!done
&& !XNextEvent(dpy, &ev)) {
+ while(
running
&& !XNextEvent(dpy, &ev)) {
switch (ev.type) {
case KeyPress:
kpress(&ev.xkey);
switch (ev.type) {
case KeyPress:
kpress(&ev.xkey);
@@
-364,6
+365,16
@@
main(int argc, char *argv[])
}
XUngrabKeyboard(dpy, CurrentTime);
}
XUngrabKeyboard(dpy, CurrentTime);
+ while(allitems) {
+ i = allitems->next;
+ free(allitems->text);
+ free(allitems);
+ allitems = i;
+ }
+ if(dc.font.set)
+ XFreeFontSet(dpy, dc.font.set);
+ else
+ XFreeFont(dpy, dc.font.xfont);
XFreePixmap(dpy, dc.drawable);
XFreeGC(dpy, dc.gc);
XDestroyWindow(dpy, win);
XFreePixmap(dpy, dc.drawable);
XFreeGC(dpy, dc.gc);
XDestroyWindow(dpy, win);