all repos — tint2 @ 03675b152d558387079dc1bc8666eb5c924d5b22

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

Match perfectly text layout and drawing parameters #693
o9000 mrovi9000@gmail.com
commit

03675b152d558387079dc1bc8666eb5c924d5b22

parent

c3fdd76b58dec2e3deb3fc625d07edfb8e3a6b65

M src/button/button.csrc/button/button.c

@@ -299,6 +299,7 @@ button->backend->text,

strlen(button->backend->text), PANGO_WRAP_WORD_CHAR, PANGO_ELLIPSIZE_NONE, + button->backend->centered ? PANGO_ALIGN_CENTER : PANGO_ALIGN_LEFT, FALSE, panel->scale); } else {

@@ -312,6 +313,7 @@ button->backend->text,

strlen(button->backend->text), PANGO_WRAP_WORD_CHAR, PANGO_ELLIPSIZE_NONE, + button->backend->centered ? PANGO_ALIGN_CENTER : PANGO_ALIGN_LEFT, FALSE, panel->scale); }

@@ -380,6 +382,7 @@ button->backend->text,

strlen(button->backend->text), PANGO_WRAP_WORD_CHAR, PANGO_ELLIPSIZE_NONE, + button->backend->centered ? PANGO_ALIGN_CENTER : PANGO_ALIGN_LEFT, FALSE, panel->scale); } else {
M src/execplugin/execplugin.csrc/execplugin/execplugin.c

@@ -349,6 +349,7 @@ execp->backend->text,

strlen(execp->backend->text), PANGO_WRAP_WORD_CHAR, PANGO_ELLIPSIZE_NONE, + execp->backend->centered ? PANGO_ALIGN_CENTER : PANGO_ALIGN_LEFT, execp->backend->has_markup, panel->scale);
M src/taskbar/taskbar.csrc/taskbar/taskbar.c

@@ -343,6 +343,7 @@ "TAjpg",

5, PANGO_WRAP_WORD_CHAR, PANGO_ELLIPSIZE_END, + panel->g_task.centered ? PANGO_ALIGN_CENTER : PANGO_ALIGN_LEFT, FALSE, panel->scale);
M src/taskbar/taskbarname.csrc/taskbar/taskbarname.c

@@ -144,6 +144,7 @@ taskbar_name->name,

strlen(taskbar_name->name), PANGO_WRAP_WORD_CHAR, PANGO_ELLIPSIZE_NONE, + PANGO_ALIGN_CENTER, FALSE, panel->scale);

@@ -171,6 +172,7 @@ taskbar_name->name,

strlen(taskbar_name->name), PANGO_WRAP_WORD_CHAR, PANGO_ELLIPSIZE_NONE, + PANGO_ALIGN_CENTER, FALSE, panel->scale);
M src/util/area.csrc/util/area.c

@@ -947,6 +947,7 @@ line1,

strlen(line1), PANGO_WRAP_WORD_CHAR, PANGO_ELLIPSIZE_NONE, + PANGO_ALIGN_CENTER, FALSE, ((Panel*)area->panel)->scale); else

@@ -962,6 +963,7 @@ line2,

strlen(line2), PANGO_WRAP_WORD_CHAR, PANGO_ELLIPSIZE_NONE, + PANGO_ALIGN_CENTER, FALSE, ((Panel*)area->panel)->scale); else
M src/util/common.csrc/util/common.c

@@ -933,6 +933,7 @@ const char *text,

int text_len, PangoWrapMode wrap, PangoEllipsizeMode ellipsis, + PangoAlignment alignment, gboolean markup, double scale) {

@@ -951,6 +952,7 @@ pango_cairo_context_set_resolution(context, 96 * scale);

PangoLayout *layout = pango_layout_new(context); pango_layout_set_width(layout, available_width * PANGO_SCALE); pango_layout_set_height(layout, available_height * PANGO_SCALE); + pango_layout_set_alignment(layout, alignment); pango_layout_set_wrap(layout, wrap); pango_layout_set_ellipsize(layout, ellipsis); pango_layout_set_font_description(layout, font);

@@ -982,38 +984,41 @@ const char *text,

int text_len, PangoWrapMode wrap, PangoEllipsizeMode ellipsis, + PangoAlignment alignment, gboolean markup, double scale) { - get_text_size(font, height, width, available_height, available_width, text, text_len, wrap, ellipsis, markup, scale); + get_text_size(font, height, width, available_height, available_width, text, text_len, wrap, ellipsis, alignment, markup, scale); // We do multiple passes, because pango sucks int actual_height, actual_width, overflow = 0; while (true) { - get_text_size(font, &actual_height, &actual_width, *height, *width, text, text_len, wrap, ellipsis, markup, scale); + get_text_size(font, &actual_height, &actual_width, *height, *width, text, text_len, wrap, ellipsis, alignment, markup, scale); if (actual_height <= *height) break; - if (*width >= available_width + 50) + if (*width >= available_width) break; overflow = 1; - fprintf(stderr, "tint2: text overflows, recomputing: available %dx%d, computed %dx%d, actual %dx%d\n", + fprintf(stderr, "tint2: text overflows, recomputing: available %dx%d, computed %dx%d, actual %dx%d: %s\n", available_width, available_height, *width, *height, actual_width, - actual_height); + actual_height, + text); (*width)++; } if (overflow) { *height = actual_height; - fprintf(stderr, "tint2: text final size computed as: available %dx%d, computed %dx%d, actual %dx%d\n", + fprintf(stderr, "tint2: text final size computed as: available %dx%d, computed %dx%d, actual %dx%d: %s\n", available_width, available_height, *width, *height, actual_width, - actual_height); + actual_height, + text); } }
M src/util/common.hsrc/util/common.h

@@ -122,6 +122,7 @@ const char *text,

int text_len, PangoWrapMode wrap, PangoEllipsizeMode ellipsis, + PangoAlignment alignment, gboolean markup, double scale);