simplify is_client_tagged() proto
This commit is contained in:
parent
e95dc4b4cd
commit
48d9ea047f
6
client.c
6
client.c
|
@ -350,7 +350,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
|
|||
if((rettrans = XGetTransientForHint(c->display, w, &trans) == Success)
|
||||
&& (t = get_client_bywin(globalconf.clients, trans)))
|
||||
for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next)
|
||||
if(is_client_tagged(t, tag, c->screen))
|
||||
if(is_client_tagged(t, tag))
|
||||
tag_client(c, tag);
|
||||
|
||||
/* should be floating if transsient or fixed) */
|
||||
|
@ -481,7 +481,7 @@ client_saveprops(Client * c, int screen)
|
|||
prop = p_new(char, ntags + 2);
|
||||
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next, i++)
|
||||
prop[i] = is_client_tagged(c, tag, screen) ? '1' : '0';
|
||||
prop[i] = is_client_tagged(c, tag) ? '1' : '0';
|
||||
|
||||
if(i <= ntags)
|
||||
prop[i] = c->isfloating ? '1' : '0';
|
||||
|
@ -616,7 +616,7 @@ client_isvisible(Client *c, int screen)
|
|||
return False;
|
||||
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
if(tag->selected && is_client_tagged(c, tag, screen))
|
||||
if(tag->selected && is_client_tagged(c, tag))
|
||||
return True;
|
||||
return False;
|
||||
}
|
||||
|
|
10
focus.c
10
focus.c
|
@ -95,13 +95,13 @@ focus_delete_client(Client *c)
|
|||
}
|
||||
|
||||
static Client *
|
||||
focus_get_latest_client_for_tags(int screen, Tag **t)
|
||||
focus_get_latest_client_for_tags(Tag **t)
|
||||
{
|
||||
FocusList *fl;
|
||||
|
||||
for(fl = globalconf.focus; fl; fl = fl->prev)
|
||||
for(; *t; t++)
|
||||
if(is_client_tagged(fl->client, *t, screen))
|
||||
if(is_client_tagged(fl->client, *t))
|
||||
return fl->client;
|
||||
|
||||
return NULL;
|
||||
|
@ -111,7 +111,7 @@ Client *
|
|||
focus_get_current_client(int screen)
|
||||
{
|
||||
Tag **curtags = get_current_tags(screen);
|
||||
Client *sel = focus_get_latest_client_for_tags(screen, curtags);
|
||||
Client *sel = focus_get_latest_client_for_tags(curtags);
|
||||
p_delete(&curtags);
|
||||
|
||||
return sel;
|
||||
|
@ -138,7 +138,7 @@ uicb_focus_history(int screen, char *arg)
|
|||
curtags = get_current_tags(screen);
|
||||
for(; fl && i < 0; fl = fl->prev)
|
||||
for(tag = curtags; *tag; tag++)
|
||||
if(is_client_tagged(fl->client, *tag, screen))
|
||||
if(is_client_tagged(fl->client, *tag))
|
||||
i++;
|
||||
p_delete(&curtags);
|
||||
if(fl)
|
||||
|
@ -158,7 +158,7 @@ uicb_focus_client_byname(int screen, char *arg)
|
|||
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))
|
||||
if(is_client_tagged(c, *tag))
|
||||
focus(c, True, screen);
|
||||
p_delete(&curtags);
|
||||
}
|
||||
|
|
14
tag.c
14
tag.c
|
@ -53,7 +53,7 @@ tag_client(Client *c, Tag *t)
|
|||
TagClientLink *tc, *new_tc;
|
||||
|
||||
/* don't tag twice */
|
||||
if(is_client_tagged(c, t, c->screen))
|
||||
if(is_client_tagged(c, t))
|
||||
return;
|
||||
|
||||
new_tc = p_new(TagClientLink, 1);
|
||||
|
@ -81,14 +81,14 @@ untag_client(Client *c, Tag *t)
|
|||
}
|
||||
|
||||
Bool
|
||||
is_client_tagged(Client *c, Tag *t, int screen)
|
||||
is_client_tagged(Client *c, Tag *t)
|
||||
{
|
||||
TagClientLink *tc;
|
||||
|
||||
if(!c || c->screen != screen)
|
||||
if(!c)
|
||||
return False;
|
||||
|
||||
for(tc = globalconf.screens[screen].tclink; tc; tc = tc->next)
|
||||
for(tc = globalconf.screens[c->screen].tclink; tc; tc = tc->next)
|
||||
if(tc->client == c && tc->tag == t)
|
||||
return True;
|
||||
return False;
|
||||
|
@ -242,7 +242,7 @@ uicb_client_toggletag(int screen, char *arg)
|
|||
target_tag = target_tag->next, i--);
|
||||
if(target_tag)
|
||||
{
|
||||
if(is_client_tagged(sel, target_tag, screen))
|
||||
if(is_client_tagged(sel, target_tag))
|
||||
untag_client(sel, target_tag);
|
||||
else
|
||||
tag_client(sel, target_tag);
|
||||
|
@ -250,14 +250,14 @@ uicb_client_toggletag(int screen, char *arg)
|
|||
|
||||
/* check that there's at least one tag selected for this client*/
|
||||
for(tag = globalconf.screens[screen].tags; tag
|
||||
&& !is_client_tagged(sel, tag, screen); tag = tag->next)
|
||||
&& !is_client_tagged(sel, tag); tag = tag->next)
|
||||
|
||||
if(!tag)
|
||||
tag_client(sel, target_tag);
|
||||
}
|
||||
else
|
||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||
if(is_client_tagged(sel, tag, screen))
|
||||
if(is_client_tagged(sel, tag))
|
||||
tag_client(sel, tag);
|
||||
else
|
||||
untag_client(sel, tag);
|
||||
|
|
2
tag.h
2
tag.h
|
@ -30,7 +30,7 @@
|
|||
Tag ** get_current_tags(int );
|
||||
void tag_client(Client *, Tag *);
|
||||
void untag_client(Client *, Tag *);
|
||||
Bool is_client_tagged(Client *, Tag *, int);
|
||||
Bool is_client_tagged(Client *, Tag *);
|
||||
void tag_client_with_current_selected(Client *);
|
||||
void tag_client_with_rules(Client *);
|
||||
|
||||
|
|
|
@ -35,23 +35,23 @@ extern AwesomeConf globalconf;
|
|||
* \return True or False
|
||||
*/
|
||||
static Bool
|
||||
isoccupied(int screen, Tag *t)
|
||||
isoccupied(Tag *t)
|
||||
{
|
||||
Client *c;
|
||||
|
||||
for(c = globalconf.clients; c; c = c->next)
|
||||
if(is_client_tagged(c, t, screen))
|
||||
if(is_client_tagged(c, t))
|
||||
return True;
|
||||
return False;
|
||||
}
|
||||
|
||||
static Bool
|
||||
isurgent(int screen, Tag *t)
|
||||
isurgent(Tag *t)
|
||||
{
|
||||
Client *c;
|
||||
|
||||
for(c = globalconf.clients; c; c = c->next)
|
||||
if(is_client_tagged(c, t, screen) && c->isurgent)
|
||||
if(is_client_tagged(c, t) && c->isurgent)
|
||||
return True;
|
||||
|
||||
return False;
|
||||
|
@ -85,7 +85,7 @@ taglist_draw(Widget *widget,
|
|||
w = textwidth(vscreen.font, tag->name);
|
||||
if(tag->selected)
|
||||
colors = vscreen.colors_selected;
|
||||
else if(isurgent(widget->statusbar->screen, tag))
|
||||
else if(isurgent(tag))
|
||||
colors = vscreen.colors_urgent;
|
||||
else
|
||||
colors = vscreen.colors_normal;
|
||||
|
@ -95,12 +95,9 @@ taglist_draw(Widget *widget,
|
|||
tag->name,
|
||||
colors[ColFG],
|
||||
colors[ColBG]);
|
||||
if(isoccupied(widget->statusbar->screen, tag))
|
||||
if(isoccupied(tag))
|
||||
draw_rectangle(ctx, widget->location + widget->width, 0, flagsize, flagsize,
|
||||
sel && is_client_tagged(sel,
|
||||
tag,
|
||||
widget->statusbar->screen),
|
||||
colors[ColFG]);
|
||||
sel && is_client_tagged(sel, tag), colors[ColFG]);
|
||||
widget->width += w;
|
||||
}
|
||||
return widget->width;
|
||||
|
|
Loading…
Reference in New Issue