wmii

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

commit fd122b4a057a05a62161503165fea9d46afc273c
parent 456afb0c12f6d867a26b211d40fb459f4e100fcd
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Wed,  7 Jun 2006 19:19:16 +0200

fixed colorization of new labels in the bar


Diffstat:
cmd/wm/bar.c | 2+-
cmd/wm/view.c | 37+++++++++++++++++++++++--------------
cmd/wm/wm.h | 2--
rc/status | 2--
4 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/cmd/wm/bar.c b/cmd/wm/bar.c @@ -34,7 +34,7 @@ create_bar(char *name, Bool intern) b->id = id++; cext_strlcpy(b->name, name, sizeof(b->name)); cext_strlcpy(b->colstr, def.selcolor, sizeof(b->colstr)); - b->color = def.sel; + b->color = def.norm; cext_vattach(vector_of_bars(&bar), b); qsort(bar.data, bar.size, sizeof(Bar *), comp_bar); return b; diff --git a/cmd/wm/view.c b/cmd/wm/view.c @@ -22,7 +22,7 @@ comp_view_name(const void *v1, const void *v2) return strcmp(vv1->name, vv2->name); } -View * +static View * create_view(const char *name) { static unsigned short id = 1; @@ -40,7 +40,25 @@ create_view(const char *name) return v; } -void +static void +assign_sel_view(View *v) +{ + static char buf[256]; + int i = idx_of_view(v); + + i = idx_of_view(v); + if(sel < view.size && i != sel) { + snprintf(buf, sizeof(buf), "UnfocusTag %s\n", view.data[sel]->name); + write_event(buf); + } + if(i != sel) { + snprintf(buf, sizeof(buf), "FocusTag %s\n", v->name); + write_event(buf); + } + sel = i; +} + +static void destroy_view(View *v) { static char buf[256]; @@ -48,11 +66,10 @@ destroy_view(View *v) destroy_area(v->area.data[0]); cext_vdetach(vector_of_views(&view), v); - if(sel >= view.size) - sel = 0; + if(sel >= view.size && view.size) + assign_sel_view(view.data[0]); snprintf(buf, sizeof(buf), "DestroyTag %s\n", v->name); write_event(buf); - free(v); } @@ -87,15 +104,9 @@ focus_view(View *v) { Client *c; unsigned int i; - static char buf[256]; XGrabServer(dpy); - - if(sel < view.size) { - snprintf(buf, sizeof(buf), "UnfocusTag %s\n", view.data[sel]->name); - write_event(buf); - } - sel = idx_of_view(v); + assign_sel_view(v); update_frame_selectors(v); @@ -117,8 +128,6 @@ focus_view(View *v) XSync(dpy, False); XUngrabServer(dpy); flush_masked_events(EnterWindowMask); - snprintf(buf, sizeof(buf), "FocusTag %s\n", v->name); - write_event(buf); } XRectangle * diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -307,7 +307,6 @@ void update_rules(RuleVector *rule, const char *data); /* view.c */ void arrange_view(View *v); void scale_view(View *v, float w); -View *create_view(const char *name); void focus_view(View *v); XRectangle *rects_of_view(View *v, unsigned int *num); int idx_of_view_id(unsigned short id); @@ -318,7 +317,6 @@ void attach_to_view(View *v, Client *c); Client *sel_client_of_view(View *v); void restack_view(View *v); View *view_of_name(const char *name); -void destroy_view(View *v); void update_views(); unsigned int newcolw_of_view(View *v); diff --git a/rc/status b/rc/status @@ -8,8 +8,6 @@ xwrite() { wmiir remove /bar/status 2>/dev/null && sleep 2 wmiir create /bar/status -xwrite /bar/status/colors $WMII_NORMCOLORS - while xwrite /bar/status/data `date` `uptime | sed 's/.*://; s/,//g'` do sleep 1