diff options
author | Henrik Kinnunen <fluxgen@fluxbox.org> | 2008-04-27 19:22:18 (GMT) |
---|---|---|
committer | Henrik Kinnunen <fluxgen@fluxbox.org> | 2008-04-27 19:22:18 (GMT) |
commit | 80b10f7772b91f1f4a61eace4e5235a79060e1f0 (patch) | |
tree | 27057e59c41188e7c2f724614233265fed03c9b3 /src/SystemTray.cc | |
parent | 40e17b4d0ef1b9503f21509e697dd4dcb24d2bbf (diff) | |
download | fluxbox_pavel-80b10f7772b91f1f4a61eace4e5235a79060e1f0.zip fluxbox_pavel-80b10f7772b91f1f4a61eace4e5235a79060e1f0.tar.bz2 |
Added SimpleObserver class.
This class works in the same way as the SimpleCommand class.
Use it with the makeObserver function.
It calls the receiver's member function when the subject sends
a signal.
Diffstat (limited to 'src/SystemTray.cc')
-rw-r--r-- | src/SystemTray.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/SystemTray.cc b/src/SystemTray.cc index 4275099..699ca47 100644 --- a/src/SystemTray.cc +++ b/src/SystemTray.cc | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "WinClient.hh" | 30 | #include "WinClient.hh" |
31 | #include "Screen.hh" | 31 | #include "Screen.hh" |
32 | #include "ButtonTheme.hh" | 32 | #include "ButtonTheme.hh" |
33 | #include "SimpleObserver.hh" | ||
33 | 34 | ||
34 | #include <X11/Xutil.h> | 35 | #include <X11/Xutil.h> |
35 | #include <X11/Xatom.h> | 36 | #include <X11/Xatom.h> |
@@ -166,8 +167,10 @@ SystemTray::SystemTray(const FbTk::FbWindow& parent, | |||
166 | 167 | ||
167 | FbTk::EventManager::instance()->add(*this, m_window); | 168 | FbTk::EventManager::instance()->add(*this, m_window); |
168 | FbTk::EventManager::instance()->add(*this, m_selection_owner); | 169 | FbTk::EventManager::instance()->add(*this, m_selection_owner); |
169 | m_theme->reconfigSig().attach(this); | 170 | // setup signals |
170 | screen.bgChangeSig().attach(this); | 171 | m_observer.reset(makeObserver(*this, &SystemTray::update)); |
172 | m_theme->reconfigSig().attach(m_observer.get()); | ||
173 | screen.bgChangeSig().attach(m_observer.get()); | ||
171 | 174 | ||
172 | Fluxbox* fluxbox = Fluxbox::instance(); | 175 | Fluxbox* fluxbox = Fluxbox::instance(); |
173 | Display *disp = fluxbox->display(); | 176 | Display *disp = fluxbox->display(); |
@@ -216,7 +219,7 @@ SystemTray::SystemTray(const FbTk::FbWindow& parent, | |||
216 | 219 | ||
217 | XSendEvent(disp, root_window, false, StructureNotifyMask, &ce); | 220 | XSendEvent(disp, root_window, false, StructureNotifyMask, &ce); |
218 | 221 | ||
219 | update(0); | 222 | update(); |
220 | } | 223 | } |
221 | 224 | ||
222 | SystemTray::~SystemTray() { | 225 | SystemTray::~SystemTray() { |
@@ -276,7 +279,7 @@ void SystemTray::hide() { | |||
276 | 279 | ||
277 | void SystemTray::show() { | 280 | void SystemTray::show() { |
278 | 281 | ||
279 | update(0); | 282 | update(); |
280 | m_window.show(); | 283 | m_window.show(); |
281 | } | 284 | } |
282 | 285 | ||
@@ -470,7 +473,7 @@ void SystemTray::rearrangeClients() { | |||
470 | unsigned int trayw = m_num_visible_clients*h_rot0 + bw, trayh = h_rot0; | 473 | unsigned int trayw = m_num_visible_clients*h_rot0 + bw, trayh = h_rot0; |
471 | FbTk::translateSize(orientation(), trayw, trayh); | 474 | FbTk::translateSize(orientation(), trayw, trayh); |
472 | resize(trayw, trayh); | 475 | resize(trayw, trayh); |
473 | update(0); | 476 | update(); |
474 | 477 | ||
475 | // move and resize clients | 478 | // move and resize clients |
476 | ClientList::iterator client_it = m_clients.begin(); | 479 | ClientList::iterator client_it = m_clients.begin(); |
@@ -529,7 +532,7 @@ void SystemTray::showClient(TrayWindow *traywin) { | |||
529 | rearrangeClients(); | 532 | rearrangeClients(); |
530 | } | 533 | } |
531 | 534 | ||
532 | void SystemTray::update(FbTk::Subject* subject) { | 535 | void SystemTray::update() { |
533 | 536 | ||
534 | if (!m_theme->texture().usePixmap()) { | 537 | if (!m_theme->texture().usePixmap()) { |
535 | m_window.setBackgroundColor(m_theme->texture().color()); | 538 | m_window.setBackgroundColor(m_theme->texture().color()); |