selection of tags works again (cursor settings need to be fixed however)

This commit is contained in:
Anselm R. Garbe 2006-06-29 11:53:45 +02:00
parent f6aa23fde1
commit 17bc1342d2
6 changed files with 16 additions and 43 deletions

View File

@ -777,7 +777,7 @@ apply_tags(Client *c, const char *tags)
update_client_views(c, toks);
XChangeProperty(blz.display, c->win, tags_atom, XA_STRING, 8,
PropModeReplace, c->tags, strlen(c->tags));
PropModeReplace, (unsigned char *)c->tags, strlen(c->tags));
}
static void

View File

@ -79,7 +79,7 @@ handle_buttonrelease(XEvent *e)
}
else if((f = frame_of_win(ev->window))) {
if(blitz_brelease_input(&f->tagbar, ev->x, ev->y))
map_frame(f, &f->tagbar.rect);
draw_frame(f);
write_event("ClientClick %d %d\n", idx_of_client(f->client), ev->button);
}
}
@ -92,7 +92,7 @@ handle_motionnotify(XEvent *e)
if((f = frame_of_win(ev->window))) {
if(blitz_bmotion_input(&f->tagbar, ev->x, ev->y))
map_frame(f, &f->tagbar.rect);
draw_frame(f);
}
}
@ -105,7 +105,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))
map_frame(f, &f->tagbar.rect);
draw_frame(f);
if((ev->state & def.mod) == def.mod) {
focus(f->client, True);
switch(ev->button) {

View File

@ -43,6 +43,8 @@ create_frame(Client *c, View *v)
f->tagbar.gc = c->gc;
f->tagbar.font = &def.font;
f->tagbar.color = def.normcolor;
f->tagbar.text = c->tags;
f->tagbar.size = sizeof(c->tags);
return f;
}
@ -86,20 +88,11 @@ update_frame_widget_colors(Frame *f)
f->posbar.color = def.normcolor;
}
void
map_frame(Frame *f, XRectangle *r)
{
XCopyArea(blz.display, pmap, f->client->framewin, f->client->gc,
r->x, r->y, r->width, r->height, r->x, r->y);
XSync(blz.display, False);
}
void
draw_frame(Frame *f)
{
Frame *p;
unsigned int fidx, size, w;
XRectangle r = f->rect;
for(fidx=0, p=f->area->frame; p && p != f; p=p->anext, fidx++);
for(size=fidx; p; p=p->anext, size++);
@ -123,9 +116,7 @@ draw_frame(Frame *f)
/* tag bar */
f->tagbar.rect = f->posbar.rect;
f->tagbar.rect.x = 0;
f->tagbar.rect.width = def.testtags ?
f->tagbar.rect.height + blitz_textwidth(&def.font, def.testtags) :
f->tagbar.rect.height + blitz_textwidth(&def.font, f->client->tags);
f->tagbar.rect.width = f->tagbar.rect.height + blitz_textwidth(&def.font, f->tagbar.text);
if(f->tagbar.rect.width > f->rect.width / 3)
f->tagbar.rect.width = f->rect.width / 3;
@ -135,12 +126,12 @@ draw_frame(Frame *f)
f->titlebar.rect.width = f->rect.width - (f->tagbar.rect.width + f->posbar.rect.width);
blitz_draw_tile(&f->tile);
f->tagbar.text = def.testtags ? def.testtags : f->client->tags;
blitz_draw_input(&f->tagbar);
blitz_draw_label(&f->titlebar, f->client->name);
blitz_draw_label(&f->posbar, buffer);
r.x = r.y = 0;
map_frame(f, &r);
XCopyArea(blz.display, pmap, f->client->framewin, f->client->gc,
0, 0, f->rect.width, f->rect.height, 0, 0);
XSync(blz.display, False);
}
void

View File

@ -288,11 +288,6 @@ message_root(char *message)
def.mod = mod;
if(view)
restack_view(sel);
}else if(!strncmp(message, "testtags ", 9)) {
message += 9;
free(def.testtags);
def.testtags = strlen(message) ? strdup(message) : nil;
draw_frames();
}else
return Ebadcmd;
@ -310,8 +305,6 @@ read_root_ctl()
i += snprintf(&buffer[i], (BUFFER_SIZE - i), "font %s\n", def.font.fontstr);
i += snprintf(&buffer[i], (BUFFER_SIZE - i), "grabmod %s\n", def.grabmod);
i += snprintf(&buffer[i], (BUFFER_SIZE - i), "border %d\n", def.border);
if(def.testtags)
i += snprintf(&buffer[i], (BUFFER_SIZE - i), "testtags %s\n", def.testtags);
return buffer;
}

View File

@ -156,7 +156,6 @@ typedef struct {
unsigned int border;
unsigned int snap;
char *keys;
char *testtags;
unsigned int keyssz;
Rules tagrules;
Rules colrules;
@ -265,7 +264,6 @@ void insert_frame(Frame *pos, Frame *f, Bool before);
void draw_frame(Frame *f);
void draw_frames();
void update_frame_widget_colors(Frame *f);
void map_frame(Frame *f, XRectangle *r);
/* fs.c */
void fs_attach(P9Req *r);

View File

@ -117,16 +117,12 @@ blitz_bpress_input(BlitzInput *i, int x, int y)
{
char *ostart, *oend;
if(!blitz_ispointinrect(x, y, &i->rect))
if(!(i->drag = blitz_ispointinrect(x, y, &i->rect)))
return False;
ostart = i->curstart;
oend = i->curend;
i->curstart = i->curend = charof(i, x, y);
i->drag = True;
if((i->curstart == ostart) && (i->curend == oend))
return False;
blitz_draw_input(i);
return True;
return (i->curstart == ostart) && (i->curend == oend);
}
Bool
@ -134,15 +130,12 @@ blitz_brelease_input(BlitzInput *i, int x, int y)
{
char *oend;
if(!blitz_ispointinrect(x, y, &i->rect))
if(!(i->drag = blitz_ispointinrect(x, y, &i->rect)))
return False;
oend = i->curend;
i->curend = charof(i, x, y);
i->drag = False;
if(i->curend == oend)
return False;
blitz_draw_input(i);
return True;
return i->curend == oend;
}
Bool
@ -150,17 +143,15 @@ blitz_bmotion_input(BlitzInput *i, int x, int y)
{
char *oend;
if(!i->drag || !blitz_ispointinrect(x, y, &i->rect))
if(!i->drag || !(i->drag = blitz_ispointinrect(x, y, &i->rect)))
return False;
oend = i->curend;
i->curend = charof(i, x, y);
if(i->curend == oend)
return False;
if(i->curstart > i->curend) {
char *tmp = i->curend;
i->curend = i->curstart;
i->curstart = tmp;
}
return True;
return i->curend == oend;
}