globalconf: remove useless typedef
[awesome.git] / banning.c
blobfaeea022b35efb1184a3dabffd1e39a0d99792f5
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 "tag.h"
24 #include "window.h"
25 #include "screen.h"
26 #include "titlebar.h"
28 /** Reban windows following current selected tags.
29 * \param screen The screen to arrange.
31 static void
32 reban(screen_t *screen)
34 client_ignore_enterleave_events();
36 foreach(_c, globalconf.clients)
38 client_t *c = *_c;
40 /* Restore titlebar before client, so geometry is ok again. */
41 if(titlebar_isvisible(c, screen))
42 titlebar_unban(c->titlebar);
44 if(client_isvisible(c, screen))
45 client_unban(c);
48 /* Some people disliked the short flicker of background, so we first unban everything.
49 * Afterwards we ban everything we don't want. This should avoid that. */
50 foreach(_c, globalconf.clients)
52 client_t *c = *_c;
54 if(!titlebar_isvisible(c, screen) && c->screen == screen)
55 titlebar_ban(c->titlebar);
57 /* we don't touch other screens windows */
58 if(!client_isvisible(c, screen) && c->screen == screen)
59 client_ban(c);
62 client_restore_enterleave_events();
64 screen->need_reban = false;
67 /** Refresh the client disposition.
68 * \return true if the screen was arranged, false otherwise
70 void
71 banning_refresh(void)
73 foreach(screen, globalconf.screens)
74 if(screen->need_reban)
75 reban(screen);
78 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80