From e95dc4b4cd2b588a6e20c26c4179b3b6277a2564 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 27 Dec 2007 22:43:59 +0100 Subject: [PATCH] simplify tag_client() and untag_client() proto --- client.c | 8 ++++---- ewmh.c | 2 +- screen.c | 2 +- tag.c | 40 ++++++++++++++++++++-------------------- tag.h | 4 ++-- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/client.c b/client.c index 3510df7a..10e44fe3 100644 --- a/client.c +++ b/client.c @@ -63,11 +63,11 @@ client_loadprops(Client * c, int screen) for(i = 0, tag = globalconf.screens[screen].tags; tag && i < ntags && prop[i]; i++, tag = tag->next) if(prop[i] == '1') { - tag_client(c, tag, screen); + tag_client(c, tag); result = True; } else - untag_client(c, tag, screen); + untag_client(c, tag); if(i <= ntags && prop[i]) c->isfloating = prop[i] == '1'; @@ -351,7 +351,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen) && (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)) - tag_client(c, tag, c->screen); + tag_client(c, tag); /* should be floating if transsient or fixed) */ if(!c->isfloating) @@ -516,7 +516,7 @@ client_unmanage(Client *c, long state) focus(NULL, True, c->screen); focus_delete_client(c); for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next) - untag_client(c, tag, c->screen); + untag_client(c, tag); XUngrabButton(c->display, AnyButton, AnyModifier, c->win); window_setstate(c->display, c->win, state); XSync(c->display, False); diff --git a/ewmh.c b/ewmh.c index b300122e..4dea9262 100644 --- a/ewmh.c +++ b/ewmh.c @@ -203,7 +203,7 @@ ewmh_process_state_atom(Client *c, Atom state) { Tag *tag; for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next) - tag_client(c, tag, c->screen); + tag_client(c, tag); } } diff --git a/screen.c b/screen.c index ff2032c8..973539e1 100644 --- a/screen.c +++ b/screen.c @@ -186,7 +186,7 @@ move_client_to_screen(Client *c, int new_screen, Bool doresize) Area from, to; for(tag = globalconf.screens[old_screen].tags; tag; tag = tag->next) - untag_client(c, tag, old_screen); + untag_client(c, tag); c->screen = new_screen; diff --git a/tag.c b/tag.c index 2172cc64..e84acbbd 100644 --- a/tag.c +++ b/tag.c @@ -48,21 +48,21 @@ detach_tagclientlink(int screen, TagClientLink *tc) } void -tag_client(Client *c, Tag *t, int screen) +tag_client(Client *c, Tag *t) { TagClientLink *tc, *new_tc; /* don't tag twice */ - if(is_client_tagged(c, t, screen)) + if(is_client_tagged(c, t, c->screen)) return; new_tc = p_new(TagClientLink, 1); - if(!globalconf.screens[screen].tclink) - globalconf.screens[screen].tclink = new_tc; + if(!globalconf.screens[c->screen].tclink) + globalconf.screens[c->screen].tclink = new_tc; else { - for(tc = globalconf.screens[screen].tclink; tc->next; tc = tc->next); + for(tc = globalconf.screens[c->screen].tclink; tc->next; tc = tc->next); tc->next = new_tc; } @@ -71,13 +71,13 @@ tag_client(Client *c, Tag *t, int screen) } void -untag_client(Client *c, Tag *t, int screen) +untag_client(Client *c, Tag *t) { TagClientLink *tc; - 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) - detach_tagclientlink(screen, tc); + detach_tagclientlink(c->screen, tc); } Bool @@ -102,9 +102,9 @@ tag_client_with_current_selected(Client *c) for(tag = vscreen.tags; tag; tag = tag->next) if(tag->selected) - tag_client(c, tag, c->screen); + tag_client(c, tag); else - untag_client(c, tag, c->screen); + untag_client(c, tag); } void @@ -126,10 +126,10 @@ tag_client_with_rules(Client *c) if(is_tag_match_rules(tag, r)) { matched = True; - tag_client(c, tag, c->screen); + tag_client(c, tag); } else - untag_client(c, tag, c->screen); + untag_client(c, tag); if(!matched) tag_client_with_current_selected(c); @@ -183,14 +183,14 @@ uicb_client_tag(int screen, char *arg) if(target_tag) { for(tag = globalconf.screens[screen].tags; tag; tag = tag->next) - untag_client(sel, tag, screen); - tag_client(sel, target_tag, screen); + untag_client(sel, tag); + tag_client(sel, target_tag); } } } else for(tag = globalconf.screens[screen].tags; tag; tag = tag->next) - tag_client(sel, tag, screen); + tag_client(sel, tag); client_saveprops(sel, screen); arrange(screen); @@ -243,9 +243,9 @@ uicb_client_toggletag(int screen, char *arg) if(target_tag) { if(is_client_tagged(sel, target_tag, screen)) - untag_client(sel, target_tag, screen); + untag_client(sel, target_tag); else - tag_client(sel, target_tag, screen); + tag_client(sel, target_tag); } /* check that there's at least one tag selected for this client*/ @@ -253,14 +253,14 @@ uicb_client_toggletag(int screen, char *arg) && !is_client_tagged(sel, tag, screen); tag = tag->next) if(!tag) - tag_client(sel, target_tag, screen); + tag_client(sel, target_tag); } else for(tag = globalconf.screens[screen].tags; tag; tag = tag->next) if(is_client_tagged(sel, tag, screen)) - tag_client(sel, tag, screen); + tag_client(sel, tag); else - untag_client(sel, tag, screen); + untag_client(sel, tag); client_saveprops(sel, screen); arrange(screen); diff --git a/tag.h b/tag.h index 45c0d1f1..57903c69 100644 --- a/tag.h +++ b/tag.h @@ -28,8 +28,8 @@ #define IS_TILED(client, screen) (client && !client->isfloating && client_isvisible(client, screen)) Tag ** get_current_tags(int ); -void tag_client(Client *, Tag *, int); -void untag_client(Client *, Tag *, int); +void tag_client(Client *, Tag *); +void untag_client(Client *, Tag *); Bool is_client_tagged(Client *, Tag *, int); void tag_client_with_current_selected(Client *); void tag_client_with_rules(Client *);