diff --git a/banning.c b/banning.c index faeea022..053e64ca 100644 --- a/banning.c +++ b/banning.c @@ -22,14 +22,13 @@ #include "banning.h" #include "tag.h" #include "window.h" -#include "screen.h" #include "titlebar.h" /** Reban windows following current selected tags. * \param screen The screen to arrange. */ -static void -reban(screen_t *screen) +void +banning_refresh(screen_t *screen) { client_ignore_enterleave_events(); @@ -60,19 +59,6 @@ reban(screen_t *screen) } client_restore_enterleave_events(); - - screen->need_reban = false; -} - -/** Refresh the client disposition. - * \return true if the screen was arranged, false otherwise - */ -void -banning_refresh(void) -{ - foreach(screen, globalconf.screens) - if(screen->need_reban) - reban(screen); } // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/banning.h b/banning.h index 8c4eccf0..bdea58cd 100644 --- a/banning.h +++ b/banning.h @@ -22,7 +22,9 @@ #ifndef AWESOME_BANNING_H #define AWESOME_BANNING_H -void banning_refresh(void); +#include "globalconf.h" + +void banning_refresh(screen_t *); #endif // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/client.h b/client.h index 66eb260c..b29b5311 100644 --- a/client.h +++ b/client.h @@ -26,6 +26,7 @@ #include "stack.h" #include "strut.h" #include "draw.h" +#include "banning.h" #include "common/luaobject.h" #define CLIENT_SELECT_INPUT_EVENT_MASK (XCB_EVENT_MASK_STRUCTURE_NOTIFY \ @@ -161,9 +162,8 @@ LUA_OBJECT_FUNCS(client_class, client_t, client) #define client_need_reban(c) \ do { \ - if(!c->screen->need_reban \ - && client_isvisible(c, (c)->screen)) \ - c->screen->need_reban = true; \ + if(client_isvisible(c, (c)->screen)) \ + banning_refresh((c)->screen); \ } while(0) bool client_maybevisible(client_t *, screen_t *); diff --git a/event.h b/event.h index 8f19e852..5245ef65 100644 --- a/event.h +++ b/event.h @@ -23,13 +23,11 @@ #define AWESOME_EVENT_H #include "wibox.h" -#include "banning.h" #include "client.h" static inline int awesome_refresh(void) { - banning_refresh(); wibox_refresh(); client_stack_refresh(); return xcb_flush(globalconf.connection); diff --git a/screen.h b/screen.h index 104e4325..8aafe858 100644 --- a/screen.h +++ b/screen.h @@ -29,8 +29,6 @@ struct a_screen { /** Screen geometry */ area_t geometry; - /** True if we need to reban() */ - bool need_reban; /** Tag list */ tag_array_t tags; /** Window that contains the systray */ diff --git a/tag.c b/tag.c index 84256c3d..8895882d 100644 --- a/tag.c +++ b/tag.c @@ -66,12 +66,6 @@ luaA_tag_gc(lua_State *L) OBJECT_EXPORT_PROPERTY(tag, tag_t, selected) OBJECT_EXPORT_PROPERTY(tag, tag_t, name) -void -tag_set_screen(tag_t *tag, screen_t *s) -{ - tag->screen = s; -} - /** View or unview a tag. * \param L The Lua VM state. * \param udx The index of the tag on the stack. @@ -91,7 +85,7 @@ tag_view(lua_State *L, int udx, bool view) { int screen_index = screen_array_indexof(&globalconf.screens, tag->screen); - tag->screen->need_reban = true; + banning_refresh(tag->screen); ewmh_update_net_current_desktop(screen_virttophys(screen_index)); @@ -171,6 +165,11 @@ tag_remove_from_screen(tag_t *tag) tag_array_take(tags, i); break; } + + /* tag was selected? If so, reban */ + if(tag->selected) + banning_refresh(tag->screen); + ewmh_update_net_numbers_of_desktop(phys_screen); ewmh_update_net_desktop_names(phys_screen); ewmh_update_workarea(phys_screen);