use get_current_tags() for focus, fix some bugs with multiple selected tags

This commit is contained in:
Julien Danjou 2007-12-27 13:09:39 +01:00
parent 652fdc6cce
commit 1fb83771f0
1 changed files with 16 additions and 7 deletions

19
focus.c
View File

@ -116,7 +116,7 @@ uicb_focus_history(int screen, char *arg)
{ {
int i; int i;
FocusList *fl = globalconf.focus; FocusList *fl = globalconf.focus;
Tag *curtag = get_current_tag(screen); Tag **curtags, **tag;
if(arg) if(arg)
{ {
@ -124,9 +124,12 @@ uicb_focus_history(int screen, char *arg)
if(i < 0) if(i < 0)
{ {
curtags = get_current_tags(screen);
for(; fl && i < 0; fl = fl->prev) for(; fl && i < 0; fl = fl->prev)
if(is_client_tagged(fl->client, curtag, screen)) for(tag = curtags; *tag; tag++)
if(is_client_tagged(fl->client, *tag, screen))
i++; i++;
p_delete(&curtags);
if(fl) if(fl)
focus(fl->client, True, screen); focus(fl->client, True, screen);
} }
@ -137,11 +140,17 @@ void
uicb_focus_client_byname(int screen, char *arg) uicb_focus_client_byname(int screen, char *arg)
{ {
Client *c; Client *c;
Tag *curtag = get_current_tag(screen); Tag **curtags, **tag;
if(arg && (c = get_client_byname(globalconf.clients, arg)) if(arg)
&& is_client_tagged(c, curtag, screen)) {
curtags = get_current_tags(screen);
if((c = get_client_byname(globalconf.clients, arg)))
for(tag = curtags; *tag; tag++)
if(is_client_tagged(c, *tag, screen))
focus(c, True, screen); focus(c, True, screen);
p_delete(&curtags);
}
} }
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80