wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit 100c1b38db3429ac755a23961609080f87b73d0b
parent 7d46f4474a7c4835b220c3af4c416dcb69b6328a
Author: garbeam <garbeam@localhost.localdomain>
Date:   Fri,  9 Dec 2005 01:18:10 +0200

fixed tabbing rendering


Diffstat:
cmd/wm/client.c | 30++++++++++++++++++++++++------
cmd/wm/frame.c | 26--------------------------
cmd/wm/wm.h | 1-
3 files changed, 24 insertions(+), 33 deletions(-)

diff --git a/cmd/wm/client.c b/cmd/wm/client.c @@ -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); } diff --git a/cmd/wm/frame.c b/cmd/wm/frame.c @@ -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: * diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -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();