diff options
author | markt <markt> | 2007-11-12 21:59:43 (GMT) |
---|---|---|
committer | markt <markt> | 2007-11-12 21:59:43 (GMT) |
commit | 5d7043320da1378e7dd3b10f7e425f3b47455b28 (patch) | |
tree | 305db18a58ab6768b78ab230074da576d09e372d /src/FbTk/Subject.cc | |
parent | 807a1b557552e43dbdc169c1e7a3065a3f12aac7 (diff) | |
download | fluxbox-5d7043320da1378e7dd3b10f7e425f3b47455b28.zip fluxbox-5d7043320da1378e7dd3b10f7e425f3b47455b28.tar.bz2 |
allow arbitrary window patterns in iconbar
Diffstat (limited to 'src/FbTk/Subject.cc')
-rw-r--r-- | src/FbTk/Subject.cc | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/FbTk/Subject.cc b/src/FbTk/Subject.cc index 08a211c..7ff80cf 100644 --- a/src/FbTk/Subject.cc +++ b/src/FbTk/Subject.cc | |||
@@ -58,16 +58,22 @@ void Subject::detach(Observer *obj) { | |||
58 | } | 58 | } |
59 | 59 | ||
60 | void Subject::notify() { | 60 | void Subject::notify() { |
61 | m_notify_mode = true; | 61 | ObserverList::iterator it = m_observerlist.begin(), |
62 | std::for_each(m_observerlist.begin(), m_observerlist.end(), | 62 | it_end = m_observerlist.end(); |
63 | std::bind2nd(std::mem_fun(&Observer::update), this)); | 63 | for (; it != it_end; ++it) { |
64 | m_notify_mode = false; | 64 | m_notify_mode = true; |
65 | (*it)->update(this); | ||
66 | ObserverList::iterator d_it = m_dead_observers.begin(), | ||
67 | d_it_end = m_dead_observers.end(); | ||
68 | m_notify_mode = false; | ||
65 | 69 | ||
66 | // remove dead observers | 70 | // there might be dead observers later in the list, so we must remove |
67 | if (!m_dead_observers.empty()) { | 71 | // them now |
68 | std::for_each(m_dead_observers.begin(), | 72 | for (; d_it != d_it_end; ++d_it) { |
69 | m_dead_observers.end(), | 73 | if (*d_it == *it) |
70 | std::bind1st(std::mem_fun(&Subject::detach), this)); | 74 | --it; // don't invalidate our iterator |
75 | detach(*d_it); | ||
76 | } | ||
71 | m_dead_observers.clear(); | 77 | m_dead_observers.clear(); |
72 | } | 78 | } |
73 | } | 79 | } |