Fix resizing of text elements (issue #661)

This commit is contained in:
o9000 2017-08-24 23:57:48 +02:00
parent 638264d874
commit 4df8f475ce
2 changed files with 12 additions and 7 deletions

View file

@ -363,10 +363,12 @@ void execp_compute_icon_text_geometry(Execp *execp,
if (*icon_w) if (*icon_w)
*new_size += *interior_padding + *icon_w; *new_size += *interior_padding + *icon_w;
*new_size += 2 * *horiz_padding + left_right_border_width(area); *new_size += 2 * *horiz_padding + left_right_border_width(area);
if (*new_size > area->width || *new_size < (area->width - 6)) { if (*new_size < area->width && abs(*new_size - area->width) < 6) {
// we try to limit the number of resize // we try to limit the number of resizes
*new_size += 1; *new_size = area->width;
*resized = TRUE; *resized = TRUE;
} else {
*resized = *new_size != area->width;
} }
} else { } else {
if (!*text_next_line) { if (!*text_next_line) {

View file

@ -996,9 +996,13 @@ gboolean resize_text_area(Area *area,
line1_font_desc, line1_font_desc,
line2_font_desc); line2_font_desc);
if (panel_horizontal) { if (panel_horizontal) {
if (new_size > area->width || new_size < (area->width - 6)) { if (new_size != area->width) {
// we try to limit the number of resizes if (new_size < area->width && abs(new_size - area->width) < 6) {
area->width = new_size + 1; // we try to limit the number of resizes
new_size = area->width;
} else {
area->width = new_size;
}
*line1_posy = (area->height - line1_height) / 2; *line1_posy = (area->height - line1_height) / 2;
if (line2) { if (line2) {
*line1_posy -= (line2_height) / 2; *line1_posy -= (line2_height) / 2;
@ -1008,7 +1012,6 @@ gboolean resize_text_area(Area *area,
} }
} else { } else {
if (new_size != area->height) { if (new_size != area->height) {
// we try to limit the number of resizes
area->height = new_size; area->height = new_size;
*line1_posy = (area->height - line1_height) / 2; *line1_posy = (area->height - line1_height) / 2;
if (line2) { if (line2) {