From 2570ae2cf629e57940f7ae29bd239bc64c019e61 Mon Sep 17 00:00:00 2001 From: o9000 Date: Wed, 15 Jul 2015 09:53:09 +0200 Subject: [PATCH] systray: Resize icons only if necessary --- src/systray/systraybar.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/systray/systraybar.c b/src/systray/systraybar.c index 3121d39..95ebd41 100644 --- a/src/systray/systraybar.c +++ b/src/systray/systraybar.c @@ -761,13 +761,17 @@ void systray_reconfigure_event(TrayWindow *traywin, XEvent *e) Panel* panel = systray.area.panel; //fprintf(stderr, "move tray %d\n", traywin->x); - XMoveResizeWindow(server.dsp, traywin->parent, traywin->x, traywin->y, traywin->width, traywin->height); - if (traywin->reparented) { - XMoveResizeWindow(server.dsp, traywin->win, 0, 0, traywin->width, traywin->height); - // Trigger window repaint - stop_timeout(traywin->render_timeout); - traywin->render_timeout = add_timeout(min_refresh_period, 0, systray_render_icon, traywin, &traywin->render_timeout); + + if (e->xconfigure.width != traywin->width || e->xconfigure.height != traywin->height || e->xconfigure.x != 0 || e->xconfigure.y != 0) { + XMoveResizeWindow(server.dsp, traywin->parent, traywin->x, traywin->y, traywin->width, traywin->height); + if (traywin->reparented) { + XMoveResizeWindow(server.dsp, traywin->win, 0, 0, traywin->width, traywin->height); + // Trigger window repaint + stop_timeout(traywin->render_timeout); + traywin->render_timeout = add_timeout(min_refresh_period, 0, systray_render_icon, traywin, &traywin->render_timeout); + } } + // Resize and redraw the systray if (systray_profile) fprintf(stderr, BLUE "[%f] %s:%d trigger resize & redraw\n" RESET, profiling_get_time(), __FUNCTION__, __LINE__);