From 3a4fbce6f97facad3debae723a0ed1b8b2b0b153 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 14 Dec 2007 16:38:12 +0100 Subject: [PATCH] rename isvisible() to client_isvisible() and move it in client.c --- client.c | 26 ++++++++++++++++++++++---- client.h | 1 + layout.c | 12 ++++++------ layouts/floating.c | 2 +- tag.c | 18 ------------------ tag.h | 3 +-- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/client.c b/client.c index fde36f40..15a0d7d6 100644 --- a/client.c +++ b/client.c @@ -195,8 +195,8 @@ focus(Client *c, Bool selscreen, awesome_config *awesomeconf, int screen) Tag *tag = get_current_tag(awesomeconf->screens[screen]); /* if c is NULL or invisible, take next client in the stack */ - if((!c && selscreen) || (c && !isvisible(c, &awesomeconf->screens[screen], screen))) - for(c = awesomeconf->clients; c && !isvisible(c, &awesomeconf->screens[screen], screen); c = c->next); + if((!c && selscreen) || (c && !client_isvisible(c, &awesomeconf->screens[screen], screen))) + for(c = awesomeconf->clients; c && !client_isvisible(c, &awesomeconf->screens[screen], screen); c = c->next); /* XXX unfocus other tags clients, this is a bit too much */ for(i = 0; i < awesomeconf->screens[screen].ntags; i++) @@ -590,6 +590,24 @@ tag_client_with_rules(Client *c, awesome_config *awesomeconf) } } +/** Returns True if a client is tagged + * with one of the tags + * \return True or False + */ +Bool +client_isvisible(Client *c, VirtScreen *scr, int screen) +{ + int i; + + if(c->screen != screen) + return False; + + for(i = 0; i < scr->ntags; i++) + if(is_client_tagged(scr->tclink, c, &scr->tags[i]) && scr->tags[i].selected) + return True; + return False; +} + /** Set selected client transparency * \param awesomeconf awesome config * \param arg unused arg @@ -669,7 +687,7 @@ uicb_client_swapnext(awesome_config *awesomeconf, if(!sel) return; - for(next = sel->next; next && !isvisible(next, &awesomeconf->screens[screen], screen); next = next->next); + for(next = sel->next; next && !client_isvisible(next, &awesomeconf->screens[screen], screen); next = next->next); if(next) { client_swap(&awesomeconf->clients, sel, next); @@ -689,7 +707,7 @@ uicb_client_swapprev(awesome_config *awesomeconf, if(!sel) return; - for(prev = sel->prev; prev && !isvisible(prev, &awesomeconf->screens[screen], screen); prev = prev->prev); + for(prev = sel->prev; prev && !client_isvisible(prev, &awesomeconf->screens[screen], screen); prev = prev->prev); if(prev) { client_swap(&awesomeconf->clients, prev, sel); diff --git a/client.h b/client.h index 476054ca..370c7645 100644 --- a/client.h +++ b/client.h @@ -24,6 +24,7 @@ #include "common.h" +Bool client_isvisible(Client *, VirtScreen *, int); Client * get_client_bywin(Client *, Window); void client_attach(Client **, Client *); void client_detach(Client **, Client *); diff --git a/layout.c b/layout.c index 1533d10d..a17a883b 100644 --- a/layout.c +++ b/layout.c @@ -58,7 +58,7 @@ arrange(awesome_config *awesomeconf, int screen) for(c = awesomeconf->clients; c; c = c->next) { - if(isvisible(c, &awesomeconf->screens[screen], screen)) + if(client_isvisible(c, &awesomeconf->screens[screen], screen)) client_unban(c); /* we don't touch other screens windows */ else if(c->screen == screen) @@ -90,9 +90,9 @@ uicb_client_focusnext(awesome_config * awesomeconf, if(!sel) return; - for(c = sel->next; c && !isvisible(c, &awesomeconf->screens[screen], screen); c = c->next); + for(c = sel->next; c && !client_isvisible(c, &awesomeconf->screens[screen], screen); c = c->next); if(!c) - for(c = awesomeconf->clients; c && !isvisible(c, &awesomeconf->screens[screen], screen); c = c->next); + for(c = awesomeconf->clients; c && !client_isvisible(c, &awesomeconf->screens[screen], screen); c = c->next); if(c) { focus(c, True, awesomeconf, screen); @@ -109,11 +109,11 @@ uicb_client_focusprev(awesome_config *awesomeconf, if(!sel) return; - for(c = sel->prev; c && !isvisible(c, &awesomeconf->screens[screen], screen); c = c->prev); + for(c = sel->prev; c && !client_isvisible(c, &awesomeconf->screens[screen], screen); c = c->prev); if(!c) { for(c = awesomeconf->clients; c && c->next; c = c->next); - for(; c && !isvisible(c, &awesomeconf->screens[screen], screen); c = c->prev); + for(; c && !client_isvisible(c, &awesomeconf->screens[screen], screen); c = c->prev); } if(c) { @@ -310,7 +310,7 @@ uicb_client_zoom(awesome_config *awesomeconf, Client *sel = get_current_tag(awesomeconf->screens[screen])->client_sel; if(awesomeconf->clients == sel) - for(sel = sel->next; sel && !isvisible(sel, &awesomeconf->screens[screen], screen); sel = sel->next); + for(sel = sel->next; sel && !client_isvisible(sel, &awesomeconf->screens[screen], screen); sel = sel->next); if(!sel) return; diff --git a/layouts/floating.c b/layouts/floating.c index cf869329..8967a75c 100644 --- a/layouts/floating.c +++ b/layouts/floating.c @@ -28,7 +28,7 @@ layout_floating(awesome_config *awesomeconf, int screen) Client *c; for(c = awesomeconf->clients; c; c = c->next) - if(isvisible(c, &awesomeconf->screens[screen], screen)) + if(client_isvisible(c, &awesomeconf->screens[screen], screen)) client_resize(c, c->rx, c->ry, c->rw, c->rh, awesomeconf, True, False); } // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 diff --git a/tag.c b/tag.c index 742cdd31..6cdf5a95 100644 --- a/tag.c +++ b/tag.c @@ -93,24 +93,6 @@ is_client_tagged(TagClientLink *head, Client *c, Tag *t) return False; } -/** Returns True if a client is tagged - * with one of the tags - * \return True or False - */ -Bool -isvisible(Client *c, VirtScreen *scr, int screen) -{ - int i; - - if(c->screen != screen) - return False; - - for(i = 0; i < scr->ntags; i++) - if(is_client_tagged(scr->tclink, c, &scr->tags[i]) && scr->tags[i].selected) - return True; - return False; -} - void tag_client_with_current_selected(Client *c, VirtScreen *screen) { diff --git a/tag.h b/tag.h index 9275e3a2..51bf5f7b 100644 --- a/tag.h +++ b/tag.h @@ -25,9 +25,8 @@ #include "client.h" /** Check if a client is tiled */ -#define IS_TILED(client, scr, screen) (client && !client->isfloating && isvisible(client, scr, screen)) +#define IS_TILED(client, scr, screen) (client && !client->isfloating && client_isvisible(client, scr, screen)) -Bool isvisible(Client *, VirtScreen *, int); void tag_client(TagClientLink **, Client *, Tag *); void untag_client(TagClientLink **, Client *, Tag *); Bool is_client_tagged(TagClientLink *, Client *, Tag *);