aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/SystemTray.cc34
-rw-r--r--src/SystemTray.hh11
2 files changed, 27 insertions, 18 deletions
diff --git a/src/SystemTray.cc b/src/SystemTray.cc
index c908f3e..e45669e 100644
--- a/src/SystemTray.cc
+++ b/src/SystemTray.cc
@@ -38,39 +38,47 @@
38 38
39#include <string> 39#include <string>
40 40
41using std::string;
42
43 41
42using std::string;
44using std::endl; 43using std::endl;
45using std::hex; 44using std::hex;
46using std::dec; 45using std::dec;
47 46
47
48namespace {
49
48void getScreenCoordinates(Window win, int x, int y, int &screen_x, int &screen_y) { 50void getScreenCoordinates(Window win, int x, int y, int &screen_x, int &screen_y) {
51
49 XWindowAttributes attr; 52 XWindowAttributes attr;
50 if (XGetWindowAttributes(FbTk::App::instance()->display(), win, &attr) == 0) { 53 if (XGetWindowAttributes(FbTk::App::instance()->display(), win, &attr) == 0) {
51 return; 54 return;
52 } 55 }
53 56
54 Window child_win; // not used 57 Window unused_win;
55 Window parent_win; // not used 58 Window parent_win;
56 Window root_win = 0; 59 Window root_win = 0;
57 Window* child_windows; // not used 60 Window* unused_childs = 0;
58 unsigned int num_child_windows; // not used 61 unsigned int unused_number;
62
59 XQueryTree(FbTk::App::instance()->display(), win, 63 XQueryTree(FbTk::App::instance()->display(), win,
60 &root_win, 64 &root_win,
61 &parent_win, 65 &parent_win,
62 &child_windows, &num_child_windows); 66 &unused_childs, &unused_number);
63 if (child_windows != 0) { 67
64 XFree(child_windows); 68 if (unused_childs != 0) {
69 XFree(unused_childs);
65 } 70 }
71
66 XTranslateCoordinates(FbTk::App::instance()->display(), 72 XTranslateCoordinates(FbTk::App::instance()->display(),
67 parent_win, root_win, 73 parent_win, root_win,
68 x, y, 74 x, y,
69 &screen_x, &screen_y, &child_win); 75 &screen_x, &screen_y, &unused_win);
70} 76}
71 77
78};
79
72/// helper class for tray windows, so we dont call XDestroyWindow 80/// helper class for tray windows, so we dont call XDestroyWindow
73class TrayWindow: public FbTk::FbWindow { 81class SystemTray::TrayWindow : public FbTk::FbWindow {
74public: 82public:
75 TrayWindow(Window win, bool using_xembed):FbTk::FbWindow(win), m_visible(false), m_xembedded(using_xembed) { 83 TrayWindow(Window win, bool using_xembed):FbTk::FbWindow(win), m_visible(false), m_xembedded(using_xembed) {
76 setEventMask(PropertyChangeMask); 84 setEventMask(PropertyChangeMask);
@@ -183,7 +191,7 @@ SystemTray::SystemTray(const FbTk::FbWindow& parent,
183 m_screen(screen), 191 m_screen(screen),
184 m_pixmap(0), m_num_visible_clients(0), 192 m_pixmap(0), m_num_visible_clients(0),
185 m_selection_owner(m_window, 0, 0, 1, 1, SubstructureNotifyMask, false, false, CopyFromParent, InputOnly) { 193 m_selection_owner(m_window, 0, 0, 1, 1, SubstructureNotifyMask, false, false, CopyFromParent, InputOnly) {
186 194
187 FbTk::EventManager::instance()->add(*this, m_window); 195 FbTk::EventManager::instance()->add(*this, m_window);
188 FbTk::EventManager::instance()->add(*this, m_selection_owner); 196 FbTk::EventManager::instance()->add(*this, m_selection_owner);
189 // setup signals 197 // setup signals
diff --git a/src/SystemTray.hh b/src/SystemTray.hh
index d92e437..61cd1bb 100644
--- a/src/SystemTray.hh
+++ b/src/SystemTray.hh
@@ -35,7 +35,6 @@
35 35
36class BScreen; 36class BScreen;
37class ButtonTheme; 37class ButtonTheme;
38class TrayWindow;
39class AtomHandler; 38class AtomHandler;
40 39
41namespace FbTk { 40namespace FbTk {
@@ -73,12 +72,13 @@ public:
73 int numClients() const { return m_clients.size(); } 72 int numClients() const { return m_clients.size(); }
74 const FbTk::FbWindow &window() const { return m_window; } 73 const FbTk::FbWindow &window() const { return m_window; }
75 74
76 void renderTheme(int alpha) { 75 void renderTheme(int alpha) {
77 m_window.setBorderWidth(m_theme->border().width()); 76 m_window.setBorderWidth(m_theme->border().width());
78 m_window.setBorderColor(m_theme->border().color()); 77 m_window.setBorderColor(m_theme->border().color());
79 m_window.setAlpha(alpha); 78 m_window.setAlpha(alpha);
80 update(); 79 update();
81 } 80 }
81
82 void updateSizing() { m_window.setBorderWidth(m_theme->border().width()); } 82 void updateSizing() { m_window.setBorderWidth(m_theme->border().width()); }
83 83
84 void parentMoved() { m_window.parentMoved(); } 84 void parentMoved() { m_window.parentMoved(); }
@@ -90,7 +90,8 @@ public:
90private: 90private:
91 void update(); 91 void update();
92 92
93 typedef std::list<TrayWindow *> ClientList; 93 class TrayWindow;
94 typedef std::list<TrayWindow*> ClientList;
94 ClientList::iterator findClient(Window win); 95 ClientList::iterator findClient(Window win);
95 96
96 void rearrangeClients(); 97 void rearrangeClients();