From e57a30f664f7fb2660967f40db2c10759c2e9e4f Mon Sep 17 00:00:00 2001 From: simonb Date: Tue, 26 Apr 2005 04:18:10 +0000 Subject: fix systray client sizing --- ChangeLog | 2 ++ src/FbTk/FbWindow.cc | 24 ++++++++++++++++++++++++ src/FbTk/FbWindow.hh | 2 ++ src/SystemTray.cc | 21 +++++++++++++-------- src/WinClient.cc | 23 ----------------------- src/WinClient.hh | 2 -- src/Window.cc | 2 +- 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 @@ (Format: Year/Month/Day) Changes for 0.9.13 *05/04/26: + * Fix systray icon sizing (send a configurenotify on resize) (Simon) + SystemTray.cc WinClient.hh/cc FbTk/FbWindow.hh/cc Window.cc * Extension of previous patch, pushing various bits of menu items and text buttons onto the background, and fixing various issues (Simon) + 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, FbWindow::setBackgroundColor(Color("gray", screenNumber())); } + +void FbWindow::sendConfigureNotify(int x, int y, + unsigned int width, unsigned int height) { + Display *disp = FbTk::App::instance()->display(); + XEvent event; + event.type = ConfigureNotify; + + event.xconfigure.display = disp; + event.xconfigure.event = window(); + event.xconfigure.window = window(); + event.xconfigure.x = x; + event.xconfigure.y = y; + event.xconfigure.width = width; + event.xconfigure.height = height; + //!! TODO + event.xconfigure.border_width = 1; + //!! TODO + event.xconfigure.above = None; + event.xconfigure.override_redirect = false; + + XSendEvent(disp, window(), False, StructureNotifyMask, &event); + +} + bool operator == (Window win, const FbWindow &fbwin) { return win == fbwin.window(); } 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: void setRenderer(FbWindowRenderer &renderer) { m_renderer = &renderer; } + void sendConfigureNotify(int x, int y, unsigned int width, unsigned int height); + protected: /// creates a window with x window client (m_window = client) 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) { void SystemTray::exposeEvent(XExposeEvent &event) { m_window.clear(); - update(0); } void SystemTray::handleEvent(XEvent &event) { @@ -350,6 +349,8 @@ void SystemTray::handleEvent(XEvent &event) { // copy of position (*it)->moveResize((*it)->x(), (*it)->y(), (*it)->width(), (*it)->height()); + // this was why gaim wasn't centring the icon + (*it)->sendConfigureNotify(0, 0, (*it)->width(), (*it)->height()); } // so toolbar know that we changed size resizeSig().notify(); @@ -359,19 +360,23 @@ void SystemTray::handleEvent(XEvent &event) { } void SystemTray::rearrangeClients() { + const unsigned int h = height(); + const unsigned int bw = m_theme.border().width(); + int final_size = m_clients.size()*h + bw; + resize(final_size, h); + update(0); + // move and resize clients ClientList::iterator client_it = m_clients.begin(); ClientList::iterator client_it_end = m_clients.end(); - int next_x = 0; - const unsigned int h = height(); - const unsigned int b = m_theme.border().width(); + int next_x = bw; for (; client_it != client_it_end; - ++client_it, next_x += h - 2 * b) { - (*client_it)->moveResize(next_x, b, h - b, h - b); + ++client_it, next_x += h+bw) { + (*client_it)->moveResize(next_x, bw, h, h); + (*client_it)->sendConfigureNotify(next_x, bw, h, h); } - resize(next_x, height()); - update(0); + client_it = m_clients.begin(); } void 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() { m_win = 0; } -void WinClient::updateRect(int x, int y, - unsigned int width, unsigned int height) { - Display *disp = FbTk::App::instance()->display(); - XEvent event; - event.type = ConfigureNotify; - - event.xconfigure.display = disp; - event.xconfigure.event = window(); - event.xconfigure.window = window(); - event.xconfigure.x = x; - event.xconfigure.y = y; - event.xconfigure.width = width; - event.xconfigure.height = height; - //!! TODO - event.xconfigure.border_width = 1;//client.old_bw; - //!! TODO - event.xconfigure.above = None; //m_frame.window().window(); - event.xconfigure.override_redirect = false; - - XSendEvent(disp, window(), False, StructureNotifyMask, &event); - -} - bool WinClient::acceptsFocus() const { return (m_focus_mode == F_LOCALLYACTIVE || 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: ~WinClient(); - void updateRect(int x, int y, unsigned int width, unsigned int height); - bool sendFocus(); // returns whether we sent a message or not // i.e. whether we assume the focus will get taken 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, client.moveResize(x, y, frame().clientArea().width(), frame().clientArea().height()); - client.updateRect(frame().x() + frame().clientArea().x(), + client.sendConfigureNotify(frame().x() + frame().clientArea().x(), frame().y() + frame().clientArea().y(), frame().clientArea().width(), frame().clientArea().height()); -- cgit v0.11.2