aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dmenu.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/dmenu.c b/dmenu.c
index b460701..2c1867c 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -24,6 +24,7 @@ static void calcoffsetsv(void);
24static char *cistrstr(const char *s, const char *sub); 24static char *cistrstr(const char *s, const char *sub);
25static void cleanup(void); 25static void cleanup(void);
26static void dinput(void); 26static void dinput(void);
27static void drawitem(char *s, unsigned long col[ColLast]);
27static void drawmenuh(void); 28static void drawmenuh(void);
28static void drawmenuv(void); 29static void drawmenuv(void);
29static void match(void); 30static void match(void);
@@ -155,8 +156,13 @@ drawbar(void) {
155} 156}
156 157
157void 158void
159drawitem(char *s, unsigned long col[ColLast]) {
160 drawbox(&dc, col);
161 drawtext(&dc, s, col);
162}
163
164void
158drawmenuh(void) { 165drawmenuh(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))