aboutsummaryrefslogtreecommitdiff
path: root/src/SystemTray.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-08-28 13:44:58 (GMT)
committerfluxgen <fluxgen>2003-08-28 13:44:58 (GMT)
commitf1e492da01498d6c0d84e81b166f1c3b86b142e7 (patch)
tree11150b87e01a8e91fe5e7ce03f25bc6b78a31934 /src/SystemTray.cc
parent118d9ad1589fecd41b373e651c4150bac2054038 (diff)
downloadfluxbox-f1e492da01498d6c0d84e81b166f1c3b86b142e7.zip
fluxbox-f1e492da01498d6c0d84e81b166f1c3b86b142e7.tar.bz2
fixed resize after client death
Diffstat (limited to 'src/SystemTray.cc')
-rw-r--r--src/SystemTray.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/SystemTray.cc b/src/SystemTray.cc
index e282a76..76bac85 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.3 2003/08/27 00:11:24 fluxgen Exp $ 22// $Id: SystemTray.cc,v 1.4 2003/08/28 13:44:58 fluxgen Exp $
23 23
24#include "SystemTray.hh" 24#include "SystemTray.hh"
25 25
@@ -30,7 +30,6 @@
30 30
31#include <X11/Xutil.h> 31#include <X11/Xutil.h>
32 32
33#include <iostream>
34#include <string> 33#include <string>
35 34
36using namespace std; 35using namespace std;
@@ -155,7 +154,7 @@ void SystemTray::show() {
155} 154}
156 155
157unsigned int SystemTray::width() const { 156unsigned int SystemTray::width() const {
158 return m_clients.size()*height(); //*m_tray_width; 157 return m_clients.size()*height();
159} 158}
160 159
161unsigned int SystemTray::height() const { 160unsigned int SystemTray::height() const {
@@ -214,16 +213,19 @@ void SystemTray::addClient(Window win) {
214#ifdef DEBUG 213#ifdef DEBUG
215 cerr<<__FILE__<<"("<<__FUNCTION__<<"): 0x"<<hex<<win<<dec<<endl; 214 cerr<<__FILE__<<"("<<__FUNCTION__<<"): 0x"<<hex<<win<<dec<<endl;
216#endif // DEBUG 215#endif // DEBUG
216 if (m_clients.size() == 0)
217 show();
217 218
218 FbTk::FbWindow *traywin = new TrayWindow(win); 219 FbTk::FbWindow *traywin = new TrayWindow(win);
219 m_clients.push_back(traywin); 220 m_clients.push_back(traywin);
220 FbTk::EventManager::instance()->add(*this, win); 221 FbTk::EventManager::instance()->add(*this, win);
222 FbTk::EventManager::instance()->addParent(*this, window());
221 XChangeSaveSet(FbTk::App::instance()->display(), win, SetModeInsert); 223 XChangeSaveSet(FbTk::App::instance()->display(), win, SetModeInsert);
222 traywin->reparent(m_window, 0, 0); 224 traywin->reparent(m_window, 0, 0);
223 traywin->show(); 225 traywin->show();
224 226
225 resize(width(), m_clients.size()*height()); 227 resize(width(), m_clients.size()*height());
226 228
227 rearrangeClients(); 229 rearrangeClients();
228} 230}
229 231
@@ -235,12 +237,16 @@ void SystemTray::removeClient(Window win) {
235#ifdef DEBUG 237#ifdef DEBUG
236 cerr<<__FILE__<<"("<<__FUNCTION__<<"): 0x"<<hex<<win<<dec<<endl; 238 cerr<<__FILE__<<"("<<__FUNCTION__<<"): 0x"<<hex<<win<<dec<<endl;
237#endif // DEBUG 239#endif // DEBUG
238
239 FbTk::FbWindow *traywin = *tray_it; 240 FbTk::FbWindow *traywin = *tray_it;
240 m_clients.erase(tray_it); 241 m_clients.erase(tray_it);
241 delete traywin; 242 delete traywin;
242 resize(width(), height()); 243 resize(width(), height());
243 rearrangeClients(); 244 rearrangeClients();
245 if (m_clients.size() == 0) {
246 // so we send configurenotify signal to parent
247 m_window.resize(1, 1);
248 hide();
249 }
244} 250}
245 251
246void SystemTray::exposeEvent(XExposeEvent &event) { 252void SystemTray::exposeEvent(XExposeEvent &event) {
@@ -248,9 +254,9 @@ void SystemTray::exposeEvent(XExposeEvent &event) {
248} 254}
249 255
250void SystemTray::handleEvent(XEvent &event) { 256void SystemTray::handleEvent(XEvent &event) {
251 if (event.type == DestroyNotify) 257 if (event.type == DestroyNotify) {
252 removeClient(event.xdestroywindow.window); 258 removeClient(event.xdestroywindow.window);
253 else if (event.type == ConfigureNotify) { 259 } else if (event.type == ConfigureNotify) {
254 // we got configurenotify from an client 260 // we got configurenotify from an client
255 // check and see if we need to update it's size 261 // check and see if we need to update it's size
256 ClientList::iterator it = findClient(event.xconfigure.window); 262 ClientList::iterator it = findClient(event.xconfigure.window);