Compute task icon size correctly
o9000 mrovi9000@gmail.com
2 files changed,
9 insertions(+),
1 deletions(-)
M
src/taskbar/task.c
→
src/taskbar/task.c
@@ -383,6 +383,13 @@ }
imlib_context_set_image(image); render_image(task->area.pix, pos_x, panel->g_task.icon_posy); + if (0) { + fprintf(stderr, "Task icon size: %d %d pos %d\n", imlib_image_get_width(), imlib_image_get_height(), pos_x); + fprintf(stderr, "Task max size : %d %d\n", panel->g_task.maximum_width, panel->g_task.maximum_height); + fprintf(stderr, "Task area size: %d %d\n", task->area.width, task->area.height); + fprintf(stderr, "Task area bord: %d\n", task->area.bg->border.width); + fprintf(stderr, "\n"); + } } void draw_task(void *obj, cairo_t *c)
M
src/taskbar/taskbar.c
→
src/taskbar/taskbar.c
@@ -263,7 +263,8 @@
panel->g_task.text_posx = panel->g_task.background[0]->border.width + panel->g_task.area.paddingxlr; panel->g_task.text_height = panel->g_task.area.height - (2 * panel->g_task.area.paddingy); if (panel->g_task.has_icon) { - panel->g_task.icon_size1 = panel->g_task.area.height - (2 * panel->g_task.area.paddingy); + panel->g_task.icon_size1 = MIN(panel->g_task.maximum_width, MIN(panel->g_task.maximum_height, panel->g_task.area.height)) - + (2 * panel->g_task.area.paddingy) - 2 * panel->g_task.area.bg->border.width; panel->g_task.text_posx += panel->g_task.icon_size1 + panel->g_task.area.paddingx; panel->g_task.icon_posy = (panel->g_task.area.height - panel->g_task.icon_size1) / 2; }