Position task icon correctly (issue #575)
o9000 mrovi9000@gmail.com
2 files changed,
17 insertions(+),
6 deletions(-)
M
src/taskbar/task.c
→
src/taskbar/task.c
@@ -369,7 +369,7 @@ pos_x = (task->area.width - text_width - panel->g_task.icon_size1) / 2;
else pos_x = (task->area.width - panel->g_task.icon_size1) / 2; } else { - pos_x = panel->g_task.area.paddingxlr + task->area.bg->border.width; + pos_x = task->area.bg->border.width + task->area.paddingxlr; } // Render@@ -388,12 +388,12 @@ image = task->icon[task->current_state];
} imlib_context_set_image(image); - render_image(task->area.pix, pos_x, panel->g_task.icon_posy); + render_image(task->area.pix, pos_x, (task->area.height - panel->g_task.icon_size1) / 2); 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 icon size: %d %d pos %d %d\n", imlib_image_get_width(), imlib_image_get_height(), pos_x, panel->g_task.icon_posy); 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, "Task border : %d\n", task->area.bg->border.width); fprintf(stderr, "\n"); } }
M
src/taskbar/taskbar.c
→
src/taskbar/taskbar.c
@@ -232,6 +232,7 @@ if (panel_horizontal) {
panel->g_task.area.posy = panel->g_taskbar.area.posy + panel->g_taskbar.background[TASKBAR_NORMAL]->border.width + panel->g_taskbar.area.paddingy; + panel->g_task.area.width = panel->g_task.maximum_width; panel->g_task.area.height = panel->area.height - (2 * panel->g_task.area.posy); } else { panel->g_task.area.posx = panel->g_taskbar.area.posx +@@ -271,12 +272,22 @@ 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 = - MIN(panel->g_task.maximum_width, MIN(panel->g_task.maximum_height, panel->g_task.area.height)) - + MIN(MIN(panel->g_task.maximum_width, panel->g_task.maximum_height), + MIN(panel->g_task.area.width, 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; + if (0) + printf("task: icon_size = %d, textx = %f, texth = %f, icony = %d, w = %d, h = %d, maxw = %d, maxh = %d\n", + panel->g_task.icon_size1, + panel->g_task.text_posx, + panel->g_task.text_height, + panel->g_task.icon_posy, + panel->g_task.area.width, + panel->g_task.area.height, + panel->g_task.maximum_width, + panel->g_task.maximum_height); } - // printf("monitor %d, task_maximum_width %d\n", panel->monitor, panel->g_task.maximum_width); Taskbar *taskbar; panel->num_desktops = server.num_desktops;