summaryrefslogtreecommitdiff
path: root/src/SystemTray.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/SystemTray.cc')
-rw-r--r--src/SystemTray.cc40
1 files changed, 29 insertions, 11 deletions
diff --git a/src/SystemTray.cc b/src/SystemTray.cc
index 5e28681..c1a4f53 100644
--- a/src/SystemTray.cc
+++ b/src/SystemTray.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: SystemTray.cc,v 1.10 2004/05/04 14:33:37 rathnor Exp $ 22// $Id: SystemTray.cc,v 1.11 2004/06/20 10:29:51 rathnor Exp $
23 23
24#include "SystemTray.hh" 24#include "SystemTray.hh"
25 25
@@ -63,6 +63,9 @@ public:
63 // if not kde dockapp... 63 // if not kde dockapp...
64 if (!winclient.screen().isKdeDockapp(winclient.window())) 64 if (!winclient.screen().isKdeDockapp(winclient.window()))
65 return; 65 return;
66 // if not our screen...
67 if (winclient.screenNumber() != m_tray.window().screenNumber())
68 return;
66 winclient.setEventMask(StructureNotifyMask | 69 winclient.setEventMask(StructureNotifyMask |
67 SubstructureNotifyMask | EnterWindowMask); 70 SubstructureNotifyMask | EnterWindowMask);
68 m_tray.addClient(winclient.window()); 71 m_tray.addClient(winclient.window());
@@ -96,6 +99,9 @@ SystemTray::SystemTray(const FbTk::FbWindow &parent):
96 99
97 FbTk::EventManager::instance()->add(*this, m_window); 100 FbTk::EventManager::instance()->add(*this, m_window);
98 101
102 // just try to blend in... (better than defaulting to white)
103 m_window.setBackgroundPixmap(ParentRelative);
104
99 // setup atom name to _NET_SYSTEM_TRAY_S<screen number> 105 // setup atom name to _NET_SYSTEM_TRAY_S<screen number>
100 char intbuff[16]; 106 char intbuff[16];
101 sprintf(intbuff, "%d", m_window.screenNumber()); 107 sprintf(intbuff, "%d", m_window.screenNumber());
@@ -151,15 +157,26 @@ void SystemTray::move(int x, int y) {
151void SystemTray::resize(unsigned int width, unsigned int height) { 157void SystemTray::resize(unsigned int width, unsigned int height) {
152 if (width != m_window.width() || 158 if (width != m_window.width() ||
153 height != m_window.height()) { 159 height != m_window.height()) {
154 m_window.resize(SystemTray::width(), height); 160 m_window.resize(width, height);
155 rearrangeClients(); 161 if (!m_clients.empty()) {
162 rearrangeClients();
163 resizeSig().notify();
164 }
156 } 165 }
157} 166}
158 167
159void SystemTray::moveResize(int x, int y, 168void SystemTray::moveResize(int x, int y,
160 unsigned int width, unsigned int height) { 169 unsigned int width, unsigned int height) {
161 move(x, y); 170 if (width != m_window.width() ||
162 resize(width, height); 171 height != m_window.height()) {
172 m_window.moveResize(x, y, width, height);
173 if (!m_clients.empty()) {
174 rearrangeClients();
175 resizeSig().notify();
176 }
177 } else {
178 move(x, y);
179 }
163} 180}
164 181
165void SystemTray::hide() { 182void SystemTray::hide() {
@@ -241,8 +258,6 @@ void SystemTray::addClient(Window win) {
241 traywin->reparent(m_window, 0, 0); 258 traywin->reparent(m_window, 0, 0);
242 traywin->show(); 259 traywin->show();
243 260
244 resize(width(), m_clients.size()*height());
245
246 rearrangeClients(); 261 rearrangeClients();
247} 262}
248 263
@@ -260,9 +275,8 @@ void SystemTray::removeClient(Window win) {
260 resize(width(), height()); 275 resize(width(), height());
261 rearrangeClients(); 276 rearrangeClients();
262 if (m_clients.empty()) { 277 if (m_clients.empty()) {
263 // so we send configurenotify signal to parent 278 // so we send notify signal to parent
264 m_window.resize(1, 1); 279 resizeSig().notify();
265 hide();
266 } 280 }
267} 281}
268 282
@@ -281,11 +295,13 @@ void SystemTray::handleEvent(XEvent &event) {
281 } else if (event.type == ConfigureNotify) { 295 } else if (event.type == ConfigureNotify) {
282 // we got configurenotify from an client 296 // we got configurenotify from an client
283 // check and see if we need to update it's size 297 // check and see if we need to update it's size
298 // we don't let them be their size, we enforce ours (mwahaha)
284 ClientList::iterator it = findClient(event.xconfigure.window); 299 ClientList::iterator it = findClient(event.xconfigure.window);
285 if (it != m_clients.end()) { 300 if (it != m_clients.end()) {
286 if (static_cast<unsigned int>(event.xconfigure.width) != (*it)->width() || 301 if (static_cast<unsigned int>(event.xconfigure.width) != (*it)->width() ||
287 static_cast<unsigned int>(event.xconfigure.height) != (*it)->height()) 302 static_cast<unsigned int>(event.xconfigure.height) != (*it)->height()) {
288 (*it)->resize((*it)->width(), (*it)->height()); 303 (*it)->resize((*it)->width(), (*it)->height());
304 }
289 } 305 }
290 } 306 }
291} 307}
@@ -302,6 +318,8 @@ void SystemTray::rearrangeClients() {
302 cerr<<__FILE__<<"("<<__FUNCTION__<<"): "<<(*client_it)->width()<<", "<<(*client_it)->height()<<endl; 318 cerr<<__FILE__<<"("<<__FUNCTION__<<"): "<<(*client_it)->width()<<", "<<(*client_it)->height()<<endl;
303#endif // DEBUG 319#endif // DEBUG
304 } 320 }
321
322 resize(next_x, height());
305} 323}
306 324
307void SystemTray::removeAllClients() { 325void SystemTray::removeAllClients() {