diff --git a/banning.c b/banning.c index be6aeb107..8dec623d8 100644 --- a/banning.c +++ b/banning.c @@ -38,7 +38,7 @@ banning_need_update(void) { client_t *c = *_c; - if(!client_isvisible(c, c->screen)) + if(!client_isvisible(c)) client_ban_unfocus(c); } } @@ -56,13 +56,13 @@ banning_refresh(void) client_ignore_enterleave_events(); foreach(c, globalconf.clients) - if(client_isvisible(*c, (*c)->screen)) + if(client_isvisible(*c)) client_unban(*c); /* 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. */ foreach(c, globalconf.clients) - if(!client_isvisible(*c, (*c)->screen)) + if(!client_isvisible(*c)) client_ban(*c); client_restore_enterleave_events(); diff --git a/event.c b/event.c index 73748f643..7ece36fe2 100644 --- a/event.c +++ b/event.c @@ -531,7 +531,7 @@ event_handle_maprequest(xcb_map_request_event_t *ev) else if((c = client_getbywin(ev->window))) { /* 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); client_set_minimized(globalconf.L, -1, false); diff --git a/objects/client.c b/objects/client.c index 69d2e3c32..53e3df249 100644 --- a/objects/client.c +++ b/objects/client.c @@ -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. */ 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; + + foreach(tag, c->screen->tags) + if(tag_get_selected(*tag) && is_client_tagged(c, *tag)) return true; - foreach(tag, screen->tags) - if(tag_get_selected(*tag) && is_client_tagged(c, *tag)) - return true; - } return false; } @@ -278,7 +276,7 @@ client_restore_enterleave_events(void) void client_focus_update(client_t *c) { - if(!client_maybevisible(c, c->screen)) + if(!client_maybevisible(c)) return; if(globalconf.focus.client) @@ -310,7 +308,7 @@ client_focus(client_t *c) if(!c && globalconf.clients.len && !(c = globalconf.clients.tab[0])) return; - if(!client_maybevisible(c, c->screen)) + if(!client_maybevisible(c)) return; client_focus_update(c); @@ -976,7 +974,7 @@ static int luaA_client_isvisible(lua_State *L) { 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; } diff --git a/objects/client.h b/objects/client.h index ed65b1c9c..086c00a7b 100644 --- a/objects/client.h +++ b/objects/client.h @@ -110,7 +110,7 @@ lua_class_t client_class; 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_getbyframewin(xcb_window_t); @@ -203,9 +203,9 @@ client_isfixed(client_t *c) * \return true if the client is visible, false otherwise. */ 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 diff --git a/screen.c b/screen.c index f6a6717f3..e0cbae7ab 100644 --- a/screen.c +++ b/screen.c @@ -295,7 +295,7 @@ screen_area_get(screen_t *screen, bool strut) } foreach(c, globalconf.clients) - if(client_isvisible(*c, screen)) + if((*c)->screen == screen && client_isvisible(*c)) COMPUTE_STRUT(*c) foreach(drawin, globalconf.drawins)