aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonb <simonb>2005-04-26 04:18:10 (GMT)
committersimonb <simonb>2005-04-26 04:18:10 (GMT)
commite57a30f664f7fb2660967f40db2c10759c2e9e4f (patch)
treecab24eb65d78ccf35b9bdb182adfcbd971d6f66f
parent1c2f92a3d2288b1cae9500110a72173506a18072 (diff)
downloadfluxbox-e57a30f664f7fb2660967f40db2c10759c2e9e4f.zip
fluxbox-e57a30f664f7fb2660967f40db2c10759c2e9e4f.tar.bz2
fix systray client sizing
-rw-r--r--ChangeLog2
-rw-r--r--src/FbTk/FbWindow.cc24
-rw-r--r--src/FbTk/FbWindow.hh2
-rw-r--r--src/SystemTray.cc21
-rw-r--r--src/WinClient.cc23
-rw-r--r--src/WinClient.hh2
-rw-r--r--src/Window.cc2
7 files changed, 42 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index e938d6f..73e4ce5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
1(Format: Year/Month/Day) 1(Format: Year/Month/Day)
2Changes for 0.9.13 2Changes for 0.9.13
3*05/04/26: 3*05/04/26:
4 * Fix systray icon sizing (send a configurenotify on resize) (Simon)
5 SystemTray.cc WinClient.hh/cc FbTk/FbWindow.hh/cc Window.cc
4 * Extension of previous patch, pushing various bits of menu items and 6 * Extension of previous patch, pushing various bits of menu items and
5 text buttons onto the background, and fixing various issues (Simon) 7 text buttons onto the background, and fixing various issues (Simon)
6 + Incidentally, adds some new theme items (due to backwards 8 + Incidentally, adds some new theme items (due to backwards
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc
index acdc7c1..e00fa14 100644
--- a/src/FbTk/FbWindow.cc
+++ b/src/FbTk/FbWindow.cc
@@ -555,6 +555,30 @@ void FbWindow::create(Window parent, int x, int y,
555 FbWindow::setBackgroundColor(Color("gray", screenNumber())); 555 FbWindow::setBackgroundColor(Color("gray", screenNumber()));
556} 556}
557 557
558
559void FbWindow::sendConfigureNotify(int x, int y,
560 unsigned int width, unsigned int height) {
561 Display *disp = FbTk::App::instance()->display();
562 XEvent event;
563 event.type = ConfigureNotify;
564
565 event.xconfigure.display = disp;
566 event.xconfigure.event = window();
567 event.xconfigure.window = window();
568 event.xconfigure.x = x;
569 event.xconfigure.y = y;
570 event.xconfigure.width = width;
571 event.xconfigure.height = height;
572 //!! TODO
573 event.xconfigure.border_width = 1;
574 //!! TODO
575 event.xconfigure.above = None;
576 event.xconfigure.override_redirect = false;
577
578 XSendEvent(disp, window(), False, StructureNotifyMask, &event);
579
580}
581
558bool operator == (Window win, const FbWindow &fbwin) { 582bool operator == (Window win, const FbWindow &fbwin) {
559 return win == fbwin.window(); 583 return win == fbwin.window();
560} 584}
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh
index ff1b42e..f02c63e 100644
--- a/src/FbTk/FbWindow.hh
+++ b/src/FbTk/FbWindow.hh
@@ -186,6 +186,8 @@ public:
186 186
187 void setRenderer(FbWindowRenderer &renderer) { m_renderer = &renderer; } 187 void setRenderer(FbWindowRenderer &renderer) { m_renderer = &renderer; }
188 188
189 void sendConfigureNotify(int x, int y, unsigned int width, unsigned int height);
190
189protected: 191protected:
190 /// creates a window with x window client (m_window = client) 192 /// creates a window with x window client (m_window = client)
191 explicit FbWindow(Window client); 193 explicit FbWindow(Window client);
diff --git a/src/SystemTray.cc b/src/SystemTray.cc
index c296efb..1aced06 100644
--- a/src/SystemTray.cc
+++ b/src/SystemTray.cc
@@ -326,7 +326,6 @@ void SystemTray::removeClient(Window win) {
326 326
327void SystemTray::exposeEvent(XExposeEvent &event) { 327void SystemTray::exposeEvent(XExposeEvent &event) {
328 m_window.clear(); 328 m_window.clear();
329 update(0);
330} 329}
331 330
332void SystemTray::handleEvent(XEvent &event) { 331void SystemTray::handleEvent(XEvent &event) {
@@ -350,6 +349,8 @@ void SystemTray::handleEvent(XEvent &event) {
350 // copy of position 349 // copy of position
351 (*it)->moveResize((*it)->x(), (*it)->y(), 350 (*it)->moveResize((*it)->x(), (*it)->y(),
352 (*it)->width(), (*it)->height()); 351 (*it)->width(), (*it)->height());
352 // this was why gaim wasn't centring the icon
353 (*it)->sendConfigureNotify(0, 0, (*it)->width(), (*it)->height());
353 } 354 }
354 // so toolbar know that we changed size 355 // so toolbar know that we changed size
355 resizeSig().notify(); 356 resizeSig().notify();
@@ -359,19 +360,23 @@ void SystemTray::handleEvent(XEvent &event) {
359} 360}
360 361
361void SystemTray::rearrangeClients() { 362void SystemTray::rearrangeClients() {
363 const unsigned int h = height();
364 const unsigned int bw = m_theme.border().width();
365 int final_size = m_clients.size()*h + bw;
366 resize(final_size, h);
367 update(0);
368
362 // move and resize clients 369 // move and resize clients
363 ClientList::iterator client_it = m_clients.begin(); 370 ClientList::iterator client_it = m_clients.begin();
364 ClientList::iterator client_it_end = m_clients.end(); 371 ClientList::iterator client_it_end = m_clients.end();
365 int next_x = 0; 372 int next_x = bw;
366 const unsigned int h = height();
367 const unsigned int b = m_theme.border().width();
368 for (; client_it != client_it_end; 373 for (; client_it != client_it_end;
369 ++client_it, next_x += h - 2 * b) { 374 ++client_it, next_x += h+bw) {
370 (*client_it)->moveResize(next_x, b, h - b, h - b); 375 (*client_it)->moveResize(next_x, bw, h, h);
376 (*client_it)->sendConfigureNotify(next_x, bw, h, h);
371 } 377 }
372 378
373 resize(next_x, height()); 379 client_it = m_clients.begin();
374 update(0);
375} 380}
376 381
377void SystemTray::removeAllClients() { 382void SystemTray::removeAllClients() {
diff --git a/src/WinClient.cc b/src/WinClient.cc
index fe02187..42f8cae 100644
--- a/src/WinClient.cc
+++ b/src/WinClient.cc
@@ -129,29 +129,6 @@ WinClient::~WinClient() {
129 m_win = 0; 129 m_win = 0;
130} 130}
131 131
132void WinClient::updateRect(int x, int y,
133 unsigned int width, unsigned int height) {
134 Display *disp = FbTk::App::instance()->display();
135 XEvent event;
136 event.type = ConfigureNotify;
137
138 event.xconfigure.display = disp;
139 event.xconfigure.event = window();
140 event.xconfigure.window = window();
141 event.xconfigure.x = x;
142 event.xconfigure.y = y;
143 event.xconfigure.width = width;
144 event.xconfigure.height = height;
145 //!! TODO
146 event.xconfigure.border_width = 1;//client.old_bw;
147 //!! TODO
148 event.xconfigure.above = None; //m_frame.window().window();
149 event.xconfigure.override_redirect = false;
150
151 XSendEvent(disp, window(), False, StructureNotifyMask, &event);
152
153}
154
155bool WinClient::acceptsFocus() const { 132bool WinClient::acceptsFocus() const {
156 return (m_focus_mode == F_LOCALLYACTIVE || 133 return (m_focus_mode == F_LOCALLYACTIVE ||
157 m_focus_mode == F_PASSIVE || 134 m_focus_mode == F_PASSIVE ||
diff --git a/src/WinClient.hh b/src/WinClient.hh
index 4680a4e..49e1931 100644
--- a/src/WinClient.hh
+++ b/src/WinClient.hh
@@ -50,8 +50,6 @@ public:
50 50
51 ~WinClient(); 51 ~WinClient();
52 52
53 void updateRect(int x, int y, unsigned int width, unsigned int height);
54
55 bool sendFocus(); // returns whether we sent a message or not 53 bool sendFocus(); // returns whether we sent a message or not
56 // i.e. whether we assume the focus will get taken 54 // i.e. whether we assume the focus will get taken
57 bool acceptsFocus() const; // will this window accept focus (according to hints) 55 bool acceptsFocus() const; // will this window accept focus (according to hints)
diff --git a/src/Window.cc b/src/Window.cc
index e92c989..f72075a 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -3727,7 +3727,7 @@ void FluxboxWindow::moveResizeClient(WinClient &client, int x, int y,
3727 client.moveResize(x, y, 3727 client.moveResize(x, y,
3728 frame().clientArea().width(), 3728 frame().clientArea().width(),
3729 frame().clientArea().height()); 3729 frame().clientArea().height());
3730 client.updateRect(frame().x() + frame().clientArea().x(), 3730 client.sendConfigureNotify(frame().x() + frame().clientArea().x(),
3731 frame().y() + frame().clientArea().y(), 3731 frame().y() + frame().clientArea().y(),
3732 frame().clientArea().width(), 3732 frame().clientArea().width(),
3733 frame().clientArea().height()); 3733 frame().clientArea().height());