Stop doing per-screen banning
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
646eaad18e
commit
244d19fd0e
31
banning.c
31
banning.c
|
@ -27,54 +27,45 @@
|
||||||
* \param screen The screen to arrange.
|
* \param screen The screen to arrange.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
banning_need_update(screen_t *screen)
|
banning_need_update(void)
|
||||||
{
|
{
|
||||||
/* We update the complete banning only once per main loop to avoid
|
/* We update the complete banning only once per main loop to avoid
|
||||||
* excessive updates... */
|
* 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. */
|
/* But if a client will be banned in our next update we unfocus it now. */
|
||||||
foreach(_c, globalconf.clients)
|
foreach(_c, globalconf.clients)
|
||||||
{
|
{
|
||||||
client_t *c = *_c;
|
client_t *c = *_c;
|
||||||
|
|
||||||
/* we don't touch other screens windows */
|
if(!client_isvisible(c, c->screen))
|
||||||
if(!client_isvisible(c, screen) && c->screen == screen)
|
|
||||||
client_ban_unfocus(c);
|
client_ban_unfocus(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
/** Check all clients if they need to rebanned
|
||||||
reban(screen_t *screen)
|
*/
|
||||||
|
void
|
||||||
|
banning_refresh(void)
|
||||||
{
|
{
|
||||||
if (!screen->need_lazy_banning)
|
if (!globalconf.need_lazy_banning)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
screen->need_lazy_banning = false;
|
globalconf.need_lazy_banning = false;
|
||||||
|
|
||||||
client_ignore_enterleave_events();
|
client_ignore_enterleave_events();
|
||||||
|
|
||||||
foreach(c, globalconf.clients)
|
foreach(c, globalconf.clients)
|
||||||
if(client_isvisible(*c, screen))
|
if(client_isvisible(*c, (*c)->screen))
|
||||||
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)
|
||||||
/* we don't touch other screens windows */
|
if(!client_isvisible(*c, (*c)->screen))
|
||||||
if(!client_isvisible(*c, screen) && (*c)->screen == screen)
|
|
||||||
client_ban(*c);
|
client_ban(*c);
|
||||||
|
|
||||||
client_restore_enterleave_events();
|
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
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#include "globalconf.h"
|
#include "globalconf.h"
|
||||||
|
|
||||||
void banning_need_update(screen_t *);
|
void banning_need_update(void);
|
||||||
void banning_refresh(void);
|
void banning_refresh(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -113,6 +113,8 @@ typedef struct
|
||||||
uint8_t default_depth;
|
uint8_t default_depth;
|
||||||
/** Our default color map */
|
/** Our default color map */
|
||||||
xcb_colormap_t default_cmap;
|
xcb_colormap_t default_cmap;
|
||||||
|
/** Do we have to reban clients? */
|
||||||
|
bool need_lazy_banning;
|
||||||
} awesome_t;
|
} awesome_t;
|
||||||
|
|
||||||
extern awesome_t globalconf;
|
extern awesome_t globalconf;
|
||||||
|
|
|
@ -625,7 +625,7 @@ client_set_minimized(lua_State *L, int cidx, bool s)
|
||||||
if(c->minimized != s)
|
if(c->minimized != s)
|
||||||
{
|
{
|
||||||
c->minimized = s;
|
c->minimized = s;
|
||||||
banning_need_update((c)->screen);
|
banning_need_update();
|
||||||
if(s)
|
if(s)
|
||||||
xwindow_set_state(c->window, XCB_WM_STATE_ICONIC);
|
xwindow_set_state(c->window, XCB_WM_STATE_ICONIC);
|
||||||
else
|
else
|
||||||
|
@ -649,7 +649,7 @@ client_set_sticky(lua_State *L, int cidx, bool s)
|
||||||
if(c->sticky != s)
|
if(c->sticky != s)
|
||||||
{
|
{
|
||||||
c->sticky = s;
|
c->sticky = s;
|
||||||
banning_need_update((c)->screen);
|
banning_need_update();
|
||||||
luaA_object_emit_signal(L, cidx, "property::sticky", 0);
|
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)
|
if(b != c->hidden)
|
||||||
{
|
{
|
||||||
c->hidden = b;
|
c->hidden = b;
|
||||||
banning_need_update((c)->screen);
|
banning_need_update();
|
||||||
if(strut_has_value(&c->strut))
|
if(strut_has_value(&c->strut))
|
||||||
screen_emit_signal(globalconf.L, c->screen, "property::workarea", 0);
|
screen_emit_signal(globalconf.L, c->screen, "property::workarea", 0);
|
||||||
luaA_object_emit_signal(L, -3, "property::hidden", 0);
|
luaA_object_emit_signal(L, -3, "property::hidden", 0);
|
||||||
|
|
|
@ -74,7 +74,7 @@ tag_view(lua_State *L, int udx, bool view)
|
||||||
|
|
||||||
if(tag->screen)
|
if(tag->screen)
|
||||||
{
|
{
|
||||||
banning_need_update(tag->screen);
|
banning_need_update();
|
||||||
|
|
||||||
ewmh_update_net_current_desktop();
|
ewmh_update_net_current_desktop();
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ tag_remove_from_screen(tag_t *tag)
|
||||||
|
|
||||||
/* tag was selected? If so, reban */
|
/* tag was selected? If so, reban */
|
||||||
if(tag->selected)
|
if(tag->selected)
|
||||||
banning_need_update(tag->screen);
|
banning_need_update();
|
||||||
|
|
||||||
ewmh_update_net_numbers_of_desktop();
|
ewmh_update_net_numbers_of_desktop();
|
||||||
ewmh_update_net_desktop_names();
|
ewmh_update_net_desktop_names();
|
||||||
|
@ -181,7 +181,7 @@ tag_client(client_t *c)
|
||||||
|
|
||||||
client_array_append(&t->clients, c);
|
client_array_append(&t->clients, c);
|
||||||
ewmh_client_update_desktop(c);
|
ewmh_client_update_desktop(c);
|
||||||
banning_need_update((c)->screen);
|
banning_need_update();
|
||||||
|
|
||||||
tag_client_emit_signal(globalconf.L, t, c, "tagged");
|
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)
|
if(t->clients.tab[i] == c)
|
||||||
{
|
{
|
||||||
client_array_take(&t->clients, i);
|
client_array_take(&t->clients, i);
|
||||||
banning_need_update((c)->screen);
|
banning_need_update();
|
||||||
ewmh_client_update_desktop(c);
|
ewmh_client_update_desktop(c);
|
||||||
tag_client_emit_signal(globalconf.L, t, c, "untagged");
|
tag_client_emit_signal(globalconf.L, t, c, "untagged");
|
||||||
luaA_object_unref(globalconf.L, t);
|
luaA_object_unref(globalconf.L, t);
|
||||||
|
|
2
screen.h
2
screen.h
|
@ -36,8 +36,6 @@ struct a_screen
|
||||||
tag_array_t tags;
|
tag_array_t tags;
|
||||||
/** The signals emitted by screen objects */
|
/** The signals emitted by screen objects */
|
||||||
signal_array_t signals;
|
signal_array_t signals;
|
||||||
/** True if the banning on this screen needs to be updated */
|
|
||||||
bool need_lazy_banning;
|
|
||||||
/** The screen outputs informations */
|
/** The screen outputs informations */
|
||||||
screen_output_array_t outputs;
|
screen_output_array_t outputs;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue