fixed vlist select

This commit is contained in:
Connor Lane Smith 2010-07-30 09:18:35 +01:00
parent da7a799121
commit d77340ed53

14
dmenu.c
View File

@ -24,6 +24,7 @@ static void calcoffsetsv(void);
static char *cistrstr(const char *s, const char *sub); static char *cistrstr(const char *s, const char *sub);
static void cleanup(void); static void cleanup(void);
static void dinput(void); static void dinput(void);
static void drawitem(char *s, unsigned long col[ColLast]);
static void drawmenuh(void); static void drawmenuh(void);
static void drawmenuv(void); static void drawmenuv(void);
static void match(void); static void match(void);
@ -154,9 +155,14 @@ drawbar(void) {
commitdraw(&dc, win); commitdraw(&dc, win);
} }
void
drawitem(char *s, unsigned long col[ColLast]) {
drawbox(&dc, col);
drawtext(&dc, s, col);
}
void void
drawmenuh(void) { drawmenuh(void) {
unsigned long *col;
Item *i; Item *i;
dc.x += cmdw; dc.x += cmdw;
@ -165,9 +171,7 @@ drawmenuh(void) {
dc.x += dc.w; dc.x += dc.w;
for(i = curr; i != next; i = i->right) { for(i = curr; i != next; i = i->right) {
dc.w = MIN(textw(&dc, i->text), mw / 3); dc.w = MIN(textw(&dc, i->text), mw / 3);
col = (sel == i) ? selcol : normcol; drawitem(i->text, (sel == i) ? selcol : normcol);
drawbox(&dc, col);
drawtext(&dc, i->text, col);
dc.x += dc.w; dc.x += dc.w;
} }
dc.w = textw(&dc, ">"); dc.w = textw(&dc, ">");
@ -183,7 +187,7 @@ drawmenuv(void) {
dc.y = topbar ? dc.h : 0; dc.y = topbar ? dc.h : 0;
dc.w = mw - dc.x; dc.w = mw - dc.x;
for(i = curr; i != next; i = i->right) { 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; dc.y += dc.h;
} }
if(!XGetWindowAttributes(dpy, win, &wa)) if(!XGetWindowAttributes(dpy, win, &wa))