mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-16 07:47:22 +01:00
7481a6e6b8
Every call to client_ignore_enterleave_events() must be paired with a following call to client_restore_enterleave_events(). In between these two calls, no other calls to client_ignore_enterleave_events() is allowed. The code in banning_refresh() sometimes broke these rules. This can happen because the code causes signals to be emitted and Lua code can do basically anything. Fix this by moving the calls into the called functions. Fixes: https://github.com/awesomeWM/awesome/issues/1746 Signed-off-by: Uli Schlachter <psychon@znc.in>
66 lines
1.9 KiB
C
66 lines
1.9 KiB
C
/*
|
|
* banning.c - client banning management
|
|
*
|
|
* Copyright © 2007-2009 Julien Danjou <julien@danjou.info>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*
|
|
*/
|
|
|
|
#include "banning.h"
|
|
#include "globalconf.h"
|
|
#include "objects/client.h"
|
|
|
|
/** Reban windows following current selected tags.
|
|
*/
|
|
void
|
|
banning_need_update(void)
|
|
{
|
|
/* We update the complete banning only once per main loop to avoid
|
|
* excessive updates... */
|
|
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;
|
|
|
|
if(!client_isvisible(c))
|
|
client_ban_unfocus(c);
|
|
}
|
|
}
|
|
|
|
/** Check all clients if they need to rebanned
|
|
*/
|
|
void
|
|
banning_refresh(void)
|
|
{
|
|
if (!globalconf.need_lazy_banning)
|
|
return;
|
|
|
|
globalconf.need_lazy_banning = false;
|
|
|
|
foreach(c, globalconf.clients)
|
|
if(client_isvisible(*c))
|
|
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)
|
|
if(!client_isvisible(*c))
|
|
client_ban(*c);
|
|
}
|
|
|
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|