Remove a useless function argument

Both client_isvisible() and client_maybevisible() where almost exclusively
called with the client's screen as their second argument. Remove this second
argument and let these functions instead always act on the client's screen.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2011-03-27 20:07:14 +02:00
parent 244d19fd0e
commit af5e5e8e9c
5 changed files with 17 additions and 19 deletions

View File

@ -38,7 +38,7 @@ banning_need_update(void)
{ {
client_t *c = *_c; client_t *c = *_c;
if(!client_isvisible(c, c->screen)) if(!client_isvisible(c))
client_ban_unfocus(c); client_ban_unfocus(c);
} }
} }
@ -56,13 +56,13 @@ banning_refresh(void)
client_ignore_enterleave_events(); client_ignore_enterleave_events();
foreach(c, globalconf.clients) foreach(c, globalconf.clients)
if(client_isvisible(*c, (*c)->screen)) if(client_isvisible(*c))
client_unban(*c); client_unban(*c);
/* Some people disliked the short flicker of background, so we first unban everything. /* Some people disliked the short flicker of background, so we first unban everything.
* Afterwards we ban everything we don't want. This should avoid that. */ * Afterwards we ban everything we don't want. This should avoid that. */
foreach(c, globalconf.clients) foreach(c, globalconf.clients)
if(!client_isvisible(*c, (*c)->screen)) if(!client_isvisible(*c))
client_ban(*c); client_ban(*c);
client_restore_enterleave_events(); client_restore_enterleave_events();

View File

@ -531,7 +531,7 @@ event_handle_maprequest(xcb_map_request_event_t *ev)
else if((c = client_getbywin(ev->window))) else if((c = client_getbywin(ev->window)))
{ {
/* Check that it may be visible, but not asked to be hidden */ /* Check that it may be visible, but not asked to be hidden */
if(client_maybevisible(c, c->screen) && !c->hidden) if(client_maybevisible(c) && !c->hidden)
{ {
luaA_object_push(globalconf.L, c); luaA_object_push(globalconf.L, c);
client_set_minimized(globalconf.L, -1, false); client_set_minimized(globalconf.L, -1, false);

View File

@ -141,17 +141,15 @@ client_set_class_instance(lua_State *L, int cidx, const char *class, const char
* \return true if the client is visible, false otherwise. * \return true if the client is visible, false otherwise.
*/ */
bool bool
client_maybevisible(client_t *c, screen_t *screen) client_maybevisible(client_t *c)
{ {
if(screen && c->screen == screen)
{
if(c->sticky || c->type == WINDOW_TYPE_DESKTOP) if(c->sticky || c->type == WINDOW_TYPE_DESKTOP)
return true; return true;
foreach(tag, screen->tags) foreach(tag, c->screen->tags)
if(tag_get_selected(*tag) && is_client_tagged(c, *tag)) if(tag_get_selected(*tag) && is_client_tagged(c, *tag))
return true; return true;
}
return false; return false;
} }
@ -278,7 +276,7 @@ client_restore_enterleave_events(void)
void void
client_focus_update(client_t *c) client_focus_update(client_t *c)
{ {
if(!client_maybevisible(c, c->screen)) if(!client_maybevisible(c))
return; return;
if(globalconf.focus.client) if(globalconf.focus.client)
@ -310,7 +308,7 @@ client_focus(client_t *c)
if(!c && globalconf.clients.len && !(c = globalconf.clients.tab[0])) if(!c && globalconf.clients.len && !(c = globalconf.clients.tab[0]))
return; return;
if(!client_maybevisible(c, c->screen)) if(!client_maybevisible(c))
return; return;
client_focus_update(c); client_focus_update(c);
@ -976,7 +974,7 @@ static int
luaA_client_isvisible(lua_State *L) luaA_client_isvisible(lua_State *L)
{ {
client_t *c = luaA_checkudata(L, 1, &client_class); client_t *c = luaA_checkudata(L, 1, &client_class);
lua_pushboolean(L, client_isvisible(c, c->screen)); lua_pushboolean(L, client_isvisible(c));
return 1; return 1;
} }

View File

@ -110,7 +110,7 @@ lua_class_t client_class;
LUA_OBJECT_FUNCS(client_class, client_t, client) LUA_OBJECT_FUNCS(client_class, client_t, client)
bool client_maybevisible(client_t *, screen_t *); bool client_maybevisible(client_t *);
client_t * client_getbywin(xcb_window_t); client_t * client_getbywin(xcb_window_t);
client_t * client_getbyframewin(xcb_window_t); client_t * client_getbyframewin(xcb_window_t);
@ -203,9 +203,9 @@ client_isfixed(client_t *c)
* \return true if the client is visible, false otherwise. * \return true if the client is visible, false otherwise.
*/ */
static inline bool static inline bool
client_isvisible(client_t *c, screen_t *screen) client_isvisible(client_t *c)
{ {
return (!c->hidden && !c->minimized && client_maybevisible(c, screen)); return (!c->hidden && !c->minimized && client_maybevisible(c));
} }
#endif #endif

View File

@ -295,7 +295,7 @@ screen_area_get(screen_t *screen, bool strut)
} }
foreach(c, globalconf.clients) foreach(c, globalconf.clients)
if(client_isvisible(*c, screen)) if((*c)->screen == screen && client_isvisible(*c))
COMPUTE_STRUT(*c) COMPUTE_STRUT(*c)
foreach(drawin, globalconf.drawins) foreach(drawin, globalconf.drawins)