systray: (disable_transparency=1) detect empty icons whenever a new icon is added, from any process; clear icon area because some icons were failing to redraw

This commit is contained in:
o9000 2015-06-21 15:23:09 +02:00
parent ea75558ac2
commit 222eca4099

View file

@ -452,7 +452,6 @@ gboolean add_icon(Window win)
free(name);
return FALSE;
}
if (pid && other->pid == pid) {
if (!systray_composited) {
// Empty icon detection: we compare the contents of the icon with the contents of the panel pixmap.
// If any pixel is different, the icon is not empty.
@ -461,7 +460,6 @@ gboolean add_icon(Window win)
imlib_context_set_drawable(other->win);
Imlib_Image image = imlib_create_image_from_drawable(0, 0, 0, other->width, other->height, 1);
if (image) {
fprintf(stderr, "Got image\n");
imlib_context_set_drawable(panel->temp_pmap);
Imlib_Image bg = imlib_create_image_from_drawable(0, other->x, other->y, other->width, other->height, 1);
imlib_context_set_image(bg);
@ -479,8 +477,10 @@ gboolean add_icon(Window win)
continue;
DATA32 rgb = pixel & 0xffFFff;
DATA32 rgb_bg = data_bg[y * other->width + x] & 0xffFFff;
DATA32 pixel_bg = data_bg[y * other->width + x];
DATA32 rgb_bg = pixel_bg & 0xffFFff;
if (rgb != rgb_bg) {
fprintf(stderr, "Pixel: %x different from bg %x at pos %d %d\n", pixel, pixel_bg, x, y);
empty = 0;
}
}
@ -489,8 +489,11 @@ gboolean add_icon(Window win)
imlib_free_image_and_decache();
imlib_context_set_image(bg);
imlib_free_image_and_decache();
if (systray_profile)
fprintf(stderr, "[%f] %s:%d win = %lu (%s) empty = %d\n", profiling_get_time(), __FUNCTION__, __LINE__, other->win, other->name, other->empty);
}
}
if (pid && other->pid == pid) {
if (other->empty)
num_empty_same_pid++;
}
@ -992,6 +995,7 @@ void systray_render_icon(void* t)
} else {
// Trigger window repaint
XClearArea(server.dsp, traywin->parent, 0, 0, traywin->width, traywin->height, True);
XClearArea(server.dsp, traywin->win, 0, 0, traywin->width, traywin->height, True);
}
}