diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/SystemTray.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/SystemTray.cc b/src/SystemTray.cc index 61eb95a..af34552 100644 --- a/src/SystemTray.cc +++ b/src/SystemTray.cc | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: SystemTray.cc,v 1.13 2004/08/31 23:18:29 fluxgen Exp $ | 22 | // $Id: SystemTray.cc,v 1.14 2004/09/01 00:05:52 fluxgen Exp $ |
23 | 23 | ||
24 | #include "SystemTray.hh" | 24 | #include "SystemTray.hh" |
25 | 25 | ||
@@ -121,8 +121,12 @@ SystemTray::SystemTray(const FbTk::FbWindow &parent): | |||
121 | // get selection owner and see if it's free | 121 | // get selection owner and see if it's free |
122 | Atom tray_atom = XInternAtom(disp, atom_name.c_str(), False); | 122 | Atom tray_atom = XInternAtom(disp, atom_name.c_str(), False); |
123 | Window owner = XGetSelectionOwner(disp, tray_atom); | 123 | Window owner = XGetSelectionOwner(disp, tray_atom); |
124 | if (owner != 0) | 124 | if (owner != 0) { |
125 | #ifdef DEBUG | ||
126 | cerr<<__FILE__<<"("<<__FUNCTION__<<"): can't set owner!"<<endl; | ||
127 | #endif // DEBUG | ||
125 | return; // the're can't be more than one owner | 128 | return; // the're can't be more than one owner |
129 | } | ||
126 | 130 | ||
127 | // ok, it was free. Lets set owner | 131 | // ok, it was free. Lets set owner |
128 | #ifdef DEBUG | 132 | #ifdef DEBUG |
@@ -264,6 +268,8 @@ void SystemTray::addClient(Window win) { | |||
264 | #ifdef DEBUG | 268 | #ifdef DEBUG |
265 | cerr<<"SystemTray::"<<__FUNCTION__<<": 0x"<<hex<<win<<dec<<endl; | 269 | cerr<<"SystemTray::"<<__FUNCTION__<<": 0x"<<hex<<win<<dec<<endl; |
266 | #endif // DEBUG | 270 | #endif // DEBUG |
271 | if (m_clients.empty()) | ||
272 | show(); | ||
267 | 273 | ||
268 | m_clients.push_back(traywin); | 274 | m_clients.push_back(traywin); |
269 | FbTk::EventManager::instance()->add(*this, win); | 275 | FbTk::EventManager::instance()->add(*this, win); |
@@ -272,12 +278,10 @@ void SystemTray::addClient(Window win) { | |||
272 | traywin->reparent(m_window, 0, 0); | 278 | traywin->reparent(m_window, 0, 0); |
273 | traywin->show(); | 279 | traywin->show(); |
274 | 280 | ||
275 | if (m_clients.empty()) | 281 | |
276 | show(); | ||
277 | #ifdef DEBUG | 282 | #ifdef DEBUG |
278 | cerr<<"number of clients = "<<m_clients.size()<<endl; | 283 | cerr<<"SystemTray: number of clients = "<<m_clients.size()<<endl; |
279 | #endif // DEBUG | 284 | #endif // DEBUG |
280 | |||
281 | rearrangeClients(); | 285 | rearrangeClients(); |
282 | } | 286 | } |
283 | 287 | ||
@@ -326,6 +330,8 @@ void SystemTray::handleEvent(XEvent &event) { | |||
326 | (*it)->moveResize((*it)->x(), (*it)->y(), | 330 | (*it)->moveResize((*it)->x(), (*it)->y(), |
327 | (*it)->width(), (*it)->height()); | 331 | (*it)->width(), (*it)->height()); |
328 | } | 332 | } |
333 | // so toolbar know that we changed size | ||
334 | resizeSig().notify(); | ||
329 | } | 335 | } |
330 | 336 | ||
331 | } | 337 | } |
@@ -344,7 +350,10 @@ void SystemTray::rearrangeClients() { | |||
344 | } | 350 | } |
345 | 351 | ||
346 | void SystemTray::removeAllClients() { | 352 | void SystemTray::removeAllClients() { |
353 | BScreen *screen = Fluxbox::instance()->findScreen(window().screenNumber()); | ||
347 | while (!m_clients.empty()) { | 354 | while (!m_clients.empty()) { |
355 | if (screen) | ||
356 | m_clients.back()->reparent(screen->rootWindow(), 0, 0); | ||
348 | m_clients.back()->hide(); | 357 | m_clients.back()->hide(); |
349 | delete m_clients.back(); | 358 | delete m_clients.back(); |
350 | m_clients.pop_back(); | 359 | m_clients.pop_back(); |