commit 6f3b0770349735edf44475217a6ebe7d4ab11c30
parent bb67bed0b976022d20160ed9c5d1fd4b7a541a8e
Author: Anselm R. Garbe <garbeam@wmii.de>
Date: Wed, 5 Jul 2006 15:14:50 +0200
added 3 more colorsets for marked text in tagbars
Diffstat:
7 files changed, 46 insertions(+), 18 deletions(-)
diff --git a/cmd/wm/event.c b/cmd/wm/event.c
@@ -78,7 +78,7 @@ handle_buttonrelease(XEvent *e)
ev->button, b->name);
}
else if((f = frame_of_win(ev->window))) {
- if(blitz_brelease_input(&f->tagbar, ev->x, ev->y, ev->time))
+ if(blitz_brelease_input(&f->tagbar, ev->button, ev->x, ev->y, ev->time))
draw_frame(f);
write_event("ClientClick %d %d\n", idx_of_client(f->client), ev->button);
}
@@ -103,7 +103,7 @@ handle_buttonpress(XEvent *e)
if((f = frame_of_win(ev->window))) {
ev->state &= valid_mask;
- if(blitz_bpress_input(&f->tagbar, ev->x, ev->y)) {
+ if(blitz_bpress_input(&f->tagbar, ev->button, ev->x, ev->y)) {
draw_frame(f);
}
else if((ev->state & def.mod) == def.mod) {
diff --git a/cmd/wm/frame.c b/cmd/wm/frame.c
@@ -45,6 +45,9 @@ create_frame(Client *c, View *v)
f->tagbar.gc = c->gc;
f->tagbar.font = &def.font;
f->tagbar.color = def.normcolor;
+ f->tagbar.bcolor[0] = def.bcolor[0];
+ f->tagbar.bcolor[1] = def.bcolor[1];
+ f->tagbar.bcolor[2] = def.bcolor[2];
blitz_setinput(&f->tagbar, c->tags);
return f;
@@ -78,6 +81,9 @@ insert_frame(Frame *pos, Frame *f, Bool before)
void
update_frame_widget_colors(Frame *f)
{
+ f->tagbar.bcolor[0] = def.bcolor[0];
+ f->tagbar.bcolor[1] = def.bcolor[1];
+ f->tagbar.bcolor[2] = def.bcolor[2];
if(sel_screen && (f->client == sel_client()))
f->tagbar.color = f->tile.color = f->titlebar.color = def.selcolor;
else
diff --git a/cmd/wm/fs.c b/cmd/wm/fs.c
@@ -265,6 +265,18 @@ message_root(char *message)
message += 11;
n = strlen(message);
return parse_colors(&message, (int *)&n, &def.normcolor);
+ }else if(!strncmp(message, "b1colors ", 9)) {
+ message += 9;
+ n = strlen(message);
+ return parse_colors(&message, (int *)&n, &def.bcolor[0]);
+ }else if(!strncmp(message, "b2colors ", 9)) {
+ message += 9;
+ n = strlen(message);
+ return parse_colors(&message, (int *)&n, &def.bcolor[1]);
+ }else if(!strncmp(message, "b3colors ", 9)) {
+ message += 9;
+ n = strlen(message);
+ return parse_colors(&message, (int *)&n, &def.bcolor[2]);
}else if(!strncmp(message, "font ", 5)) {
message += 5;
free(def.font.fontstr);
diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c
@@ -351,6 +351,12 @@ main(int argc, char *argv[])
blitz_loadcolor(&blz, &def.selcolor);
cext_strlcpy(def.normcolor.colstr, BLITZ_NORMCOLORS, sizeof(def.normcolor.colstr));
blitz_loadcolor(&blz, &def.normcolor);
+ cext_strlcpy(def.bcolor[0].colstr, BLITZ_B1COLORS, sizeof(def.bcolor[0].colstr));
+ cext_strlcpy(def.bcolor[1].colstr, BLITZ_B2COLORS, sizeof(def.bcolor[1].colstr));
+ cext_strlcpy(def.bcolor[2].colstr, BLITZ_B3COLORS, sizeof(def.bcolor[2].colstr));
+ blitz_loadcolor(&blz, &def.bcolor[0]);
+ blitz_loadcolor(&blz, &def.bcolor[1]);
+ blitz_loadcolor(&blz, &def.bcolor[2]);
cext_strlcpy(def.grabmod, "Mod1", sizeof(def.grabmod));
def.mod = Mod1Mask;
diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h
@@ -148,6 +148,7 @@ struct Ruleset {
struct {
BlitzColor selcolor;
BlitzColor normcolor;
+ BlitzColor bcolor[3];
BlitzFont font;
unsigned int border;
unsigned int snap;
diff --git a/liblitz/blitz.h b/liblitz/blitz.h
@@ -9,6 +9,9 @@
#define BLITZ_FONT "fixed"
#define BLITZ_SELCOLORS "#ffffff #335577 #447799"
#define BLITZ_NORMCOLORS "#222222 #eeeeee #666666"
+#define BLITZ_B1COLORS "#000000 #00ffff #000000"
+#define BLITZ_B2COLORS "#000000 #ff0000 #000000"
+#define BLITZ_B3COLORS "#000000 #00ff00 #000000"
typedef struct Blitz Blitz;
typedef enum BlitzAlign BlitzAlign;
@@ -70,11 +73,13 @@ struct BlitzInput {
unsigned int len;
unsigned long tdbclk;
int xdbclk, ydbclk;
+ int button;
Bool drag;
Drawable drawable;
Window win;
GC gc;
BlitzColor color;
+ BlitzColor bcolor[3];
BlitzFont *font;
XRectangle rect; /* relative rect */
};
@@ -100,8 +105,8 @@ void blitz_loadfont(Blitz *blitz, BlitzFont *font);
/* input.c */
void blitz_draw_input(BlitzInput *i);
/* blitz_b* functions return True on expose */
-Bool blitz_bpress_input(BlitzInput *i, int x, int y);
-Bool blitz_brelease_input(BlitzInput *i, int x, int y, unsigned long time);
+Bool blitz_bpress_input(BlitzInput *i, int button, int x, int y);
+Bool blitz_brelease_input(BlitzInput *i, int button, int x, int y, unsigned long time);
Bool blitz_bmotion_input(BlitzInput *i, int x, int y);
Bool blitz_ispointinrect(int x, int y, XRectangle * r);
void blitz_setinput(BlitzInput *i, char *text);
diff --git a/liblitz/input.c b/liblitz/input.c
@@ -12,18 +12,12 @@
#include "blitz.h"
static void
-xchangegc(BlitzInput *i, BlitzColor *c, Bool invert)
+xchangegc(BlitzInput *i, BlitzColor c)
{
XGCValues gcv;
- if(invert) {
- gcv.foreground = c->bg;
- gcv.background = c->fg;
- }
- else {
- gcv.foreground = c->fg;
- gcv.background = c->bg;
- }
+ gcv.foreground = c.fg;
+ gcv.background = c.bg;
if(i->font->set)
XChangeGC(i->blitz->dpy, i->gc, GCForeground | GCBackground, &gcv);
else {
@@ -110,14 +104,14 @@ blitz_draw_input(BlitzInput *i)
end = curend(i);
/* draw normal text */
- xchangegc(i, &i->color, False);
+ xchangegc(i, i->color);
xdrawtextpart(i, i->text, start, &xoff, yoff);
xcursor = xoff;
/* draw sel text */
- xchangegc(i, &i->color, True);
+ xchangegc(i, i->bcolor[i->button]);
xdrawtextpart(i, start, end, &xoff, yoff);
/* draw remaining normal text */
- xchangegc(i, &i->color, False);
+ xchangegc(i, i->color);
xdrawtextpart(i, end, i->text + i->len, &xoff, yoff);
/* draw cursor */
@@ -168,7 +162,7 @@ charof(BlitzInput *i, int x, int y)
}
Bool
-blitz_bpress_input(BlitzInput *i, int x, int y)
+blitz_bpress_input(BlitzInput *i, int button, int x, int y)
{
char *ostart, *oend;
@@ -179,6 +173,8 @@ blitz_bpress_input(BlitzInput *i, int x, int y)
ostart = i->curstart;
oend = i->curend;
i->curstart = i->curend = charof(i, x, y);
+ if((i->button = button - Button1) > 2)
+ i->button = 0;
return (i->curstart == ostart) && (i->curend == oend);
}
@@ -218,7 +214,7 @@ mark(BlitzInput *i, int x, int y)
}
Bool
-blitz_brelease_input(BlitzInput *i, int x, int y, unsigned long time)
+blitz_brelease_input(BlitzInput *i, int button, int x, int y, unsigned long time)
{
char *oend;
@@ -228,6 +224,8 @@ blitz_brelease_input(BlitzInput *i, int x, int y, unsigned long time)
RevertToPointerRoot, CurrentTime);
oend = i->curend;
+ if((i->button = button - Button1) > 2)
+ i->button = 0;
if((time - i->tdbclk < 1000) && (x == i->xdbclk && y == i->ydbclk)) {
mark(i, x, y);
i->drag = False;