Better error handling in systray icon rendering

This commit is contained in:
o9000
2015-05-20 15:42:27 +02:00
parent 5acda6a0c0
commit 6014b51850

View File

@@ -610,9 +610,11 @@ void systray_render_icon_now(void* t)
return; return;
} }
int empty = 1;
XImage *ximage = XGetImage(server.dsp, traywin->tray_id, 0, 0, traywin->width, traywin->height, AllPlanes, XYPixmap); XImage *ximage = XGetImage(server.dsp, traywin->tray_id, 0, 0, traywin->width, traywin->height, AllPlanes, XYPixmap);
if (ximage) {
XColor color; XColor color;
int x, y, empty = 1; int x, y;
for (x = 0; empty && x < traywin->width; x++) { for (x = 0; empty && x < traywin->width; x++) {
for (y = 0; empty && y < traywin->height; y++) { for (y = 0; empty && y < traywin->height; y++) {
color.pixel = XGetPixel(ximage, x, y); color.pixel = XGetPixel(ximage, x, y);
@@ -621,6 +623,7 @@ void systray_render_icon_now(void* t)
} }
} }
XFree(ximage); XFree(ximage);
}
if (traywin->empty != empty) { if (traywin->empty != empty) {
traywin->empty = empty; traywin->empty = empty;
systray.area.resize = 1; systray.area.resize = 1;