diff options
-rw-r--r-- | dmenu.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -24,6 +24,7 @@ static void calcoffsetsv(void); | |||
24 | static char *cistrstr(const char *s, const char *sub); | 24 | static char *cistrstr(const char *s, const char *sub); |
25 | static void cleanup(void); | 25 | static void cleanup(void); |
26 | static void dinput(void); | 26 | static void dinput(void); |
27 | static void drawitem(char *s, unsigned long col[ColLast]); | ||
27 | static void drawmenuh(void); | 28 | static void drawmenuh(void); |
28 | static void drawmenuv(void); | 29 | static void drawmenuv(void); |
29 | static void match(void); | 30 | static void match(void); |
@@ -155,8 +156,13 @@ drawbar(void) { | |||
155 | } | 156 | } |
156 | 157 | ||
157 | void | 158 | void |
159 | drawitem(char *s, unsigned long col[ColLast]) { | ||
160 | drawbox(&dc, col); | ||
161 | drawtext(&dc, s, col); | ||
162 | } | ||
163 | |||
164 | void | ||
158 | drawmenuh(void) { | 165 | drawmenuh(void) { |
159 | unsigned long *col; | ||
160 | Item *i; | 166 | Item *i; |
161 | 167 | ||
162 | dc.x += cmdw; | 168 | dc.x += cmdw; |
@@ -165,9 +171,7 @@ drawmenuh(void) { | |||
165 | dc.x += dc.w; | 171 | dc.x += dc.w; |
166 | for(i = curr; i != next; i = i->right) { | 172 | for(i = curr; i != next; i = i->right) { |
167 | dc.w = MIN(textw(&dc, i->text), mw / 3); | 173 | dc.w = MIN(textw(&dc, i->text), mw / 3); |
168 | col = (sel == i) ? selcol : normcol; | 174 | drawitem(i->text, (sel == i) ? selcol : normcol); |
169 | drawbox(&dc, col); | ||
170 | drawtext(&dc, i->text, col); | ||
171 | dc.x += dc.w; | 175 | dc.x += dc.w; |
172 | } | 176 | } |
173 | dc.w = textw(&dc, ">"); | 177 | dc.w = textw(&dc, ">"); |
@@ -183,7 +187,7 @@ drawmenuv(void) { | |||
183 | dc.y = topbar ? dc.h : 0; | 187 | dc.y = topbar ? dc.h : 0; |
184 | dc.w = mw - dc.x; | 188 | dc.w = mw - dc.x; |
185 | for(i = curr; i != next; i = i->right) { | 189 | for(i = curr; i != next; i = i->right) { |
186 | drawtext(&dc, i->text, (sel == i) ? selcol : normcol); | 190 | drawitem(i->text, (sel == i) ? selcol : normcol); |
187 | dc.y += dc.h; | 191 | dc.y += dc.h; |
188 | } | 192 | } |
189 | if(!XGetWindowAttributes(dpy, win, &wa)) | 193 | if(!XGetWindowAttributes(dpy, win, &wa)) |