moved knowledge about '_NET_SYSTEM_TRAY_S' into the 'SystemTray' class

This commit is contained in:
Mathias Gumz 2010-08-23 19:49:47 +02:00
parent a1385e4018
commit 874eb67297
3 changed files with 17 additions and 13 deletions

View file

@ -54,6 +54,7 @@
#include "AtomHandler.hh" #include "AtomHandler.hh"
#include "HeadArea.hh" #include "HeadArea.hh"
#include "FbCommands.hh" #include "FbCommands.hh"
#include "SystemTray.hh"
#include "Debug.hh" #include "Debug.hh"
#include "FbTk/I18n.hh" #include "FbTk/I18n.hh"
@ -1234,12 +1235,10 @@ bool BScreen::isKdeDockapp(Window client) const {
bool BScreen::addKdeDockapp(Window client) { bool BScreen::addKdeDockapp(Window client) {
XSelectInput(FbTk::App::instance()->display(), client, StructureNotifyMask); 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::EventHandler *evh = 0;
FbTk::EventManager *evm = FbTk::EventManager::instance(); FbTk::EventManager *evm = FbTk::EventManager::instance();
AtomHandler *handler = Fluxbox::instance()->getAtomHandler(SystemTray::getNetSystemTrayAtom(screenNumber()));
if (handler == 0) { if (handler == 0) {
#ifdef SLIT #ifdef SLIT
if (slit() != 0 && slit()->acceptKdeDockapp()) if (slit() != 0 && slit()->acceptKdeDockapp())

View file

@ -177,11 +177,8 @@ SystemTray::SystemTray(const FbTk::FbWindow& parent,
Fluxbox* fluxbox = Fluxbox::instance(); Fluxbox* fluxbox = Fluxbox::instance();
Display *disp = fluxbox->display(); 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 // 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); Atom tray_atom = XInternAtom(disp, atom_name.c_str(), False);
Window owner = XGetSelectionOwner(disp, tray_atom); Window owner = XGetSelectionOwner(disp, tray_atom);
if (owner != 0) { if (owner != 0) {
@ -225,11 +222,9 @@ SystemTray::~SystemTray() {
Fluxbox* fluxbox = Fluxbox::instance(); Fluxbox* fluxbox = Fluxbox::instance();
fluxbox->removeAtomHandler(m_handler.get()); fluxbox->removeAtomHandler(m_handler.get());
Display *disp = fluxbox->display(); 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 // 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); Atom tray_atom = XInternAtom(disp, atom_name.c_str(), False);
// Properly give up selection. // Properly give up selection.
@ -553,6 +548,14 @@ void SystemTray::update() {
} }
Atom SystemTray::getXEmbedInfoAtom() { Atom SystemTray::getXEmbedInfoAtom() {
static Atom theatom = XInternAtom(Fluxbox::instance()->display(), "_XEMBED_INFO", False); static Atom theatom = XInternAtom(Fluxbox::instance()->display(), "_XEMBED_INFO", False);
return theatom; 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;
} }

View file

@ -84,6 +84,8 @@ public:
void parentMoved() { m_window.parentMoved(); } void parentMoved() { m_window.parentMoved(); }
static std::string getNetSystemTrayAtom(int screen_nr);
static Atom getXEmbedInfoAtom(); static Atom getXEmbedInfoAtom();
private: private: