aboutsummaryrefslogtreecommitdiff
path: root/src/SystemTray.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/SystemTray.cc')
-rw-r--r--src/SystemTray.cc34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/SystemTray.cc b/src/SystemTray.cc
index 84f98c6..1cab673 100644
--- a/src/SystemTray.cc
+++ b/src/SystemTray.cc
@@ -213,11 +213,17 @@ void SystemTray::show() {
213} 213}
214 214
215unsigned int SystemTray::width() const { 215unsigned int SystemTray::width() const {
216 if (orientation() == FbTk::ROT90 || orientation() == FbTk::ROT270)
217 return m_window.width();
218
216 return m_clients.size()* (height() - 2 * m_theme.border().width()); 219 return m_clients.size()* (height() - 2 * m_theme.border().width());
217} 220}
218 221
219unsigned int SystemTray::height() const { 222unsigned int SystemTray::height() const {
220 return m_window.height(); 223 if (orientation() == FbTk::ROT0 || orientation() == FbTk::ROT180)
224 return m_window.height();
225
226 return m_clients.size()* (width() - 2 * m_theme.border().width());
221} 227}
222 228
223unsigned int SystemTray::borderWidth() const { 229unsigned int SystemTray::borderWidth() const {
@@ -362,10 +368,12 @@ void SystemTray::handleEvent(XEvent &event) {
362} 368}
363 369
364void SystemTray::rearrangeClients() { 370void SystemTray::rearrangeClients() {
365 const unsigned int h = height(); 371 unsigned int w_rot0 = width(), h_rot0 = height();
366 const unsigned int bw = m_theme.border().width(); 372 const unsigned int bw = m_theme.border().width();
367 int final_size = m_clients.size()*h + bw; 373 FbTk::translateSize(orientation(), w_rot0, h_rot0);
368 resize(final_size, h); 374 unsigned int trayw = m_clients.size()*h_rot0 + bw, trayh = h_rot0;
375 FbTk::translateSize(orientation(), trayw, trayh);
376 resize(trayw, trayh);
369 update(0); 377 update(0);
370 378
371 // move and resize clients 379 // move and resize clients
@@ -373,9 +381,13 @@ void SystemTray::rearrangeClients() {
373 ClientList::iterator client_it_end = m_clients.end(); 381 ClientList::iterator client_it_end = m_clients.end();
374 int next_x = bw; 382 int next_x = bw;
375 for (; client_it != client_it_end; 383 for (; client_it != client_it_end;
376 ++client_it, next_x += h+bw) { 384 ++client_it, next_x += h_rot0+bw) {
377 (*client_it)->moveResize(next_x, bw, h, h); 385 int x = next_x, y = bw;
378 (*client_it)->sendConfigureNotify(next_x, bw, h, h); 386 translateCoords(orientation(), x, y, w_rot0, h_rot0);
387 translatePosition(orientation(), x, y, h_rot0, h_rot0, 0);
388
389 (*client_it)->moveResize(x, y, h_rot0, h_rot0);
390 (*client_it)->sendConfigureNotify(x, y, h_rot0, h_rot0);
379 } 391 }
380 392
381 client_it = m_clients.begin(); 393 client_it = m_clients.begin();
@@ -401,7 +413,7 @@ void SystemTray::update(FbTk::Subject* subject) {
401 if(m_pixmap) 413 if(m_pixmap)
402 m_screen.imageControl().removeImage(m_pixmap); 414 m_screen.imageControl().removeImage(m_pixmap);
403 m_pixmap = m_screen.imageControl().renderImage(width(), height(), 415 m_pixmap = m_screen.imageControl().renderImage(width(), height(),
404 m_theme.texture()); 416 m_theme.texture(), orientation());
405 m_window.setBackgroundPixmap(m_pixmap); 417 m_window.setBackgroundPixmap(m_pixmap);
406 } 418 }
407 419
@@ -409,11 +421,7 @@ void SystemTray::update(FbTk::Subject* subject) {
409 if (subject) { 421 if (subject) {
410 ClientList::iterator client_it = m_clients.begin(); 422 ClientList::iterator client_it = m_clients.begin();
411 ClientList::iterator client_it_end = m_clients.end(); 423 ClientList::iterator client_it_end = m_clients.end();
412 int next_x = 0; 424 for (; client_it != client_it_end; ++client_it) {
413 const unsigned int h = height();
414 const unsigned int b = m_theme.border().width();
415 for (; client_it != client_it_end;
416 ++client_it, next_x += h - 2 * b) {
417 425
418 // maybe not the best solution (yet), force a refresh of the 426 // maybe not the best solution (yet), force a refresh of the
419 // background of the client 427 // background of the client