Xinqi Bao's Git
projects
/
dmenu.git
/ diff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
da7a799
)
fixed vlist select
author
Connor Lane Smith <
[email protected]
>
Fri, 30 Jul 2010 08:18:35 +0000
(09:18 +0100)
committer
Connor Lane Smith <
[email protected]
>
Fri, 30 Jul 2010 08:18:35 +0000
(09:18 +0100)
dmenu.c
diff
|
blob
|
history
diff --git
a/dmenu.c
b/dmenu.c
index
b460701
..
2c1867c
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(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);
@@
-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
drawmenuh(void) {
void
drawmenuh(void) {
- unsigned long *col;
Item *i;
dc.x += cmdw;
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);
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, ">");
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) {
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))