aboutsummaryrefslogtreecommitdiff
path: root/src/SystemTray.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/SystemTray.cc')
-rw-r--r--src/SystemTray.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/SystemTray.cc b/src/SystemTray.cc
index 14ee9ac..73d8c0d 100644
--- a/src/SystemTray.cc
+++ b/src/SystemTray.cc
@@ -177,11 +177,8 @@ SystemTray::SystemTray(const FbTk::FbWindow& parent,
177 Fluxbox* fluxbox = Fluxbox::instance(); 177 Fluxbox* fluxbox = Fluxbox::instance();
178 Display *disp = fluxbox->display(); 178 Display *disp = fluxbox->display();
179 179
180 // setup atom name to _NET_SYSTEM_TRAY_S<screen number>
181 string atom_name("_NET_SYSTEM_TRAY_S");
182 atom_name += FbTk::StringUtil::number2String(m_window.screenNumber());
183
184 // get selection owner and see if it's free 180 // get selection owner and see if it's free
181 string atom_name = getNetSystemTrayAtom(m_window.screenNumber());
185 Atom tray_atom = XInternAtom(disp, atom_name.c_str(), False); 182 Atom tray_atom = XInternAtom(disp, atom_name.c_str(), False);
186 Window owner = XGetSelectionOwner(disp, tray_atom); 183 Window owner = XGetSelectionOwner(disp, tray_atom);
187 if (owner != 0) { 184 if (owner != 0) {
@@ -225,11 +222,9 @@ SystemTray::~SystemTray() {
225 Fluxbox* fluxbox = Fluxbox::instance(); 222 Fluxbox* fluxbox = Fluxbox::instance();
226 fluxbox->removeAtomHandler(m_handler.get()); 223 fluxbox->removeAtomHandler(m_handler.get());
227 Display *disp = fluxbox->display(); 224 Display *disp = fluxbox->display();
228 // setup atom name to _NET_SYSTEM_TRAY_S<screen number>
229 string atom_name("_NET_SYSTEM_TRAY_S");
230 atom_name += FbTk::StringUtil::number2String(m_window.screenNumber());
231 225
232 // get selection owner and see if it's free 226 // get selection owner and see if it's free
227 string atom_name = getNetSystemTrayAtom(m_window.screenNumber());
233 Atom tray_atom = XInternAtom(disp, atom_name.c_str(), False); 228 Atom tray_atom = XInternAtom(disp, atom_name.c_str(), False);
234 229
235 // Properly give up selection. 230 // Properly give up selection.
@@ -553,6 +548,14 @@ void SystemTray::update() {
553} 548}
554 549
555Atom SystemTray::getXEmbedInfoAtom() { 550Atom SystemTray::getXEmbedInfoAtom() {
556static Atom theatom = XInternAtom(Fluxbox::instance()->display(), "_XEMBED_INFO", False); 551 static Atom theatom = XInternAtom(Fluxbox::instance()->display(), "_XEMBED_INFO", False);
557return theatom; 552 return theatom;
553}
554
555string SystemTray::getNetSystemTrayAtom(int screen_nr) {
556
557 string atom_name("_NET_SYSTEM_TRAY_S");
558 atom_name += FbTk::StringUtil::number2String(screen_nr);
559
560 return atom_name;
558} 561}