all repos — fluxbox @ 874eb67297cd63999730d1e779ff00581dcbb89d

custom fork of the fluxbox windowmanager

moved knowledge about '_NET_SYSTEM_TRAY_S' into the 'SystemTray' class
Mathias Gumz akira at fluxbox dot org
commit

874eb67297cd63999730d1e779ff00581dcbb89d

parent

a1385e4018189170eeeedcf56a9c84df707c32d8

3 files changed, 17 insertions(+), 13 deletions(-)

jump to
M src/Screen.ccsrc/Screen.cc

@@ -54,6 +54,7 @@ #include "FbTk/CommandParser.hh"

#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::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<num> - 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())
M src/SystemTray.ccsrc/SystemTray.cc

@@ -177,11 +177,8 @@

Fluxbox* fluxbox = Fluxbox::instance(); Display *disp = fluxbox->display(); - // setup atom name to _NET_SYSTEM_TRAY_S<screen number> - 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 @@ // remove us, else fluxbox might delete the memory too

Fluxbox* fluxbox = Fluxbox::instance(); fluxbox->removeAtomHandler(m_handler.get()); Display *disp = fluxbox->display(); - // setup atom name to _NET_SYSTEM_TRAY_S<screen number> - 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 @@

} 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; }
M src/SystemTray.hhsrc/SystemTray.hh

@@ -84,6 +84,8 @@ void updateSizing() { m_window.setBorderWidth(m_theme->border().width()); }

void parentMoved() { m_window.parentMoved(); } + static std::string getNetSystemTrayAtom(int screen_nr); + static Atom getXEmbedInfoAtom(); private: