rename isvisible() to client_isvisible() and move it in client.c

This commit is contained in:
Julien Danjou 2007-12-14 16:38:12 +01:00
parent e426e60801
commit 3a4fbce6f9
6 changed files with 31 additions and 31 deletions

View File

@ -195,8 +195,8 @@ focus(Client *c, Bool selscreen, awesome_config *awesomeconf, int screen)
Tag *tag = get_current_tag(awesomeconf->screens[screen]); Tag *tag = get_current_tag(awesomeconf->screens[screen]);
/* if c is NULL or invisible, take next client in the stack */ /* if c is NULL or invisible, take next client in the stack */
if((!c && selscreen) || (c && !isvisible(c, &awesomeconf->screens[screen], screen))) if((!c && selscreen) || (c && !client_isvisible(c, &awesomeconf->screens[screen], screen)))
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);
/* XXX unfocus other tags clients, this is a bit too much */ /* XXX unfocus other tags clients, this is a bit too much */
for(i = 0; i < awesomeconf->screens[screen].ntags; i++) 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 /** Set selected client transparency
* \param awesomeconf awesome config * \param awesomeconf awesome config
* \param arg unused arg * \param arg unused arg
@ -669,7 +687,7 @@ uicb_client_swapnext(awesome_config *awesomeconf,
if(!sel) if(!sel)
return; 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) if(next)
{ {
client_swap(&awesomeconf->clients, sel, next); client_swap(&awesomeconf->clients, sel, next);
@ -689,7 +707,7 @@ uicb_client_swapprev(awesome_config *awesomeconf,
if(!sel) if(!sel)
return; 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) if(prev)
{ {
client_swap(&awesomeconf->clients, prev, sel); client_swap(&awesomeconf->clients, prev, sel);

View File

@ -24,6 +24,7 @@
#include "common.h" #include "common.h"
Bool client_isvisible(Client *, VirtScreen *, int);
Client * get_client_bywin(Client *, Window); Client * get_client_bywin(Client *, Window);
void client_attach(Client **, Client *); void client_attach(Client **, Client *);
void client_detach(Client **, Client *); void client_detach(Client **, Client *);

View File

@ -58,7 +58,7 @@ arrange(awesome_config *awesomeconf, int screen)
for(c = awesomeconf->clients; c; c = c->next) 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); client_unban(c);
/* we don't touch other screens windows */ /* we don't touch other screens windows */
else if(c->screen == screen) else if(c->screen == screen)
@ -90,9 +90,9 @@ uicb_client_focusnext(awesome_config * awesomeconf,
if(!sel) if(!sel)
return; 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) 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) if(c)
{ {
focus(c, True, awesomeconf, screen); focus(c, True, awesomeconf, screen);
@ -109,11 +109,11 @@ uicb_client_focusprev(awesome_config *awesomeconf,
if(!sel) if(!sel)
return; 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) if(!c)
{ {
for(c = awesomeconf->clients; c && c->next; c = c->next); 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) if(c)
{ {
@ -310,7 +310,7 @@ uicb_client_zoom(awesome_config *awesomeconf,
Client *sel = get_current_tag(awesomeconf->screens[screen])->client_sel; Client *sel = get_current_tag(awesomeconf->screens[screen])->client_sel;
if(awesomeconf->clients == 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) if(!sel)
return; return;

View File

@ -28,7 +28,7 @@ layout_floating(awesome_config *awesomeconf, int screen)
Client *c; Client *c;
for(c = awesomeconf->clients; c; c = c->next) 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); 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 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99

18
tag.c
View File

@ -93,24 +93,6 @@ is_client_tagged(TagClientLink *head, Client *c, Tag *t)
return False; 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 void
tag_client_with_current_selected(Client *c, VirtScreen *screen) tag_client_with_current_selected(Client *c, VirtScreen *screen)
{ {

3
tag.h
View File

@ -25,9 +25,8 @@
#include "client.h" #include "client.h"
/** Check if a client is tiled */ /** 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 tag_client(TagClientLink **, Client *, Tag *);
void untag_client(TagClientLink **, Client *, Tag *); void untag_client(TagClientLink **, Client *, Tag *);
Bool is_client_tagged(TagClientLink *, Client *, Tag *); Bool is_client_tagged(TagClientLink *, Client *, Tag *);