From 874eb67297cd63999730d1e779ff00581dcbb89d Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Mon, 23 Aug 2010 19:49:47 +0200 Subject: moved knowledge about '_NET_SYSTEM_TRAY_S' into the 'SystemTray' class --- src/Screen.cc | 7 +++---- src/SystemTray.cc | 21 ++++++++++++--------- src/SystemTray.hh | 2 ++ 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 @@ #include "AtomHandler.hh" #include "HeadArea.hh" #include "FbCommands.hh" +#include "SystemTray.hh" #include "Debug.hh" #include "FbTk/I18n.hh" @@ -1234,12 +1235,10 @@ bool BScreen::isKdeDockapp(Window client) const { bool BScreen::addKdeDockapp(Window client) { XSelectInput(FbTk::App::instance()->display(), client, StructureNotifyMask); - string atom_name("_NET_SYSTEM_TRAY_S"); - atom_name += FbTk::StringUtil::number2String(screenNumber()); - // find the right atomhandler that has the name: _NET_SYSTEM_TRAY_S - AtomHandler *handler = Fluxbox::instance()->getAtomHandler(atom_name); FbTk::EventHandler *evh = 0; FbTk::EventManager *evm = FbTk::EventManager::instance(); + + AtomHandler *handler = Fluxbox::instance()->getAtomHandler(SystemTray::getNetSystemTrayAtom(screenNumber())); if (handler == 0) { #ifdef SLIT 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, Fluxbox* fluxbox = Fluxbox::instance(); Display *disp = fluxbox->display(); - // setup atom name to _NET_SYSTEM_TRAY_S - string atom_name("_NET_SYSTEM_TRAY_S"); - atom_name += FbTk::StringUtil::number2String(m_window.screenNumber()); - // get selection owner and see if it's free + string atom_name = getNetSystemTrayAtom(m_window.screenNumber()); Atom tray_atom = XInternAtom(disp, atom_name.c_str(), False); Window owner = XGetSelectionOwner(disp, tray_atom); if (owner != 0) { @@ -225,11 +222,9 @@ SystemTray::~SystemTray() { Fluxbox* fluxbox = Fluxbox::instance(); fluxbox->removeAtomHandler(m_handler.get()); Display *disp = fluxbox->display(); - // setup atom name to _NET_SYSTEM_TRAY_S - string atom_name("_NET_SYSTEM_TRAY_S"); - atom_name += FbTk::StringUtil::number2String(m_window.screenNumber()); // get selection owner and see if it's free + string atom_name = getNetSystemTrayAtom(m_window.screenNumber()); Atom tray_atom = XInternAtom(disp, atom_name.c_str(), False); // Properly give up selection. @@ -553,6 +548,14 @@ void SystemTray::update() { } Atom SystemTray::getXEmbedInfoAtom() { -static Atom theatom = XInternAtom(Fluxbox::instance()->display(), "_XEMBED_INFO", False); -return theatom; + static Atom theatom = XInternAtom(Fluxbox::instance()->display(), "_XEMBED_INFO", False); + return theatom; +} + +string SystemTray::getNetSystemTrayAtom(int screen_nr) { + + string atom_name("_NET_SYSTEM_TRAY_S"); + atom_name += FbTk::StringUtil::number2String(screen_nr); + + return atom_name; } 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: void parentMoved() { m_window.parentMoved(); } + static std::string getNetSystemTrayAtom(int screen_nr); + static Atom getXEmbedInfoAtom(); private: -- cgit v0.11.2