Re-add lazy banning
This kind-of-reverts 058dbab828
.
If banning_refresh() is called, only the lua events that it generated before are
now generated (the unfocus event). The actual mapping and unmapping of X11
windows is defered until the end of the main loop via a new per-screen
need_lazy_banning flag.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
9a56a3ad4b
commit
33e209dd83
38
banning.c
38
banning.c
|
@ -20,16 +20,39 @@
|
|||
*/
|
||||
|
||||
#include "banning.h"
|
||||
#include "tag.h"
|
||||
#include "window.h"
|
||||
#include "client.h"
|
||||
#include "titlebar.h"
|
||||
#include "screen.h"
|
||||
|
||||
/** Reban windows following current selected tags.
|
||||
* \param screen The screen to arrange.
|
||||
*/
|
||||
void
|
||||
banning_refresh(screen_t *screen)
|
||||
banning_need_update(screen_t *screen)
|
||||
{
|
||||
/* We update the complete banning only once per main loop to avoid
|
||||
* excessive updates... */
|
||||
screen->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)
|
||||
client_ban_unfocus(c);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
reban(screen_t *screen)
|
||||
{
|
||||
if (!screen->need_lazy_banning)
|
||||
return;
|
||||
|
||||
screen->need_lazy_banning = false;
|
||||
|
||||
client_ignore_enterleave_events();
|
||||
|
||||
foreach(_c, globalconf.clients)
|
||||
|
@ -61,4 +84,13 @@ banning_refresh(screen_t *screen)
|
|||
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
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
|
||||
#include "globalconf.h"
|
||||
|
||||
void banning_refresh(screen_t *);
|
||||
void banning_need_update(screen_t *);
|
||||
void banning_refresh(void);
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
6
client.c
6
client.c
|
@ -942,7 +942,7 @@ client_set_minimized(lua_State *L, int cidx, bool s)
|
|||
if(c->minimized != s)
|
||||
{
|
||||
c->minimized = s;
|
||||
banning_refresh((c)->screen);
|
||||
banning_need_update((c)->screen);
|
||||
if(s)
|
||||
window_state_set(c->window, XCB_WM_STATE_ICONIC);
|
||||
else
|
||||
|
@ -969,7 +969,7 @@ client_set_sticky(lua_State *L, int cidx, bool s)
|
|||
if(c->sticky != s)
|
||||
{
|
||||
c->sticky = s;
|
||||
banning_refresh((c)->screen);
|
||||
banning_need_update((c)->screen);
|
||||
ewmh_client_update_hints(c);
|
||||
hook_property(c, "sticky");
|
||||
luaA_object_emit_signal(L, cidx, "property::sticky", 0);
|
||||
|
@ -1684,7 +1684,7 @@ luaA_client_set_hidden(lua_State *L, client_t *c)
|
|||
if(b != c->hidden)
|
||||
{
|
||||
c->hidden = b;
|
||||
banning_refresh((c)->screen);
|
||||
banning_need_update((c)->screen);
|
||||
hook_property(c, "hidden");
|
||||
if(strut_has_value(&c->strut))
|
||||
screen_emit_signal(globalconf.L, c->screen, "property::workarea", 0);
|
||||
|
|
1
event.h
1
event.h
|
@ -28,6 +28,7 @@
|
|||
static inline int
|
||||
awesome_refresh(void)
|
||||
{
|
||||
banning_refresh();
|
||||
wibox_refresh();
|
||||
client_stack_refresh();
|
||||
return xcb_flush(globalconf.connection);
|
||||
|
|
2
screen.h
2
screen.h
|
@ -48,6 +48,8 @@ struct a_screen
|
|||
xcb_visualtype_t *visual;
|
||||
/** 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;
|
||||
};
|
||||
ARRAY_FUNCS(screen_t, screen, DO_NOTHING)
|
||||
|
||||
|
|
8
tag.c
8
tag.c
|
@ -83,7 +83,7 @@ tag_view(lua_State *L, int udx, bool view)
|
|||
{
|
||||
int screen_index = screen_array_indexof(&globalconf.screens, tag->screen);
|
||||
|
||||
banning_refresh(tag->screen);
|
||||
banning_need_update(tag->screen);
|
||||
|
||||
ewmh_update_net_current_desktop(screen_virttophys(screen_index));
|
||||
|
||||
|
@ -168,7 +168,7 @@ tag_remove_from_screen(tag_t *tag)
|
|||
|
||||
/* tag was selected? If so, reban */
|
||||
if(tag->selected)
|
||||
banning_refresh(tag->screen);
|
||||
banning_need_update(tag->screen);
|
||||
|
||||
ewmh_update_net_numbers_of_desktop(phys_screen);
|
||||
ewmh_update_net_desktop_names(phys_screen);
|
||||
|
@ -226,7 +226,7 @@ tag_client(client_t *c)
|
|||
|
||||
client_array_append(&t->clients, c);
|
||||
ewmh_client_update_desktop(c);
|
||||
banning_refresh((c)->screen);
|
||||
banning_need_update((c)->screen);
|
||||
|
||||
/* call hook */
|
||||
if(globalconf.hooks.tagged != LUA_REFNIL)
|
||||
|
@ -249,7 +249,7 @@ untag_client(client_t *c, tag_t *t)
|
|||
if(t->clients.tab[i] == c)
|
||||
{
|
||||
client_array_take(&t->clients, i);
|
||||
banning_refresh((c)->screen);
|
||||
banning_need_update((c)->screen);
|
||||
ewmh_client_update_desktop(c);
|
||||
/* call hook */
|
||||
if(globalconf.hooks.tagged != LUA_REFNIL)
|
||||
|
|
Loading…
Reference in New Issue