Execplugin: add pango markup option
o9000 mrovi9000@gmail.com
9 files changed,
32 insertions(+),
12 deletions(-)
M
src/battery/battery.c
→
src/battery/battery.c
@@ -310,7 +310,8 @@ panel->area.width,
buf_bat_percentage, strlen(buf_bat_percentage), PANGO_WRAP_WORD_CHAR, - PANGO_ELLIPSIZE_NONE); + PANGO_ELLIPSIZE_NONE, + FALSE); get_text_size2(bat2_font_desc, &bat_time_height_ink, &bat_time_height,@@ -320,7 +321,8 @@ panel->area.width,
buf_bat_time, strlen(buf_bat_time), PANGO_WRAP_WORD_CHAR, - PANGO_ELLIPSIZE_NONE); + PANGO_ELLIPSIZE_NONE, + FALSE); if (panel_horizontal) { int new_size = (bat_percentage_width > bat_time_width) ? bat_percentage_width : bat_time_width;
M
src/clock/clock.c
→
src/clock/clock.c
@@ -254,7 +254,8 @@ panel->area.width,
buf_time, strlen(buf_time), PANGO_WRAP_WORD_CHAR, - PANGO_ELLIPSIZE_NONE); + PANGO_ELLIPSIZE_NONE, + FALSE); if (time2_format) { strftime(buf_date, sizeof(buf_date), time2_format, clock_gettime_for_tz(time2_timezone)); get_text_size2(time2_font_desc,@@ -266,7 +267,8 @@ panel->area.width,
buf_date, strlen(buf_date), PANGO_WRAP_WORD_CHAR, - PANGO_ELLIPSIZE_NONE); + PANGO_ELLIPSIZE_NONE, + FALSE); } if (panel_horizontal) {
M
src/config.c
→
src/config.c
@@ -531,6 +531,9 @@ execp->backend->has_icon = atoi(value);
} else if (strcmp(key, "execp_continuous") == 0) { Execp *execp = get_or_create_last_execp(); execp->backend->continuous = atoi(value); + } else if (strcmp(key, "execp_markup") == 0) { + Execp *execp = get_or_create_last_execp(); + execp->backend->has_markup = atoi(value); } else if (strcmp(key, "execp_cache_icon") == 0) { Execp *execp = get_or_create_last_execp(); execp->backend->cache_icon = atoi(value);
M
src/execplugin/execplugin.c
→
src/execplugin/execplugin.c
@@ -246,7 +246,10 @@ pango_layout_set_width(layout, execp->frontend->textw * PANGO_SCALE);
pango_layout_set_alignment(layout, execp->backend->centered ? PANGO_ALIGN_CENTER : PANGO_ALIGN_LEFT); pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR); pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE); - pango_layout_set_text(layout, execp->backend->text, strlen(execp->backend->text)); + if (!execp->backend->has_markup) + pango_layout_set_text(layout, execp->backend->text, strlen(execp->backend->text)); + else + pango_layout_set_markup(layout, execp->backend->text, strlen(execp->backend->text)); pango_cairo_update_layout(c, layout); draw_text(layout,@@ -295,7 +298,8 @@ panel->area.width,
execp->backend->text, strlen(execp->backend->text), PANGO_WRAP_WORD_CHAR, - PANGO_ELLIPSIZE_NONE); + PANGO_ELLIPSIZE_NONE, + execp->backend->has_markup); } else { get_text_size2(execp->backend->font_desc, &txt_height_ink,@@ -309,7 +313,8 @@ : execp->area.width - 2 * (horiz_padding + execp->area.bg->border.width),
execp->backend->text, strlen(execp->backend->text), PANGO_WRAP_WORD_CHAR, - PANGO_ELLIPSIZE_NONE); + PANGO_ELLIPSIZE_NONE, + execp->backend->has_markup); } gboolean result = FALSE;
M
src/execplugin/execplugin.h
→
src/execplugin/execplugin.h
@@ -32,6 +32,7 @@ gboolean centered;
PangoFontDescription *font_desc; Color font_color; int continuous; + gboolean has_markup; char *lclick_command; char *mclick_command; char *rclick_command;
M
src/taskbar/taskbar.c
→
src/taskbar/taskbar.c
@@ -255,7 +255,8 @@ panel->area.width,
"TAjpg", 5, PANGO_WRAP_WORD_CHAR, - PANGO_ELLIPSIZE_END); + PANGO_ELLIPSIZE_END, + FALSE); if (!panel->g_task.maximum_width && panel_horizontal) panel->g_task.maximum_width = server.monitor[panel->monitor].width;
M
src/taskbar/taskbarname.c
→
src/taskbar/taskbarname.c
@@ -152,7 +152,8 @@ panel->area.width,
taskbar_name->name, strlen(taskbar_name->name), PANGO_WRAP_WORD_CHAR, - PANGO_ELLIPSIZE_NONE); + PANGO_ELLIPSIZE_NONE, + FALSE); if (panel_horizontal) { int new_size = name_width + (2 * (taskbar_name->area.paddingxlr + taskbar_name->area.bg->border.width));
M
src/util/common.c
→
src/util/common.c
@@ -573,7 +573,8 @@ int panel_width,
char *text, int len, PangoWrapMode wrap, - PangoEllipsizeMode ellipsis) + PangoEllipsizeMode ellipsis, + gboolean markup) { PangoRectangle rect_ink, rect;@@ -588,7 +589,10 @@ pango_layout_set_height(layout, panel_height * PANGO_SCALE);
pango_layout_set_wrap(layout, wrap); pango_layout_set_ellipsize(layout, ellipsis); pango_layout_set_font_description(layout, font); - pango_layout_set_text(layout, text, len); + if (!markup) + pango_layout_set_text(layout, text, len); + else + pango_layout_set_markup(layout, text, len); pango_layout_get_pixel_extents(layout, &rect_ink, &rect); *height_ink = rect_ink.height;
M
src/util/common.h
→
src/util/common.h
@@ -87,7 +87,8 @@ int panel_with,
char *text, int len, PangoWrapMode wrap, - PangoEllipsizeMode ellipsis); + PangoEllipsizeMode ellipsis, + gboolean markup); void draw_text(PangoLayout *layout, cairo_t *c, int posx, int posy, Color *color, int font_shadow);