pinosaur
/
dmenu.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
new libdraw
[dmenu.git]
/
dmenu.c
diff --git
a/dmenu.c
b/dmenu.c
index
6fc414c
..
076cffe
100644
(file)
--- 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 char *cistrstr(const char *s, const char *sub);
static void cleanup(void);
static void dinput(void);
+static void drawitem(const char *s, unsigned long col[ColLast]);
static void drawmenuh(void);
static void drawmenuv(void);
static void match(void);
static void drawmenuh(void);
static void drawmenuv(void);
static void match(void);
@@
-133,12
+134,13
@@
drawbar(void) {
dc.y = 0;
dc.w = mw;
dc.h = mh;
dc.y = 0;
dc.w = mw;
dc.h = mh;
- draw
text(&dc, NULL
, normcol);
+ draw
box(&dc
, normcol);
dc.h = dc.font.height + 2;
dc.y = topbar ? 0 : mh - dc.h;
/* print prompt? */
if(prompt) {
dc.w = promptw;
dc.h = dc.font.height + 2;
dc.y = topbar ? 0 : mh - dc.h;
/* print prompt? */
if(prompt) {
dc.w = promptw;
+ drawbox(&dc, selcol);
drawtext(&dc, prompt, selcol);
dc.x += dc.w;
}
drawtext(&dc, prompt, selcol);
dc.x += dc.w;
}
@@
-154,6
+156,12
@@
drawbar(void) {
commitdraw(&dc, win);
}
commitdraw(&dc, win);
}
+void
+drawitem(const char *s, unsigned long col[ColLast]) {
+ drawbox(&dc, col);
+ drawtext(&dc, s, col);
+}
+
void
drawmenuh(void) {
Item *i;
void
drawmenuh(void) {
Item *i;
@@
-164,7
+172,7
@@
drawmenuh(void) {
dc.x += dc.w;
for(i = curr; i != next; i = i->right) {
dc.w = MIN(textw(&dc, i->text), mw / 3);
dc.x += dc.w;
for(i = curr; i != next; i = i->right) {
dc.w = MIN(textw(&dc, i->text), mw / 3);
- draw
text(&dc,
i->text, (sel == i) ? selcol : normcol);
+ draw
item(
i->text, (sel == i) ? selcol : normcol);
dc.x += dc.w;
}
dc.w = textw(&dc, ">");
dc.x += dc.w;
}
dc.w = textw(&dc, ">");
@@
-180,7
+188,7
@@
drawmenuv(void) {
dc.y = topbar ? dc.h : 0;
dc.w = mw - dc.x;
for(i = curr; i != next; i = i->right) {
dc.y = topbar ? dc.h : 0;
dc.w = mw - dc.x;
for(i = curr; i != next; i = i->right) {
- draw
text(&dc,
i->text, (sel == i) ? selcol : normcol);
+ draw
item(
i->text, (sel == i) ? selcol : normcol);
dc.y += dc.h;
}
if(!XGetWindowAttributes(dpy, win, &wa))
dc.y += dc.h;
}
if(!XGetWindowAttributes(dpy, win, &wa))