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,17 +610,20 @@ 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);
XColor color; if (ximage) {
int x, y, empty = 1; XColor color;
for (x = 0; empty && x < traywin->width; x++) { int x, y;
for (y = 0; empty && y < traywin->height; y++) { for (x = 0; empty && x < traywin->width; x++) {
color.pixel = XGetPixel(ximage, x, y); for (y = 0; empty && y < traywin->height; y++) {
if (color.pixel != 0) color.pixel = XGetPixel(ximage, x, y);
empty = 0; if (color.pixel != 0)
empty = 0;
}
} }
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;