aboutsummaryrefslogtreecommitdiff
path: root/dmenu.c
diff options
context:
space:
mode:
authorConnor Lane Smith <cls@lubutu.com>2010-07-30 09:18:35 +0100
committerConnor Lane Smith <cls@lubutu.com>2010-07-30 09:18:35 +0100
commitd77340ed53ab7b04e289569b00cb46bd6f3ec06b (patch)
tree118f1e2a67df6212cd2bdea3fbf42422ede72c05 /dmenu.c
parentda7a79912124743e7fbbef81c2450aeaf4ccca87 (diff)
downloaddmenu-d77340ed53ab7b04e289569b00cb46bd6f3ec06b.tar.gz
dmenu-d77340ed53ab7b04e289569b00cb46bd6f3ec06b.tar.bz2
dmenu-d77340ed53ab7b04e289569b00cb46bd6f3ec06b.zip
fixed vlist select
Diffstat (limited to 'dmenu.c')
-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);
static char *cistrstr(const char *s, const char *sub);
static void cleanup(void);
static void dinput(void);
+static void drawitem(char *s, unsigned long col[ColLast]);
static void drawmenuh(void);
static void drawmenuv(void);
static void match(void);
@@ -155,8 +156,13 @@ drawbar(void) {
}
void
+drawitem(char *s, unsigned long col[ColLast]) {
+ drawbox(&dc, col);
+ drawtext(&dc, s, col);
+}
+
+void
drawmenuh(void) {
- unsigned long *col;
Item *i;
dc.x += cmdw;
@@ -165,9 +171,7 @@ drawmenuh(void) {
dc.x += dc.w;
for(i = curr; i != next; i = i->right) {
dc.w = MIN(textw(&dc, i->text), mw / 3);
- col = (sel == i) ? selcol : normcol;
- drawbox(&dc, col);
- drawtext(&dc, i->text, col);
+ drawitem(i->text, (sel == i) ? selcol : normcol);
dc.x += dc.w;
}
dc.w = textw(&dc, ">");
@@ -183,7 +187,7 @@ drawmenuv(void) {
dc.y = topbar ? dc.h : 0;
dc.w = mw - dc.x;
for(i = curr; i != next; i = i->right) {
- drawtext(&dc, i->text, (sel == i) ? selcol : normcol);
+ drawitem(i->text, (sel == i) ? selcol : normcol);
dc.y += dc.h;
}
if(!XGetWindowAttributes(dpy, win, &wa))