Mirror of Awesome WM window manager
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

banning.c 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * banning.c - client banning management
  3. *
  4. * Copyright © 2007-2009 Julien Danjou <julien@danjou.info>
  5. *
  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.
  10. *
  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.
  15. *
  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.
  19. *
  20. */
  21. #include "banning.h"
  22. #include "globalconf.h"
  23. #include "objects/client.h"
  24. /** Reban windows following current selected tags.
  25. */
  26. void
  27. banning_need_update(void)
  28. {
  29. /* We update the complete banning only once per main loop to avoid
  30. * excessive updates... */
  31. globalconf.need_lazy_banning = true;
  32. /* But if a client will be banned in our next update we unfocus it now. */
  33. foreach(_c, globalconf.clients)
  34. {
  35. client_t *c = *_c;
  36. if(!client_isvisible(c))
  37. client_ban_unfocus(c);
  38. }
  39. }
  40. /** Check all clients if they need to rebanned
  41. */
  42. void
  43. banning_refresh(void)
  44. {
  45. if (!globalconf.need_lazy_banning)
  46. return;
  47. globalconf.need_lazy_banning = false;
  48. client_ignore_enterleave_events();
  49. foreach(c, globalconf.clients)
  50. if(client_isvisible(*c))
  51. client_unban(*c);
  52. /* Some people disliked the short flicker of background, so we first unban everything.
  53. * Afterwards we ban everything we don't want. This should avoid that. */
  54. foreach(c, globalconf.clients)
  55. if(!client_isvisible(*c))
  56. client_ban(*c);
  57. client_restore_enterleave_events();
  58. }
  59. // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80