From 970c59779648f24663858e4b22f3841e35519097 Mon Sep 17 00:00:00 2001 From: Chris Lee <@klee93> Date: Sat, 15 Sep 2018 05:46:14 +0000 Subject: [PATCH] #716 fix executor spacing --- ChangeLog | 3 +++ src/execplugin/execplugin.c | 39 +++++++++++++++++++++++++++---------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3881e54..7dfc985 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2018-09-14 master +- Fix spacing around icons in executor without text in vertical panels (issue #716) + 2018-08-05 16.6.1 - Fix packaging regression for debian (issue #715) diff --git a/src/execplugin/execplugin.c b/src/execplugin/execplugin.c index cb4e936..1b02d9b 100644 --- a/src/execplugin/execplugin.c +++ b/src/execplugin/execplugin.c @@ -373,7 +373,11 @@ void execp_compute_icon_text_geometry(Execp *execp, *new_size = *txt_height + 2 * *vert_padding + top_bottom_border_width(area); *new_size = MAX(*new_size, *icon_h + 2 * *vert_padding + top_bottom_border_width(area)); } else { - *new_size = *icon_h + *interior_padding + *txt_height + 2 * *vert_padding + top_bottom_border_width(area); + if (strlen(execp->backend->text)) { + *new_size = *icon_h + *interior_padding + *txt_height + 2 * *vert_padding + top_bottom_border_width(area); + } else { + *new_size = *icon_h + 2 * *vert_padding + top_bottom_border_width(area); + } } if (*new_size != area->height) { *resized = TRUE; @@ -441,10 +445,17 @@ gboolean resize_execp(void *obj) execp->frontend->texty = (execp->area.height - txt_height) / 2; execp->frontend->textx = execp->frontend->iconx + icon_w + interior_padding; } else { - execp->frontend->icony = (execp->area.height - icon_h - interior_padding - txt_height) / 2; - execp->frontend->iconx = (execp->area.width - icon_w) / 2; - execp->frontend->texty = execp->frontend->icony + icon_h + interior_padding; - execp->frontend->textx = (execp->area.width - txt_width) / 2; + if (strlen(execp->backend->text)) { + execp->frontend->icony = (execp->area.height - icon_h - interior_padding - txt_height) / 2; + execp->frontend->iconx = (execp->area.width - icon_w) / 2; + execp->frontend->texty = execp->frontend->icony + icon_h + interior_padding; + execp->frontend->textx = (execp->area.width - txt_width) / 2; + } else { + execp->frontend->icony = (execp->area.height - icon_h) / 2; + execp->frontend->iconx = (execp->area.width - icon_w) / 2; + execp->frontend->texty = execp->frontend->icony + icon_h + interior_padding; + execp->frontend->textx = (execp->area.width - txt_width) / 2; + } } } else { execp->frontend->texty = (execp->area.height - txt_height) / 2; @@ -458,10 +469,17 @@ gboolean resize_execp(void *obj) execp->frontend->texty = (execp->area.height - txt_height) / 2; execp->frontend->textx = execp->frontend->iconx + icon_w + interior_padding; } else { - execp->frontend->icony = (execp->area.height - icon_h - interior_padding - txt_height) / 2; - execp->frontend->iconx = left_border_width(&execp->area) + horiz_padding; - execp->frontend->texty = execp->frontend->icony + icon_h + interior_padding; - execp->frontend->textx = execp->frontend->iconx; + if (strlen(execp->backend->text)) { + execp->frontend->icony = (execp->area.height - icon_h - interior_padding - txt_height) / 2; + execp->frontend->iconx = left_border_width(&execp->area) + horiz_padding; + execp->frontend->texty = execp->frontend->icony + icon_h + interior_padding; + execp->frontend->textx = execp->frontend->iconx; + } else { + execp->frontend->icony = (execp->area.height - icon_h) / 2; + execp->frontend->iconx = left_border_width(&execp->area) + horiz_padding; + execp->frontend->texty = execp->frontend->icony + icon_h + interior_padding; + execp->frontend->textx = execp->frontend->iconx; + } } } else { execp->frontend->texty = (execp->area.height - txt_height) / 2; @@ -531,12 +549,13 @@ void execp_dump_geometry(void *obj, int indent) imlib_context_set_image(tmp); } fprintf(stderr, - "tint2: %*sText: x = %d, y = %d, w = %d, align = %s, text = %s\n", + "tint2: %*sText: x = %d, y = %d, w = %d, h = %d, align = %s, text = %s\n", indent, "", execp->frontend->textx, execp->frontend->texty, execp->frontend->textw, + execp->frontend->texth, execp->backend->centered ? "center" : "left", execp->backend->text); }