all repos — tint2 @ d730f2302726ad7c9200bbeba805fa3d4ff73df1

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

systray: Trigger icon resize only when necessary
o9000 o9000
commit

d730f2302726ad7c9200bbeba805fa3d4ff73df1

parent

9f161f2bafb8b6c2d600be66e3c06547e877dfb0

1 files changed, 25 insertions(+), 6 deletions(-)

jump to
M src/systray/systraybar.csrc/systray/systraybar.c

@@ -234,13 +234,32 @@ }

} // position and size the icon window - if (systray_profile) - fprintf(stderr, "XMoveResizeWindow(server.dsp, traywin->parent = %ld, traywin->x = %d, traywin->y = %d, traywin->width = %d, traywin->height = %d)\n", traywin->parent, traywin->x, traywin->y, traywin->width, traywin->height); - XMoveResizeWindow(server.dsp, traywin->parent, traywin->x, traywin->y, traywin->width, traywin->height); + unsigned int border_width; + int xpos, ypos; + unsigned int width, height, depth; + Window root; + if (!XGetGeometry(server.dsp, traywin->parent, &root, &xpos, &ypos, &width, &height, &border_width, &depth)) { + fprintf(stderr, RED "Couldn't get geometry of window!\n" RESET); + } + if (width != traywin->width || height != traywin->height || xpos != traywin->x || ypos != traywin->y) { + if (systray_profile) + fprintf(stderr, "XMoveResizeWindow(server.dsp, traywin->parent = %ld, traywin->x = %d, traywin->y = %d, traywin->width = %d, traywin->height = %d)\n", traywin->parent, traywin->x, traywin->y, traywin->width, traywin->height); + XMoveResizeWindow(server.dsp, traywin->parent, traywin->x, traywin->y, traywin->width, traywin->height); + } + if (traywin->reparented) { - if (systray_profile) - fprintf(stderr, "XMoveResizeWindow(server.dsp, traywin->win = %ld, 0, 0, traywin->width = %d, traywin->height = %d)\n", traywin->win, traywin->width, traywin->height); - XMoveResizeWindow(server.dsp, traywin->win, 0, 0, traywin->width, traywin->height); + unsigned int border_width; + int xpos, ypos; + unsigned int width, height, depth; + Window root; + if (!XGetGeometry(server.dsp, traywin->win, &root, &xpos, &ypos, &width, &height, &border_width, &depth)) { + fprintf(stderr, RED "Couldn't get geometry of window!\n" RESET); + } + if (width != traywin->width || height != traywin->height || xpos != 0 || ypos != 0) { + if (systray_profile) + fprintf(stderr, "XMoveResizeWindow(server.dsp, traywin->win = %ld, 0, 0, traywin->width = %d, traywin->height = %d)\n", traywin->win, traywin->width, traywin->height); + XMoveResizeWindow(server.dsp, traywin->win, 0, 0, traywin->width, traywin->height); + } } } refresh_systray = 1;