tag: Improve tag property::index support (FS#1229)
[awesome.git] / banning.c
blobef1181e8d121549eff7c0eb142f414fdc4c7ef4a
1 /*
2 * banning.c - client banning management
4 * Copyright © 2007-2009 Julien Danjou <julien@danjou.info>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "banning.h"
23 #include "globalconf.h"
24 #include "objects/client.h"
26 /** Reban windows following current selected tags.
27 * \param screen The screen to arrange.
29 void
30 banning_need_update(void)
32 /* We update the complete banning only once per main loop to avoid
33 * excessive updates... */
34 globalconf.need_lazy_banning = true;
36 /* But if a client will be banned in our next update we unfocus it now. */
37 foreach(_c, globalconf.clients)
39 client_t *c = *_c;
41 if(!client_isvisible(c))
42 client_ban_unfocus(c);
46 /** Check all clients if they need to rebanned
48 void
49 banning_refresh(void)
51 if (!globalconf.need_lazy_banning)
52 return;
54 globalconf.need_lazy_banning = false;
56 client_ignore_enterleave_events();
58 foreach(c, globalconf.clients)
59 if(client_isvisible(*c))
60 client_unban(*c);
62 /* Some people disliked the short flicker of background, so we first unban everything.
63 * Afterwards we ban everything we don't want. This should avoid that. */
64 foreach(c, globalconf.clients)
65 if(!client_isvisible(*c))
66 client_ban(*c);
68 client_restore_enterleave_events();
71 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80