- curroff = prevoff = nextoff = sel = item;
-
- update_offsets();
-}
-
-/* creates brush structs for brush mode drawing */
-static void
-draw_menu()
-{
- Item *i;
-
- brush.x = 0;
- brush.y = 0;
- brush.w = mw;
- brush.h = mh;
- draw(dpy, &brush, False, 0);
-
- /* print command */
- if(!title || text[0]) {
- cmdw = cw;
- if(cmdw && item)
- brush.w = cmdw;
- draw(dpy, &brush, False, text);
- }
- else {
- cmdw = tw;
- brush.w = cmdw;
- draw(dpy, &brush, False, title);
- }
- brush.x += brush.w;
-
- if(curroff) {
- brush.w = seek;
- draw(dpy, &brush, False, (curroff && curroff->left) ? "<" : 0);
- brush.x += brush.w;
-
- /* determine maximum items */
- for(i = curroff; i != nextoff; i=i->right) {
- brush.border = False;
- brush.w = textw(&brush.font, i->text);
- if(brush.w > mw / 3)
- brush.w = mw / 3;
- brush.w += brush.font.height;
- if(sel == i) {
- swap((void **)&brush.fg, (void **)&brush.bg);
- draw(dpy, &brush, True, i->text);
- swap((void **)&brush.fg, (void **)&brush.bg);
- }
- else
- draw(dpy, &brush, False, i->text);
- brush.x += brush.w;
- }
-
- brush.x = mw - seek;
- brush.w = seek;
- draw(dpy, &brush, False, nextoff ? ">" : 0);
- }
- XCopyArea(dpy, brush.drawable, win, brush.gc, 0, 0, mw, mh, 0, 0);
- XFlush(dpy);