From 244d19fd0e794d2b0dc6f491292f1a839bd75d99 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 27 Mar 2011 19:57:06 +0200 Subject: [PATCH] Stop doing per-screen banning Signed-off-by: Uli Schlachter --- banning.c | 31 +++++++++++-------------------- banning.h | 2 +- globalconf.h | 2 ++ objects/client.c | 6 +++--- objects/tag.c | 8 ++++---- screen.h | 2 -- 6 files changed, 21 insertions(+), 30 deletions(-) diff --git a/banning.c b/banning.c index cfe3d961..be6aeb10 100644 --- a/banning.c +++ b/banning.c @@ -27,54 +27,45 @@ * \param screen The screen to arrange. */ void -banning_need_update(screen_t *screen) +banning_need_update(void) { /* We update the complete banning only once per main loop to avoid * excessive updates... */ - screen->need_lazy_banning = true; + globalconf.need_lazy_banning = true; /* But if a client will be banned in our next update we unfocus it now. */ foreach(_c, globalconf.clients) { client_t *c = *_c; - /* we don't touch other screens windows */ - if(!client_isvisible(c, screen) && c->screen == screen) + if(!client_isvisible(c, c->screen)) client_ban_unfocus(c); } } -static void -reban(screen_t *screen) +/** Check all clients if they need to rebanned + */ +void +banning_refresh(void) { - if (!screen->need_lazy_banning) + if (!globalconf.need_lazy_banning) return; - screen->need_lazy_banning = false; + globalconf.need_lazy_banning = false; client_ignore_enterleave_events(); foreach(c, globalconf.clients) - if(client_isvisible(*c, screen)) + if(client_isvisible(*c, (*c)->screen)) 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) - /* we don't touch other screens windows */ - if(!client_isvisible(*c, screen) && (*c)->screen == screen) + if(!client_isvisible(*c, (*c)->screen)) client_ban(*c); client_restore_enterleave_events(); } -/** Check all screens if they need to rebanned - */ -void -banning_refresh(void) -{ - foreach(screen, globalconf.screens) - 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 4cfaf6f6..30bb138c 100644 --- a/banning.h +++ b/banning.h @@ -24,7 +24,7 @@ #include "globalconf.h" -void banning_need_update(screen_t *); +void banning_need_update(void); void banning_refresh(void); #endif diff --git a/globalconf.h b/globalconf.h index 88272d28..3d78cfb6 100644 --- a/globalconf.h +++ b/globalconf.h @@ -113,6 +113,8 @@ typedef struct uint8_t default_depth; /** Our default color map */ xcb_colormap_t default_cmap; + /** Do we have to reban clients? */ + bool need_lazy_banning; } awesome_t; extern awesome_t globalconf; diff --git a/objects/client.c b/objects/client.c index ad5c7400..69d2e3c3 100644 --- a/objects/client.c +++ b/objects/client.c @@ -625,7 +625,7 @@ client_set_minimized(lua_State *L, int cidx, bool s) if(c->minimized != s) { c->minimized = s; - banning_need_update((c)->screen); + banning_need_update(); if(s) xwindow_set_state(c->window, XCB_WM_STATE_ICONIC); else @@ -649,7 +649,7 @@ client_set_sticky(lua_State *L, int cidx, bool s) if(c->sticky != s) { c->sticky = s; - banning_need_update((c)->screen); + banning_need_update(); luaA_object_emit_signal(L, cidx, "property::sticky", 0); } } @@ -1204,7 +1204,7 @@ luaA_client_set_hidden(lua_State *L, client_t *c) if(b != c->hidden) { c->hidden = b; - banning_need_update((c)->screen); + banning_need_update(); if(strut_has_value(&c->strut)) screen_emit_signal(globalconf.L, c->screen, "property::workarea", 0); luaA_object_emit_signal(L, -3, "property::hidden", 0); diff --git a/objects/tag.c b/objects/tag.c index 7f08ae15..cd0be646 100644 --- a/objects/tag.c +++ b/objects/tag.c @@ -74,7 +74,7 @@ tag_view(lua_State *L, int udx, bool view) if(tag->screen) { - banning_need_update(tag->screen); + banning_need_update(); ewmh_update_net_current_desktop(); } @@ -133,7 +133,7 @@ tag_remove_from_screen(tag_t *tag) /* tag was selected? If so, reban */ if(tag->selected) - banning_need_update(tag->screen); + banning_need_update(); ewmh_update_net_numbers_of_desktop(); ewmh_update_net_desktop_names(); @@ -181,7 +181,7 @@ tag_client(client_t *c) client_array_append(&t->clients, c); ewmh_client_update_desktop(c); - banning_need_update((c)->screen); + banning_need_update(); tag_client_emit_signal(globalconf.L, t, c, "tagged"); } @@ -197,7 +197,7 @@ untag_client(client_t *c, tag_t *t) if(t->clients.tab[i] == c) { client_array_take(&t->clients, i); - banning_need_update((c)->screen); + banning_need_update(); ewmh_client_update_desktop(c); tag_client_emit_signal(globalconf.L, t, c, "untagged"); luaA_object_unref(globalconf.L, t); diff --git a/screen.h b/screen.h index 3daea159..56ceb5de 100644 --- a/screen.h +++ b/screen.h @@ -36,8 +36,6 @@ struct a_screen tag_array_t tags; /** The signals emitted by screen objects */ signal_array_t signals; - /** True if the banning on this screen needs to be updated */ - bool need_lazy_banning; /** The screen outputs informations */ screen_output_array_t outputs; };