fixed tabbing rendering

This commit is contained in:
garbeam 2005-12-09 01:18:10 +02:00
parent 7d46f4474a
commit 100c1b38db
3 changed files with 24 additions and 33 deletions

View File

@ -213,20 +213,38 @@ void draw_client(void *item, void *aux)
unsigned int tw, tabh = tab_height(f);
size_t size;
int i;
Draw d = { 0 };
if (!tabh)
return;
size = cext_sizeof(&f->clients);
tw = f->rect.width;
if (size)
tw /= size;
i = cext_list_get_item_index(&f->clients, c);
if (i < size - 1)
draw_tab(f, c->file[C_NAME]->content, i * tw, 0, f->rect.width - (i * tw), tabh,
(f == get_sel_frame()) && (c == get_sel_client()));
else
draw_tab(f, c->file[C_NAME]->content, i * tw, 0, tw, tabh,
(f == get_sel_frame()) && (c == get_sel_client()));
d.drawable = f->win;
d.gc = f->gc;
d.rect.x = i * tw;
d.rect.y = 0;
d.rect.width = tw;
if (i && (i == size - 1))
d.rect.width = f->rect.width - d.rect.x;
d.rect.height = tabh;
d.data = c->file[C_NAME]->content;
d.font = font;
if ((f == get_sel_frame()) && (c == get_sel_client())) {
d.bg = blitz_loadcolor(dpy, screen_num, f->file[F_SEL_BG_COLOR]->content);
d.fg = blitz_loadcolor(dpy, screen_num, f->file[F_SEL_FG_COLOR]->content);
d.border = blitz_loadcolor(dpy, screen_num, f->file[F_SEL_BORDER_COLOR]->content);
} else {
d.bg = blitz_loadcolor(dpy, screen_num, f->file[F_NORM_BG_COLOR]->content);
d.fg = blitz_loadcolor(dpy, screen_num, f->file[F_NORM_FG_COLOR]->content);
d.border = blitz_loadcolor(dpy, screen_num, f->file[F_NORM_BORDER_COLOR]->content);
}
blitz_drawlabel(dpy, &d);
XSync(dpy, False);
}

View File

@ -238,32 +238,6 @@ void resize_frame(Frame * f, XRectangle * r, XPoint * pt)
resize_clients(f, (tabh ? tabh : bw), bw);
}
void draw_tab(Frame * f, char *text, int x, int y, int w, int h, int sel)
{
Draw d = { 0 };
d.drawable = f->win;
d.gc = f->gc;
d.rect.x = x;
d.rect.y = y;
d.rect.width = w;
d.rect.height = h;
d.data = text;
d.font = font;
if (sel) {
d.bg = blitz_loadcolor(dpy, screen_num, f->file[F_SEL_BG_COLOR]->content);
d.fg = blitz_loadcolor(dpy, screen_num, f->file[F_SEL_FG_COLOR]->content);
d.border = blitz_loadcolor(dpy, screen_num, f->file[F_SEL_BORDER_COLOR]->content);
} else {
d.bg = blitz_loadcolor(dpy, screen_num, f->file[F_NORM_BG_COLOR]->content);
d.fg = blitz_loadcolor(dpy, screen_num, f->file[F_NORM_FG_COLOR]->content);
d.border = blitz_loadcolor(dpy, screen_num, f->file[F_NORM_BORDER_COLOR]->content);
}
blitz_drawlabel(dpy, &d);
XSync(dpy, False);
}
/**
* Assumes following file:
*

View File

@ -243,7 +243,6 @@ void draw_frame(void *frame, void *aux);
void handle_frame_buttonpress(XButtonEvent * e, Frame * f);
void attach_client_to_frame(Frame * f, Client * c);
void detach_client_from_frame(Client *c);
void draw_tab(Frame * f, char *text, int x, int y, int w, int h, int sel);
unsigned int tab_height(Frame * f);
unsigned int border_width(Frame * f);
Frame *get_sel_frame();