all repos — tint2 @ f28983e5a76982a61768b235bccea8354fcdca9d

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

systray: Use different X connection for XGetImage (fixes crash on ATI cards)
o9000 o9000
commit

f28983e5a76982a61768b235bccea8354fcdca9d

parent

b35cdb70df5947c8a2c59da4c66d19bcf61ac0db

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

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

@@ -647,17 +647,26 @@ break;

} } +Display *display = NULL; XImage *tintXGetImage(Window win) { + char *display_name = XDisplayName(NULL); + if (!display_name) + return NULL; + if (!display) + display = XOpenDisplay(display_name); + if (!display) + return NULL; + unsigned int border_width; int xpos, ypos; unsigned int width, height, depth; Window root; - if (!XGetGeometry(server.dsp, win, &root, &xpos, &ypos, &width, &height, &border_width, &depth)) { + if (!XGetGeometry(display, win, &root, &xpos, &ypos, &width, &height, &border_width, &depth)) { fprintf(stderr, "Couldn't get geometry of window!\n"); return NULL; } - return XGetImage(server.dsp, win, 0, 0, width, height, AllPlanes, XYPixmap); + return XGetImage(display, win, 0, 0, width, height, AllPlanes, XYPixmap); } void systray_render_icon_composited(void* t)

@@ -694,6 +703,8 @@ if (ximage) {

if (ximage->width != traywin->width || ximage->height != traywin->height) { XFree(ximage); + XCloseDisplay(display); + display = NULL; XMoveResizeWindow(server.dsp, traywin->win, 0, 0, traywin->width, traywin->height); return; }

@@ -712,6 +723,8 @@ }

} } XFree(ximage); + XCloseDisplay(display); + display = NULL; } if (traywin->empty != empty) { traywin->empty = empty;