added focuscolors (three color tuples now, which indicate focus and selection state)

This commit is contained in:
Anselm R. Garbe 2006-05-19 18:14:31 +02:00
parent 9025f56301
commit 7324531047
9 changed files with 44 additions and 21 deletions

View File

@ -1,5 +1,4 @@
- introduce empty views
- apply the focuscolor patch by Stefan Tibus
- UTF8 fixes with iconv?
- move /<view> to /tags/<name|sel>/
- add /tags/sel/index (for column reverse-addressing)

View File

@ -46,7 +46,7 @@ create_bar(char *name, Bool intern)
b->id = id++;
b->intern = intern;
cext_strlcpy(b->name, name, sizeof(b->name));
cext_strlcpy(b->colstr, def.selcolor, sizeof(b->colstr));
cext_strlcpy(b->colstr, def.focuscolor, sizeof(b->colstr));
b->color = def.sel;
cext_vattach(vector_of_bars(&bar), b);
qsort(bar.data, bar.size, sizeof(Bar *), comp_bar_name);
@ -120,7 +120,7 @@ draw_bar()
b = bar.data[i];
if(b->intern) {
if(view.size && !strncmp(b->name, view.data[sel]->name, sizeof(b->name)))
b->color = def.sel;
b->color = def.focus;
else
b->color = def.norm;
}

View File

@ -273,9 +273,13 @@ draw_client(Client *c)
d.gc = c->gc;
if(c == sel_client())
d.color = def.sel;
else
d.color = def.norm;
d.color = def.focus;
else {
if(f->area->sel == fidx)
d.color = def.sel;
else
d.color = def.norm;
}
/* draw border */
if(def.border) {
@ -301,19 +305,10 @@ draw_client(Client *c)
d.rect.x = f->rect.width - d.rect.width;
d.data = buf;
if(f->area->sel == fidx)
d.color = def.sel;
else
d.color = def.norm;
blitz_drawlabel(dpy, &d);
blitz_drawborder(dpy, &d);
d.rect.x = 0;
if(c == sel_client())
d.color = def.sel;
else
d.color = def.norm;
/* tag bar */
d.rect.width = d.rect.height + blitz_textwidth(dpy, &blitzfont, c->tags);
if(d.rect.width + w > f->rect.width)

View File

@ -36,6 +36,7 @@ enum { WMII_IOUNIT = 2048 };
* /def/ FsDdef
* /def/border FsFborder 0..n
* /def/font FsFfont xlib font name
* /def/focuscolors FsFfocuscolors focused colors
* /def/selcolors FsFselcolors selected colors
* /def/normcolors FsFnormcolors normal colors
* /def/rules FsFrules rules
@ -196,6 +197,7 @@ name_of_qid(Qid wqid[IXP_MAX_WELEM], unsigned short qsel)
snprintf(buf, sizeof(buf), "%u", i3);
return buf;
break;
case FsFfocuscolors: return "focuscolors"; break;
case FsFselcolors: return "selcolors"; break;
case FsFnormcolors: return "normcolors"; break;
case FsFfont: return "font"; break;
@ -297,6 +299,8 @@ type_of_name(Qid wqid[IXP_MAX_WELEM], unsigned short qsel, char *name)
return FsFgeom;
if(!strncmp(name, "colors", 7))
return FsFcolors;
if(!strncmp(name, "focuscolors", 12))
return FsFfocuscolors;
if(!strncmp(name, "selcolors", 10))
return FsFselcolors;
if(!strncmp(name, "normcolors", 11))
@ -457,6 +461,7 @@ qid_of_name(Qid wqid[IXP_MAX_WELEM], unsigned short qsel, char *name)
case FsFfont:
case FsFcolw:
case FsFrules:
case FsFfocuscolors:
case FsFselcolors:
case FsFnormcolors:
case FsFkeys:
@ -609,6 +614,7 @@ stat_of_name(Stat *stat, char *name, Qid wqid[IXP_MAX_WELEM], unsigned short qse
}
break;
case FsFcolors:
case FsFfocuscolors:
case FsFselcolors:
case FsFnormcolors:
return pack_stat(stat, wqid, qsel, name, 23, IXP_DMREAD | IXP_DMWRITE);
@ -1049,6 +1055,8 @@ xread(IXPConn *c, Fcall *fcall)
case FsDdef:
fcall->count = stat_of_name(&stat, "border", m->wqid, m->sel);
p = ixp_pack_stat(p, &stat);
fcall->count += stat_of_name(&stat, "focuscolors", m->wqid, m->sel);
p = ixp_pack_stat(p, &stat);
fcall->count += stat_of_name(&stat, "selcolors", m->wqid, m->sel);
p = ixp_pack_stat(p, &stat);
fcall->count += stat_of_name(&stat, "normcolors", m->wqid, m->sel);
@ -1218,6 +1226,10 @@ xread(IXPConn *c, Fcall *fcall)
if((fcall->count = strlen(bar.data[i1]->colstr)))
memcpy(p, bar.data[i1]->colstr, fcall->count);
break;
case FsFfocuscolors:
if((fcall->count = strlen(def.focuscolor)))
memcpy(p, def.focuscolor, fcall->count);
break;
case FsFselcolors:
if((fcall->count = strlen(def.selcolor)))
memcpy(p, def.selcolor, fcall->count);
@ -1418,6 +1430,15 @@ xwrite(IXPConn *c, Fcall *fcall)
blitz_loadcolor(dpy, &bar.data[i1]->color, screen, bar.data[i1]->colstr);
draw_bar();
break;
case FsFfocuscolors:
if((fcall->count != 23) || (fcall->data[0] != '#')
|| (fcall->data[8] != '#') || (fcall->data[16] != '#'))
return Ebadvalue;
memcpy(def.focuscolor, fcall->data, fcall->count);
def.focuscolor[fcall->count] = 0;
blitz_loadcolor(dpy, &def.sel, screen, def.focuscolor);
draw_clients();
break;
case FsFselcolors:
if((fcall->count != 23) || (fcall->data[0] != '#')
|| (fcall->data[8] != '#') || (fcall->data[16] != '#'))

View File

@ -143,7 +143,7 @@ init_screen()
gcv.subwindow_mode = IncludeInferiors;
gcv.function = GXxor;
gcv.foreground = def.sel.bg;
gcv.foreground = def.focus.bg;
gcv.plane_mask = AllPlanes;
gcv.graphics_exposures = False;
xorgc = XCreateGC(dpy, root, GCForeground | GCGraphicsExposures
@ -303,6 +303,8 @@ main(int argc, char *argv[])
def.border = 2;
def.colmode = Coldefault;
def.colw = 0;
cext_strlcpy(def.focuscolor, BLITZ_FOCUSCOLORS, sizeof(def.focuscolor));
blitz_loadcolor(dpy, &def.focus, screen, def.focuscolor);
cext_strlcpy(def.selcolor, BLITZ_SELCOLORS, sizeof(def.selcolor));
blitz_loadcolor(dpy, &def.sel, screen, def.selcolor);
cext_strlcpy(def.normcolor, BLITZ_NORMCOLORS, sizeof(def.normcolor));

View File

@ -54,6 +54,7 @@ enum {
FsFdata,
FsFcolors,
FsFfont,
FsFfocuscolors,
FsFselcolors,
FsFnormcolors,
FsFkeys,
@ -149,9 +150,11 @@ typedef struct {
/* default values */
typedef struct {
char focuscolor[24];
char selcolor[24];
char normcolor[24];
char *font;
BlitzColor focus;
BlitzColor sel;
BlitzColor norm;
unsigned int border;

View File

@ -361,9 +361,9 @@ main(int argc, char *argv[])
if (!normcolstr || strlen(normcolstr) != 23)
normcolstr = strdup(BLITZ_NORMCOLORS);
blitz_loadcolor(dpy, &normcolor, screen, normcolstr);
selcolstr = getenv("WMII_SELCOLORS");
selcolstr = getenv("WMII_FOCUSCOLORS");
if (!selcolstr || strlen(selcolstr) != 23)
selcolstr = strdup(BLITZ_SELCOLORS);
selcolstr = strdup(BLITZ_FOCUSCOLORS);
blitz_loadcolor(dpy, &selcolor, screen, selcolstr);
wa.override_redirect = 1;

View File

@ -7,7 +7,8 @@
#include <X11/Xlocale.h>
#define BLITZ_FONT "fixed"
#define BLITZ_SELCOLORS "#ffffff #285577 #4c7899"
#define BLITZ_FOCUSCOLORS "#ffffff #285577 #4c7899"
#define BLITZ_SELCOLORS "#bbbbbb #103355 #18466a"
#define BLITZ_NORMCOLORS "#222222 #eeeeee #666666"
/*

View File

@ -17,12 +17,13 @@ LEFT=h
RIGHT=l
WMII_FONT='fixed'
WMII_SELCOLORS='#ffffff #285577 #4c7899'
WMII_FOCUSCOLORS='#ffffff #285577 #4c7899'
WMII_SELCOLORS='#bbbbbb #103355 #18466a'
WMII_NORMCOLORS='#222222 #eeeeee #666666'
# dark background
#WMII_NORMCOLORS='#e0e0e0 #0a0a0a #202020'
export WMII_FONT WMII_NORMCOLORS WMII_SELCOLORS
export WMII_FONT WMII_FOCUSCOLORS WMII_SELCOLORS WMII_NORMCOLORS
# give wmiiwm a chance to start
while :
@ -34,6 +35,7 @@ done
# WM CONFIGURATION
xwrite /def/border 2
xwrite /def/font $WMII_FONT
xwrite /def/focuscolors $WMII_FOCUSCOLORS
xwrite /def/selcolors $WMII_SELCOLORS
xwrite /def/normcolors $WMII_NORMCOLORS
xwrite /def/colmode default