aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dinput.c6
-rw-r--r--dmenu.c16
-rw-r--r--draw.h21
3 files changed, 31 insertions, 12 deletions
diff --git a/dinput.c b/dinput.c
index f2b504a..d8f2515 100644
--- a/dinput.c
+++ b/dinput.c
@@ -43,6 +43,12 @@ static unsigned int numlockmask = 0;
43static Bool running = True; 43static Bool running = True;
44static Window win; 44static Window win;
45 45
46Display *dpy;
47DC dc;
48int screen;
49unsigned int mw, mh;
50Window parent;
51
46void 52void
47cleanup(void) { 53cleanup(void) {
48 drawcleanup(); 54 drawcleanup();
diff --git a/dmenu.c b/dmenu.c
index 339f949..8b40aa7 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -54,6 +54,7 @@ static char text[4096];
54static int cmdw = 0; 54static int cmdw = 0;
55static int promptw = 0; 55static int promptw = 0;
56static int ret = 0; 56static int ret = 0;
57static unsigned int lines = 0;
57static unsigned int numlockmask = 0; 58static unsigned int numlockmask = 0;
58static Bool running = True; 59static Bool running = True;
59static Item *allitems = NULL; /* first of all items */ 60static Item *allitems = NULL; /* first of all items */
@@ -65,9 +66,14 @@ static Item *curr = NULL;
65static Window win; 66static Window win;
66static int (*fstrncmp)(const char *, const char *, size_t) = strncmp; 67static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
67static char *(*fstrstr)(const char *, const char *) = strstr; 68static char *(*fstrstr)(const char *, const char *) = strstr;
68static unsigned int lines = 0;
69static void (*calcoffsets)(void) = calcoffsetsh; 69static void (*calcoffsets)(void) = calcoffsetsh;
70 70
71Display *dpy;
72DC dc;
73int screen;
74unsigned int mw, mh;
75Window parent;
76
71void 77void
72appenditem(Item *i, Item **list, Item **last) { 78appenditem(Item *i, Item **list, Item **last) {
73 if(!(*last)) 79 if(!(*last))
@@ -131,6 +137,14 @@ cistrstr(const char *s, const char *sub) {
131 137
132void 138void
133cleanup(void) { 139cleanup(void) {
140 Item *itm;
141
142 while(allitems) {
143 itm = allitems->next;
144 free(allitems->text);
145 free(allitems);
146 allitems = itm;
147 }
134 drawcleanup(); 148 drawcleanup();
135 XDestroyWindow(dpy, win); 149 XDestroyWindow(dpy, win);
136 XUngrabKeyboard(dpy, CurrentTime); 150 XUngrabKeyboard(dpy, CurrentTime);
diff --git a/draw.h b/draw.h
index 79db37e..b6615ab 100644
--- a/draw.h
+++ b/draw.h
@@ -30,16 +30,15 @@ int textnw(const char *text, unsigned int len);
30int textw(const char *text); 30int textw(const char *text);
31 31
32/* variables */ 32/* variables */
33Display *dpy; 33extern Display *dpy;
34DC dc; 34extern DC dc;
35int screen; 35extern int screen;
36unsigned int mw, mh; 36extern unsigned int mw, mh;
37unsigned int spaceitem; 37extern Window parent;
38Window parent;
39 38
40/* style */ 39/* style */
41const char *font; 40extern const char *font;
42const char *normbgcolor; 41extern const char *normbgcolor;
43const char *normfgcolor; 42extern const char *normfgcolor;
44const char *selbgcolor; 43extern const char *selbgcolor;
45const char *selfgcolor; 44extern const char *selfgcolor;