all repos — fluxbox @ e57a30f664f7fb2660967f40db2c10759c2e9e4f

custom fork of the fluxbox windowmanager

fix systray client sizing
simonb simonb
commit

e57a30f664f7fb2660967f40db2c10759c2e9e4f

parent

1c2f92a3d2288b1cae9500110a72173506a18072

M ChangeLogChangeLog

@@ -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
M src/FbTk/FbWindow.ccsrc/FbTk/FbWindow.cc

@@ -555,6 +555,30 @@ updateGeometry();

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(); }
M src/FbTk/FbWindow.hhsrc/FbTk/FbWindow.hh

@@ -186,6 +186,8 @@ void setOpaque(unsigned char alpha);

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);
M src/SystemTray.ccsrc/SystemTray.cc

@@ -326,7 +326,6 @@ }

void SystemTray::exposeEvent(XExposeEvent &event) { m_window.clear(); - update(0); } void SystemTray::handleEvent(XEvent &event) {

@@ -350,6 +349,8 @@ // the position might differ so we update from our local

// 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::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() {
M src/WinClient.ccsrc/WinClient.cc

@@ -129,29 +129,6 @@

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 ||
M src/WinClient.hhsrc/WinClient.hh

@@ -50,8 +50,6 @@ WinClient(Window win, BScreen &screen, FluxboxWindow *fbwin = 0);

~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)
M src/Window.ccsrc/Window.cc

@@ -3727,7 +3727,7 @@ unsigned int height, unsigned int width) {

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());