rearranged

This commit is contained in:
Anselm R. Garbe 2006-04-10 17:50:39 +02:00
parent c087c64dd2
commit 53b9c7b33f
5 changed files with 59 additions and 8 deletions

View File

@ -9,7 +9,7 @@ LDFLAGS += -L../../liblitz -llitz -L../../libixp -lixp -L../../libcext -lcext -
# Solaris
# LDFLAGS += -lsocket
SRC = area.c bar.c fs.c frame.c wm.c kb.c client.c event.c mouse.c rule.c tag.c view.c
SRC = area.c bar.c fs.c frame.c wm.c kb.c client.c event.c mouse.c rule.c view.c
OBJ = ${SRC:.c=.o}
all: wmiiwm

View File

@ -336,7 +336,7 @@ manage_client(Client *c)
match_tags(c, True);
reparent_client(c, c->framewin, c->rect.x, c->rect.y);
update_tags(c);
update_views(c);
}
static int
@ -367,7 +367,7 @@ destroy_client(Client *c)
XFreeGC(dpy, c->gc);
XDestroyWindow(dpy, c->framewin);
cext_vdetach(client2vector(&client), c);
update_tags(nil);
update_views(nil);
free(c);
XSync(dpy, False);

View File

@ -1210,7 +1210,7 @@ xwrite(IXPConn *c, Fcall *fcall)
else
cl = client.data[i1];
cext_strlcpy(cl->tags, buf, sizeof(cl->tags));
update_tags(cl);
update_views(cl);
draw_client(cl);
break;
case FsFgeom:

View File

@ -292,3 +292,56 @@ arrange_view(View *v, Bool dirty)
arrange_column(a, False);
}
}
void
update_views(Client *c)
{
unsigned int i;
if(c) {
char buf[256];
char *toks[16];
unsigned int j, n;
Bool match;
fprintf(stderr, "tags: %s\n", c->tags);
cext_strlcpy(buf, c->tags, sizeof(buf));
n = cext_tokenize(toks, 16, buf, '+');
for(i = 0; i < n; i++) {
View *v = get_view(toks[i]);
if(!clientofview(v, c))
attach_toview(v, c);
}
for(i = 0; i < c->view.size; i++) {
View *v = c->view.data[i];
match = False;
for(j = 0; j < n; j++) {
if(!strncmp(v->name, toks[j], sizeof(v->name)))
match = True;
}
if(!match)
detach_fromview(v, c);
}
}
for(i = 0; i < view.size; i++)
if(!hasclient(view.data[i]))
destroy_view(view.data[i]);
if(view.size)
focus_view(view.data[sel]);
else
update_bar_tags();
}
void
retag()
{
unsigned int i;
for(i = 0; i < client.size; i++) {
match_tags(client.data[i], False);
update_views(client.data[i]);
}
}

View File

@ -261,10 +261,6 @@ void ungrab_mouse(Window w, unsigned long mod, unsigned int button);
void update_rules();
void match_tags(Client *c, Bool newclient);
/* tag.c */
void update_tags(Client *c);
void retag();
/* view.c */
Vector *view2vector(ViewVector *vv);
void arrange_view(View *v, Bool dirty);
@ -283,6 +279,8 @@ Bool hasclient(View *v);
View *name2view(char *name);
void destroy_view(View *v);
View *get_view(char *name);
void update_views(Client *c);
void retag();
/* wm.c */
void scan_wins();