all repos — tint2 @ b4ff007e421fa9f9dd6e15238b4e14e34e198cbd

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

systray: reorder some operations to make sure we resize correctly
o9000 o9000
commit

b4ff007e421fa9f9dd6e15238b4e14e34e198cbd

parent

ae379d865c2a0a614a16aaf8e2b9794e517ca8f0

1 files changed, 18 insertions(+), 15 deletions(-)

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

@@ -441,19 +441,6 @@ mask = CWBackPixmap;

} Window parent = XCreateWindow(server.dsp, panel->main_win, 0, 0, 30, 30, 0, attr.depth, InputOutput, visual, mask, &set_attr); - // Watch for the icon trying to resize itself / closing again - XSync(server.dsp, False); - error = FALSE; - XErrorHandler old = XSetErrorHandler(window_error_handler); - XSelectInput(server.dsp, win, StructureNotifyMask); - XSync(server.dsp, False); - XSetErrorHandler(old); - if (error != FALSE) { - fprintf(stderr, "tint2 : cannot add systray icon\n"); - XDestroyWindow(server.dsp, parent); - return FALSE; - } - // Add the icon to the list traywin = g_new0(TrayWindow, 1); traywin->parent = parent;

@@ -482,6 +469,7 @@

// Resize and redraw the systray systray.area.resize = 1; systray.area.redraw = 1; + panel->area.resize = 1; panel_refresh = 1; return TRUE; }

@@ -506,8 +494,18 @@ remove_icon(traywin);

return FALSE; } - XMoveResizeWindow(server.dsp, traywin->parent, traywin->x, traywin->y, traywin->width, traywin->height); - XMoveResizeWindow(server.dsp, traywin->win, 0, 0, traywin->width, traywin->height); + // Watch for the icon trying to resize itself / closing again + XSync(server.dsp, False); + error = FALSE; + old = XSetErrorHandler(window_error_handler); + XSelectInput(server.dsp, traywin->win, StructureNotifyMask); + XSync(server.dsp, False); + XSetErrorHandler(old); + if (error != FALSE) { + printf("systray %d: cannot embed icon for window %lu parent %lu pid %d\n", __LINE__, traywin->win, traywin->parent, traywin->pid); + remove_icon(traywin); + return FALSE; + } traywin->reparented = 1;

@@ -573,6 +571,11 @@ if (!traywin->hide)

XMapWindow(server.dsp, traywin->win); if (!traywin->hide && !panel->is_hidden) XMapRaised(server.dsp, traywin->parent); + + XMoveResizeWindow(server.dsp, traywin->parent, traywin->x, traywin->y, traywin->width, traywin->height); + XMoveResizeWindow(server.dsp, traywin->win, 0, 0, traywin->width, traywin->height); + + XFlush(server.dsp); return TRUE; }