Stop doing per-screen banning

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2011-03-27 19:57:06 +02:00
parent 646eaad18e
commit 244d19fd0e
6 changed files with 21 additions and 30 deletions

View File

@ -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

View File

@ -24,7 +24,7 @@
#include "globalconf.h"
void banning_need_update(screen_t *);
void banning_need_update(void);
void banning_refresh(void);
#endif

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;
};