aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2010-08-23 17:49:47 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2010-08-23 17:49:47 (GMT)
commit874eb67297cd63999730d1e779ff00581dcbb89d (patch)
tree9d40f37066092672433161f494acaa455546867d /src
parenta1385e4018189170eeeedcf56a9c84df707c32d8 (diff)
downloadfluxbox_pavel-874eb67297cd63999730d1e779ff00581dcbb89d.zip
fluxbox_pavel-874eb67297cd63999730d1e779ff00581dcbb89d.tar.bz2
moved knowledge about '_NET_SYSTEM_TRAY_S' into the 'SystemTray' class
Diffstat (limited to 'src')
-rw-r--r--src/Screen.cc7
-rw-r--r--src/SystemTray.cc21
-rw-r--r--src/SystemTray.hh2
3 files changed, 17 insertions, 13 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index eab0f59..db302fe 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -54,6 +54,7 @@
54#include "AtomHandler.hh" 54#include "AtomHandler.hh"
55#include "HeadArea.hh" 55#include "HeadArea.hh"
56#include "FbCommands.hh" 56#include "FbCommands.hh"
57#include "SystemTray.hh"
57#include "Debug.hh" 58#include "Debug.hh"
58 59
59#include "FbTk/I18n.hh" 60#include "FbTk/I18n.hh"
@@ -1234,12 +1235,10 @@ bool BScreen::isKdeDockapp(Window client) const {
1234bool BScreen::addKdeDockapp(Window client) { 1235bool BScreen::addKdeDockapp(Window client) {
1235 1236
1236 XSelectInput(FbTk::App::instance()->display(), client, StructureNotifyMask); 1237 XSelectInput(FbTk::App::instance()->display(), client, StructureNotifyMask);
1237 string atom_name("_NET_SYSTEM_TRAY_S");
1238 atom_name += FbTk::StringUtil::number2String(screenNumber());
1239 // find the right atomhandler that has the name: _NET_SYSTEM_TRAY_S<num>
1240 AtomHandler *handler = Fluxbox::instance()->getAtomHandler(atom_name);
1241 FbTk::EventHandler *evh = 0; 1238 FbTk::EventHandler *evh = 0;
1242 FbTk::EventManager *evm = FbTk::EventManager::instance(); 1239 FbTk::EventManager *evm = FbTk::EventManager::instance();
1240
1241 AtomHandler *handler = Fluxbox::instance()->getAtomHandler(SystemTray::getNetSystemTrayAtom(screenNumber()));
1243 if (handler == 0) { 1242 if (handler == 0) {
1244#ifdef SLIT 1243#ifdef SLIT
1245 if (slit() != 0 && slit()->acceptKdeDockapp()) 1244 if (slit() != 0 && slit()->acceptKdeDockapp())
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}
diff --git a/src/SystemTray.hh b/src/SystemTray.hh
index c67e08a..153220c 100644
--- a/src/SystemTray.hh
+++ b/src/SystemTray.hh
@@ -84,6 +84,8 @@ public:
84 84
85 void parentMoved() { m_window.parentMoved(); } 85 void parentMoved() { m_window.parentMoved(); }
86 86
87 static std::string getNetSystemTrayAtom(int screen_nr);
88
87 static Atom getXEmbedInfoAtom(); 89 static Atom getXEmbedInfoAtom();
88 90
89private: 91private: