aboutsummaryrefslogtreecommitdiff
path: root/src/SystemTray.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/SystemTray.cc')
-rw-r--r--src/SystemTray.cc43
1 files changed, 18 insertions, 25 deletions
diff --git a/src/SystemTray.cc b/src/SystemTray.cc
index 3a38bb1..14ee9ac 100644
--- a/src/SystemTray.cc
+++ b/src/SystemTray.cc
@@ -32,6 +32,7 @@
32#include "WinClient.hh" 32#include "WinClient.hh"
33#include "Screen.hh" 33#include "Screen.hh"
34#include "ButtonTheme.hh" 34#include "ButtonTheme.hh"
35#include "Debug.hh"
35 36
36#include <X11/Xutil.h> 37#include <X11/Xutil.h>
37#include <X11/Xatom.h> 38#include <X11/Xatom.h>
@@ -40,13 +41,10 @@
40 41
41using std::string; 42using std::string;
42 43
43#ifdef DEBUG 44
44#include <iostream>
45using std::cerr;
46using std::endl; 45using std::endl;
47using std::hex; 46using std::hex;
48using std::dec; 47using std::dec;
49#endif // DEBUG
50 48
51/// helper class for tray windows, so we dont call XDestroyWindow 49/// helper class for tray windows, so we dont call XDestroyWindow
52class TrayWindow: public FbTk::FbWindow { 50class TrayWindow: public FbTk::FbWindow {
@@ -86,9 +84,9 @@ public:
86 mapped = (bool)(static_cast<unsigned long>(prop[1]) & XEMBED_MAPPED); 84 mapped = (bool)(static_cast<unsigned long>(prop[1]) & XEMBED_MAPPED);
87 XFree(static_cast<void *>(prop)); 85 XFree(static_cast<void *>(prop));
88 86
89#ifdef DEBUG 87
90 cerr<<__FILE__<<"(SystemTray::TrayWindow::getMappedDefault(): XEMBED_MAPPED = "<<mapped<<endl; 88 fbdbg<<"(SystemTray::TrayWindow::getMappedDefault(): XEMBED_MAPPED = "<<mapped<<endl;
91#endif // DEBUG 89
92 90
93 } 91 }
94 return true; 92 return true;
@@ -187,16 +185,14 @@ SystemTray::SystemTray(const FbTk::FbWindow& parent,
187 Atom tray_atom = XInternAtom(disp, atom_name.c_str(), False); 185 Atom tray_atom = XInternAtom(disp, atom_name.c_str(), False);
188 Window owner = XGetSelectionOwner(disp, tray_atom); 186 Window owner = XGetSelectionOwner(disp, tray_atom);
189 if (owner != 0) { 187 if (owner != 0) {
190#ifdef DEBUG 188 fbdbg<<"(SystemTray(const FbTk::FbWindow)): can't set owner!"<<endl;
191 cerr<<__FILE__<<"(SystemTray(const FbTk::FbWindow)): can't set owner!"<<endl;
192#endif // DEBUG
193 return; // the're can't be more than one owner 189 return; // the're can't be more than one owner
194 } 190 }
195 191
196 // ok, it was free. Lets set owner 192 // ok, it was free. Lets set owner
197#ifdef DEBUG 193
198 cerr<<__FILE__<<"(SystemTray(const FbTk::FbWindow)): SETTING OWNER!"<<endl; 194 fbdbg<<"(SystemTray(const FbTk::FbWindow)): SETTING OWNER!"<<endl;
199#endif // DEBUG 195
200 // set owner 196 // set owner
201 XSetSelectionOwner(disp, tray_atom, m_selection_owner.window(), CurrentTime); 197 XSetSelectionOwner(disp, tray_atom, m_selection_owner.window(), CurrentTime);
202 198
@@ -311,17 +307,17 @@ bool SystemTray::clientMessage(const XClientMessageEvent &event) {
311 307
312 int type = event.data.l[1]; 308 int type = event.data.l[1];
313 if (type == SYSTEM_TRAY_REQUEST_DOCK) { 309 if (type == SYSTEM_TRAY_REQUEST_DOCK) {
314#ifdef DEBUG 310
315 cerr<<"SystemTray::clientMessage(const XClientMessageEvent): SYSTEM_TRAY_REQUEST_DOCK"<<endl; 311 fbdbg<<"SystemTray::clientMessage(const XClientMessageEvent): SYSTEM_TRAY_REQUEST_DOCK"<<endl;
316 cerr<<"window = event.data.l[2] = "<<event.data.l[2]<<endl; 312 fbdbg<<"window = event.data.l[2] = "<<event.data.l[2]<<endl;
317#endif // DEBUG 313
318 addClient(event.data.l[2], true); 314 addClient(event.data.l[2], true);
319 } 315 }
320 /* 316 /*
321 else if (type == SYSTEM_TRAY_BEGIN_MESSAGE) 317 else if (type == SYSTEM_TRAY_BEGIN_MESSAGE)
322 cerr<<"BEGIN MESSAGE"<<endl; 318 fbdbg<<"BEGIN MESSAGE"<<endl;
323 else if (type == SYSTEM_TRAY_CANCEL_MESSAGE) 319 else if (type == SYSTEM_TRAY_CANCEL_MESSAGE)
324 cerr<<"CANCEL MESSAGE"<<endl; 320 fbdbg<<"CANCEL MESSAGE"<<endl;
325 */ 321 */
326 322
327 return true; 323 return true;
@@ -362,9 +358,7 @@ void SystemTray::addClient(Window win, bool using_xembed) {
362 358
363 TrayWindow *traywin = new TrayWindow(win, using_xembed); 359 TrayWindow *traywin = new TrayWindow(win, using_xembed);
364 360
365#ifdef DEBUG 361 fbdbg<<"SystemTray::addClient(Window): 0x"<<hex<<win<<dec<<endl;
366 cerr<<"SystemTray::addClient(Window): 0x"<<hex<<win<<dec<<endl;
367#endif // DEBUG
368 362
369 m_clients.push_back(traywin); 363 m_clients.push_back(traywin);
370 FbTk::EventManager::instance()->add(*this, win); 364 FbTk::EventManager::instance()->add(*this, win);
@@ -400,9 +394,8 @@ void SystemTray::removeClient(Window win, bool destroyed) {
400 if (tray_it == m_clients.end()) 394 if (tray_it == m_clients.end())
401 return; 395 return;
402 396
403#ifdef DEBUG 397 fbdbg<<"(SystemTray::removeClient(Window)): 0x"<<hex<<win<<dec<<endl;
404 cerr<<__FILE__<<"(SystemTray::removeClient(Window)): 0x"<<hex<<win<<dec<<endl; 398
405#endif // DEBUG
406 TrayWindow *traywin = *tray_it; 399 TrayWindow *traywin = *tray_it;
407 m_clients.erase(tray_it); 400 m_clients.erase(tray_it);
408 if (!destroyed) { 401 if (!destroyed) {