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 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. foreach(c, globalconf.clients)
  49. if(client_isvisible(*c))
  50. client_unban(*c);
  51. /* Some people disliked the short flicker of background, so we first unban everything.
  52. * Afterwards we ban everything we don't want. This should avoid that. */
  53. foreach(c, globalconf.clients)
  54. if(!client_isvisible(*c))
  55. client_ban(*c);
  56. }
  57. // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80