From 13ef97e65ea5a713a3d5ab46916d1ac6d071b825 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Fri, 25 Aug 2006 14:45:17 +0200 Subject: updated dmenu to borderless drawing as well --- main.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 840a7bc..51fa20f 100644 --- a/main.c +++ b/main.c @@ -77,17 +77,17 @@ drawmenu() dc.y = 0; dc.w = mw; dc.h = mh; - drawtext(NULL, False, False); + drawtext(NULL, dc.norm); /* print command */ if(cmdw && item) dc.w = cmdw; - drawtext(text[0] ? text : NULL, False, False); + drawtext(text[0] ? text : NULL, dc.norm); dc.x += cmdw; if(curr) { dc.w = SPACE; - drawtext((curr && curr->left) ? "<" : NULL, False, False); + drawtext((curr && curr->left) ? "<" : NULL, dc.norm); dc.x += dc.w; /* determine maximum items */ @@ -95,13 +95,13 @@ drawmenu() dc.w = textw(i->text); if(dc.w > mw / 3) dc.w = mw / 3; - drawtext(i->text, sel == i, sel == i); + drawtext(i->text, (sel == i) ? dc.sel : dc.norm); dc.x += dc.w; } dc.x = mw - SPACE; dc.w = SPACE; - drawtext(next ? ">" : NULL, False, False); + drawtext(next ? ">" : NULL, dc.norm); } XCopyArea(dpy, dc.drawable, win, dc.gc, 0, 0, mw, mh, 0, 0); XFlush(dpy); @@ -315,9 +315,10 @@ main(int argc, char *argv[]) usleep(1000); /* style */ - dc.bg = getcolor(BGCOLOR); - dc.fg = getcolor(FGCOLOR); - dc.border = getcolor(BORDERCOLOR); + dc.sel[ColBG] = getcolor(SELBGCOLOR); + dc.sel[ColFG] = getcolor(SELFGCOLOR); + dc.norm[ColBG] = getcolor(NORMBGCOLOR); + dc.norm[ColFG] = getcolor(NORMFGCOLOR); setfont(FONT); wa.override_redirect = 1; @@ -326,7 +327,7 @@ main(int argc, char *argv[]) mx = my = 0; mw = DisplayWidth(dpy, screen); - mh = dc.font.height + 4; + mh = dc.font.height + 2; win = XCreateWindow(dpy, root, mx, my, mw, mh, 0, DefaultDepth(dpy, screen), CopyFromParent, -- cgit v1.2.3