commit d2d5cae82c165b508f6614e974c3ddd34f33047a
parent 1da63ef2c943d5dce6348e74719cfa52c8cb9206
Author: Anselm R. Garbe <garbeam@wmii.de>
Date: Thu, 2 Feb 2006 21:36:10 +0200
fixed wrong color rendering
Diffstat:
7 files changed, 56 insertions(+), 59 deletions(-)
diff --git a/cmd/wm/client.c b/cmd/wm/client.c
@@ -24,7 +24,7 @@ alloc_client(Window w, XWindowAttributes *wa)
XTextProperty name;
Client *c = (Client *) cext_emallocz(sizeof(Client));
XSetWindowAttributes fwa;
- int bw = def.border, th;
+ int bw = def.border, bh;
long msize;
/* client itself */
@@ -51,14 +51,16 @@ alloc_client(Window w, XWindowAttributes *wa)
fwa.background_pixmap = ParentRelative;
fwa.event_mask = SubstructureRedirectMask | ExposureMask | ButtonPressMask | PointerMotionMask;
+ c->frame.bar = def.bar;
c->frame.border = bw;
- th = tab_height(c);
+ bh = bar_height(c);
c->frame.rect = c->rect;
c->frame.rect.width += 2 * bw;
- c->frame.rect.height += bw + (th ? th : bw);
+ c->frame.rect.height += bw + (bh ? bh : bw);
c->frame.win = XCreateWindow(dpy, root, c->frame.rect.x, c->frame.rect.y,
c->frame.rect.width, c->frame.rect.height, 0,
- DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
+ DefaultDepth(dpy, screen), CopyFromParent,
+ DefaultVisual(dpy, screen),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &fwa);
c->frame.cursor = normal_cursor;
XDefineCursor(dpy, c->frame.win, c->frame.cursor);
@@ -247,7 +249,7 @@ void
draw_client(Client *c)
{
Draw d = { 0 };
- unsigned int tabh = tab_height(c);
+ unsigned int bh = bar_height(c);
unsigned int bw = c->frame.border;
XRectangle notch;
@@ -274,14 +276,15 @@ draw_client(Client *c)
}
XSync(dpy, False);
- /* draw tab */
- if(!tabh)
+ /* draw bar */
+ if(!bh)
return;
d.rect.x = 0;
d.rect.y = 0;
d.rect.width = c->frame.rect.width;
- d.rect.height = tabh;
+ d.rect.height = bh;
+ d.notch = nil;
d.data = c->name;
blitz_drawlabel(dpy, &d);
XSync(dpy, False);
@@ -430,9 +433,9 @@ win_to_frame(Window w)
}
unsigned int
-tab_height(Client * c)
+bar_height(Client * c)
{
- if(c->frame.title)
+ if(c->frame.bar)
return xfont->ascent + xfont->descent + 4;
return 0;
}
@@ -480,7 +483,7 @@ resize_incremental(Client *c, unsigned int tabh, unsigned int bw)
void
resize_client(Client *c, XRectangle *r, XPoint *pt)
{
- unsigned int tabh = tab_height(c);
+ unsigned int bh = bar_height(c);
unsigned int bw = c->frame.border;
if(index_of_area(c->page, c->area) > 0)
@@ -489,18 +492,18 @@ resize_client(Client *c, XRectangle *r, XPoint *pt)
c->frame.rect = *r;
/* resize if client requests special size */
- check_dimensions(c, tabh, bw);
+ check_dimensions(c, bh, bw);
if(c->inc)
- resize_incremental(c, tabh, bw);
+ resize_incremental(c, bh, bw);
XMoveResizeWindow(dpy, c->frame.win, c->frame.rect.x, c->frame.rect.y,
c->frame.rect.width, c->frame.rect.height);
c->rect.x = bw;
- c->rect.y = tabh ? tabh : bw;
+ c->rect.y = bh ? bh : bw;
c->rect.width = c->frame.rect.width - 2 * bw;
- c->rect.height = c->frame.rect.height - bw - (tabh ? tabh : bw);
+ c->rect.height = c->frame.rect.height - bw - (bh ? bh : bw);
XMoveResizeWindow(dpy, c->win, c->rect.x, c->rect.y, c->rect.width, c->rect.height);
configure_client(c);
}
diff --git a/cmd/wm/event.c b/cmd/wm/event.c
@@ -104,7 +104,7 @@ handle_configurerequest(XEvent * e)
XConfigureRequestEvent *ev = &e->xconfigurerequest;
XWindowChanges wc;
Client *c;
- unsigned int bw = 0, tabh = 0;
+ unsigned int bw = 0, bh = 0;
c = win_to_client(ev->window);
ev->value_mask &= ~CWSibling;
@@ -112,7 +112,7 @@ handle_configurerequest(XEvent * e)
if(c) {
if(c->attached) {
bw = c->frame.border;
- tabh = tab_height(c);
+ bh = bar_height(c);
}
if(ev->value_mask & CWStackMode) {
if(wc.stack_mode == Above)
@@ -120,7 +120,7 @@ handle_configurerequest(XEvent * e)
else
ev->value_mask &= ~CWStackMode;
}
- gravitate(c, tabh ? tabh : bw, bw, 1);
+ gravitate(c, bh ? bh : bw, bw, 1);
if(ev->value_mask & CWX)
c->rect.x = ev->x;
@@ -133,13 +133,13 @@ handle_configurerequest(XEvent * e)
if(ev->value_mask & CWBorderWidth)
c->border = ev->border_width;
- gravitate(c, tabh ? tabh : bw, bw, 0);
+ gravitate(c, bh ? bh : bw, bw, 0);
if(c->attached) {
c->frame.rect.x = wc.x = c->rect.x - bw;
- c->frame.rect.y = wc.y = c->rect.y - (tabh ? tabh : bw);
+ c->frame.rect.y = wc.y = c->rect.y - (bh ? bh : bw);
c->frame.rect.width = wc.width = c->rect.width + 2 * bw;
- c->frame.rect.height = wc.height = c->rect.height + bw + (tabh ? tabh : bw);
+ c->frame.rect.height = wc.height = c->rect.height + bw + (bh ? bh : bw);
wc.border_width = 1;
wc.sibling = None;
wc.stack_mode = ev->detail;
@@ -153,7 +153,7 @@ handle_configurerequest(XEvent * e)
if(c && c->attached) {
/* if so, then bw and tabh are already initialized */
wc.x = bw;
- wc.y = tabh ? tabh : bw;
+ wc.y = bh ? bh : bw;
}
wc.width = ev->width;
if(!wc.width)
diff --git a/cmd/wm/fs.c b/cmd/wm/fs.c
@@ -28,7 +28,7 @@
* /default/selcolor Fselcolor <#RRGGBB> <#RRGGBB> <#RRGGBB>
* /default/normcolor Fnormcolor <#RRGGBB> <#RRGGBB> <#RRGGBB>
* /default/border Fborder 0..n
- * /default/title Ftitle 0, 1
+ * /default/bar Fbar 0, 1
* /default/snap Fsnap 0..n
* /default/inc Finc 0..n
* /event Fevent
@@ -44,7 +44,7 @@
* /1/float/sel/ Dclient
* /1/float/1/ Dclient
* /1/float/1/border Fborder 0..n
- * /1/float/1/title Ftitle 0, 1
+ * /1/float/1/bar Fbar 0, 1
* /1/float/1/inc Finc 0, 1
* /1/float/1/name Fname name of client
* /1/float/1/geom Fgeom geometry of client
@@ -54,7 +54,7 @@
* /1/1/1/sel/ Dclient
* /1/1/1/1/ Dclient
* /1/1/1/border Fborder 0..n
- * /1/1/1/title Ftitle 0, 1
+ * /1/1/1/bar Fbar 0, 1
* /1/1/1/inc Finc 0, 1
* /1/1/1/name Fname name of client
* /1/1/1/geom Fgeom geometry of client
@@ -151,7 +151,7 @@ qid_to_name(Qid *qid)
case Fnormcolor: return "normcolor"; break;
case Fborder: return "border"; break;
case Fsnap: return "border"; break;
- case Ftitle: return "title"; break;
+ case Fbar: return "bar"; break;
case Finc: return "inc"; break;
case Fgeom: return "geometry"; break;
case Fname: return "name"; break;
@@ -190,8 +190,8 @@ name_to_type(char *name, unsigned char dtyp)
return Fname;
if(!strncmp(name, "border", 7))
return Fborder;
- if(!strncmp(name, "title", 6))
- return Ftitle;
+ if(!strncmp(name, "bar", 4))
+ return Fbar;
if(!strncmp(name, "inc", 4))
return Finc;
if(!strncmp(name, "geometry", 9))
@@ -436,14 +436,14 @@ type_to_stat(Stat *stat, char *name, Qid *dir)
}
return mkstat(stat, dir, name, strlen(buf), DMREAD | DMWRITE);
break;
- case Ftitle:
+ case Fbar:
if(dtyp == Ddefault)
- snprintf(buf, sizeof(buf), "%d", def.title);
+ snprintf(buf, sizeof(buf), "%d", def.bar);
else {
idx = cext_strtonum(name, 0, 0xffff, &err);
if(err)
return 0;
- snprintf(buf, sizeof(buf), "%d", page[dpg]->area[darea]->client[idx]->frame.title);
+ snprintf(buf, sizeof(buf), "%d", page[dpg]->area[darea]->client[idx]->frame.bar);
}
return mkstat(stat, dir, name, strlen(buf), DMREAD | DMWRITE);
break;
@@ -624,7 +624,7 @@ xread(IXPConn *c)
p = ixp_enc_stat(p, &stat);
c->fcall->count += type_to_stat(&stat, "border", &m->qid);
p = ixp_enc_stat(p, &stat);
- c->fcall->count += type_to_stat(&stat, "title", &m->qid);
+ c->fcall->count += type_to_stat(&stat, "bar", &m->qid);
p = ixp_enc_stat(p, &stat);
c->fcall->count += type_to_stat(&stat, "inc", &m->qid);
p = ixp_enc_stat(p, &stat);
@@ -670,7 +670,7 @@ xread(IXPConn *c)
case Dclient:
c->fcall->count = type_to_stat(&stat, "border", &m->qid);
p = ixp_enc_stat(p, &stat);
- c->fcall->count += type_to_stat(&stat, "title", &m->qid);
+ c->fcall->count += type_to_stat(&stat, "bar", &m->qid);
p = ixp_enc_stat(p, &stat);
c->fcall->count += type_to_stat(&stat, "inc", &m->qid);
p = ixp_enc_stat(p, &stat);
@@ -711,11 +711,11 @@ xread(IXPConn *c)
c->fcall->count = strlen(buf);
memcpy(p, buf, c->fcall->count);
break;
- case Ftitle:
+ case Fbar:
if(m->qid.dtype == Ddefault)
- snprintf(buf, sizeof(buf), "%u", def.title);
+ snprintf(buf, sizeof(buf), "%u", def.bar);
else
- snprintf(buf, sizeof(buf), "%u", page[pg]->area[area]->client[cl]->frame.title);
+ snprintf(buf, sizeof(buf), "%u", page[pg]->area[area]->client[cl]->frame.bar);
c->fcall->count = strlen(buf);
memcpy(p, buf, c->fcall->count);
break;
@@ -875,14 +875,14 @@ xwrite(IXPConn *c)
/* TODO: resize client */
}
break;
- case Ftitle:
+ case Fbar:
if(c->fcall->count > sizeof(buf))
goto error_xwrite;
memcpy(buf, c->fcall->data, c->fcall->count);
buf[c->fcall->count] = 0;
i = cext_strtonum(buf, 0, 1, &err);
if(err) {
- errstr = "title value out of range 0, 1";
+ errstr = "bar value out of range 0, 1";
return -1;
}
if(m->qid.dtype == Ddefault)
diff --git a/cmd/wm/mouse.c b/cmd/wm/mouse.c
@@ -12,10 +12,10 @@ Cursor
cursor_for_motion(Client *c, int x, int y)
{
int n, e, w, s, tn, te, tw, ts;
- int tabh, bw;
+ unsigned int bh, bw;
bw = c->frame.border;
- tabh = tab_height(c);
+ bh = bar_height(c);
if(!bw)
return normal_cursor;
@@ -26,10 +26,10 @@ cursor_for_motion(Client *c, int x, int y)
n = y < bw;
s = y >= c->frame.rect.height - bw;
- tw = x < (tabh ? tabh : 2 * bw);
- te = x > c->frame.rect.width - (tabh ? tabh : 2 * bw);
- tn = y < (tabh ? tabh : 2 * bw);
- ts = s > c->frame.rect.height - (tabh ? tabh : 2 * bw);
+ tw = x < (bh ? bh : 2 * bw);
+ te = x > c->frame.rect.width - (bh ? bh : 2 * bw);
+ tn = y < (bh ? bh : 2 * bw);
+ ts = s > c->frame.rect.height - (bh ? bh : 2 * bw);
if((w && n) || (w && tn) || (n && tw))
return nw_cursor;
diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c
@@ -706,13 +706,13 @@ main(int argc, char *argv[])
client = det = nil;
aq = nil;
- def.font = strdup("fixed");
+ def.font = strdup(BLITZ_FONT);
def.border = DEF_BORDER;
def.snap = DEF_SNAP;
- def.title = True;
+ def.bar = True;
cext_strlcpy(def.selcolor, BLITZ_SEL_COLOR, sizeof(def.selcolor));
blitz_loadcolor(dpy, screen, def.selcolor, &def.sel);
- cext_strlcpy(def.normcolor, BLITZ_SEL_COLOR, sizeof(def.normcolor));
+ cext_strlcpy(def.normcolor, BLITZ_NORM_COLOR, sizeof(def.normcolor));
blitz_loadcolor(dpy, screen, def.normcolor, &def.norm);
init_atoms();
diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h
@@ -29,7 +29,7 @@ enum {
Fnormcolor,
Fborder,
Fsnap,
- Ftitle,
+ Fbar,
Finc,
Fgeom,
Fevent,
@@ -88,7 +88,7 @@ struct Client {
XRectangle revert;
GC gc;
Cursor cursor;
- Bool title;
+ Bool bar;
unsigned int border;
} frame;
};
@@ -125,7 +125,7 @@ typedef struct {
char selcolor[24];
char normcolor[24];
char *font;
- Bool title;
+ Bool bar;
Bool inc;
Color sel;
Color norm;
@@ -178,7 +178,7 @@ Client *sel_client_of_page(Page *p);
void focus_client(Client *c);
Client *win_to_frame(Window w);
void resize_client(Client *c, XRectangle * r, XPoint * pt);
-unsigned int tab_height(Client *c);
+unsigned int bar_height(Client *c);
/* event.c */
void init_x_event_handler();
diff --git a/liblitz/blitz.h b/liblitz/blitz.h
@@ -7,14 +7,8 @@
#include <cext.h>
#define BLITZ_FONT "fixed"
-#define BLITZ_SEL_FG_COLOR "#eeeeee"
-#define BLITZ_SEL_BG_COLOR "#506070"
-#define BLITZ_SEL_BORDER_COLOR "#708090"
-#define BLITZ_NORM_FG_COLOR "#bbbbbb"
-#define BLITZ_NORM_BG_COLOR "#222222"
-#define BLITZ_NORM_BORDER_COLOR "#000000"
-#define BLITZ_SEL_COLOR "#eeeeee #506070 #708090"
-#define BLITZ_NORM_COLOR "#222222 #000000 #000000"
+#define BLITZ_SEL_COLOR "#eeeeee #005577 #006699"
+#define BLITZ_NORM_COLOR "#bbbbbb #222222 #000000"
typedef enum {
CENTER, WEST, NWEST, NORTH, NEAST, EAST,