implemented cursor rendering as well (now it has to be filled with life)

This commit is contained in:
Anselm R. Garbe 2006-06-22 13:22:02 +02:00
parent 7b54e864b6
commit 19148d825e
2 changed files with 23 additions and 5 deletions

View File

@ -147,6 +147,7 @@ draw_frame(Frame *f)
char *test = "tag1 tag2 tag3 tag4 | xterm";
char *testselstart = test+5;
char *testselend = test+9;
char *testcursor = test+23;
for(fidx=0, p=f->area->frame; p && p != f; p=p->anext, fidx++);
for(size=fidx; p; p=p->anext, size++);
@ -185,6 +186,7 @@ draw_frame(Frame *f)
f->tagbar.text = test;/*f->client->tags;*/
f->tagbar.selstart = testselstart;
f->tagbar.selend = testselend;
f->tagbar.cursor = testcursor;
blitz_draw_input(&f->tagbar);
blitz_draw_label(&f->titlebar, f->client->name);
blitz_draw_label(&f->posbar, buf);

View File

@ -102,24 +102,38 @@ blitz_draw_label(BlitzBrush *b, char *text)
}
static void
xdrawtextpart(BlitzInput *i, BlitzColor *c, char *start, char *end,
int *xoff, int yoff, unsigned int boxw)
xchangegc(BlitzInput *i, BlitzColor *c, Bool invert)
{
char *p, buf[2];
XGCValues gcv;
gcv.foreground = c->fg;
gcv.background = c->bg;
if(invert) {
gcv.foreground = c->bg;
gcv.background = c->fg;
}
else {
gcv.foreground = c->fg;
gcv.background = c->bg;
}
if(i->font->set)
XChangeGC(i->blitz->display, i->gc, GCForeground | GCBackground, &gcv);
else {
gcv.font = i->font->xfont->fid;
XChangeGC(i->blitz->display, i->gc, GCForeground | GCBackground | GCFont, &gcv);
}
}
static void
xdrawtextpart(BlitzInput *i, BlitzColor *c, char *start, char *end,
int *xoff, int yoff, unsigned int boxw)
{
char *p, buf[2];
xchangegc(i, c, False);
buf[1] = 0;
for(p = start; p && *p && p != end; p++) {
*buf = *p;
if(p == i->cursor)
xchangegc(i, c, True);
if(i->font->set)
XmbDrawImageString(i->blitz->display, i->drawable, i->font->set, i->gc,
*xoff, yoff, buf, 1);
@ -127,6 +141,8 @@ xdrawtextpart(BlitzInput *i, BlitzColor *c, char *start, char *end,
XDrawImageString(i->blitz->display, i->drawable, i->gc, *xoff, yoff,
buf, 1);
*xoff += boxw;
if(p == i->cursor)
xchangegc(i, c, False);
}
}