all repos — fluxbox @ 3c06e9e93fd2057e26bb9df081d8b732916c49d5

custom fork of the fluxbox windowmanager

minor code cosmetics
Mathias Gumz akira@fluxbox.org
commit

3c06e9e93fd2057e26bb9df081d8b732916c49d5

parent

6346368b58e054174075f615a836ff3bd9c9f823

2 files changed, 27 insertions(+), 18 deletions(-)

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

@@ -38,39 +38,47 @@ #include <X11/Xatom.h>

#include <string> -using std::string; - +using std::string; using std::endl; using std::hex; using std::dec; + +namespace { + void getScreenCoordinates(Window win, int x, int y, int &screen_x, int &screen_y) { + XWindowAttributes attr; if (XGetWindowAttributes(FbTk::App::instance()->display(), win, &attr) == 0) { return; } - Window child_win; // not used - Window parent_win; // not used - Window root_win = 0; - Window* child_windows; // not used - unsigned int num_child_windows; // not used + Window unused_win; + Window parent_win; + Window root_win = 0; + Window* unused_childs = 0; + unsigned int unused_number; + XQueryTree(FbTk::App::instance()->display(), win, &root_win, &parent_win, - &child_windows, &num_child_windows); - if (child_windows != 0) { - XFree(child_windows); + &unused_childs, &unused_number); + + if (unused_childs != 0) { + XFree(unused_childs); } + XTranslateCoordinates(FbTk::App::instance()->display(), parent_win, root_win, x, y, - &screen_x, &screen_y, &child_win); + &screen_x, &screen_y, &unused_win); } +}; + /// helper class for tray windows, so we dont call XDestroyWindow -class TrayWindow: public FbTk::FbWindow { +class SystemTray::TrayWindow : public FbTk::FbWindow { public: TrayWindow(Window win, bool using_xembed):FbTk::FbWindow(win), m_visible(false), m_xembedded(using_xembed) { setEventMask(PropertyChangeMask);

@@ -183,7 +191,7 @@ m_theme(theme),

m_screen(screen), m_pixmap(0), m_num_visible_clients(0), m_selection_owner(m_window, 0, 0, 1, 1, SubstructureNotifyMask, false, false, CopyFromParent, InputOnly) { - + FbTk::EventManager::instance()->add(*this, m_window); FbTk::EventManager::instance()->add(*this, m_selection_owner); // setup signals
M src/SystemTray.hhsrc/SystemTray.hh

@@ -35,7 +35,6 @@ #include <memory>

class BScreen; class ButtonTheme; -class TrayWindow; class AtomHandler; namespace FbTk {

@@ -73,12 +72,13 @@

int numClients() const { return m_clients.size(); } const FbTk::FbWindow &window() const { return m_window; } - void renderTheme(int alpha) { + void renderTheme(int alpha) { m_window.setBorderWidth(m_theme->border().width()); m_window.setBorderColor(m_theme->border().color()); - m_window.setAlpha(alpha); - update(); + m_window.setAlpha(alpha); + update(); } + void updateSizing() { m_window.setBorderWidth(m_theme->border().width()); } void parentMoved() { m_window.parentMoved(); }

@@ -90,7 +90,8 @@

private: void update(); - typedef std::list<TrayWindow *> ClientList; + class TrayWindow; + typedef std::list<TrayWindow*> ClientList; ClientList::iterator findClient(Window win); void rearrangeClients();