summaryrefslogtreecommitdiffstats
path: root/wayland
diff options
context:
space:
mode:
authorLibravatar D.B <thejan.2009@gmail.com>2016-10-07 11:27:06 +0200
committerLibravatar D.B <thejan.2009@gmail.com>2016-10-07 11:27:06 +0200
commit6f2c39610e951b76ff3cc2796c7bd7d3df2d7ba7 (patch)
tree7fa83cd7b67b7ae3cece083580ac2d6035ae4acd /wayland
parentMerge pull request #934 from alkino/fix_click_title_bar (diff)
downloadsway-6f2c39610e951b76ff3cc2796c7bd7d3df2d7ba7.tar.gz
sway-6f2c39610e951b76ff3cc2796c7bd7d3df2d7ba7.tar.zst
sway-6f2c39610e951b76ff3cc2796c7bd7d3df2d7ba7.zip
parse pango markup in workspace names (and bugfix)
This change allows using numeric character references in workspace names - for example &#230; which stands for sharp s. A fix was necessary in get_pango_layout, since markup and parsed markup had different width.
Diffstat (limited to 'wayland')
-rw-r--r--wayland/pango.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/wayland/pango.c b/wayland/pango.c
index 38993243..5781541b 100644
--- a/wayland/pango.c
+++ b/wayland/pango.c
@@ -11,9 +11,10 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, const char *text
11 int32_t scale, bool markup) { 11 int32_t scale, bool markup) {
12 PangoLayout *layout = pango_cairo_create_layout(cairo); 12 PangoLayout *layout = pango_cairo_create_layout(cairo);
13 PangoAttrList *attrs = pango_attr_list_new(); 13 PangoAttrList *attrs = pango_attr_list_new();
14 char *buf = malloc(2048);
14 if (markup) { 15 if (markup) {
15 pango_parse_markup(text, -1, 0, &attrs, NULL, NULL, NULL); 16 pango_parse_markup(text, -1, 0, &attrs, &buf, NULL, NULL);
16 pango_layout_set_markup(layout, text, -1); 17 pango_layout_set_markup(layout, buf, -1);
17 } else { 18 } else {
18 pango_layout_set_text(layout, text, -1); 19 pango_layout_set_text(layout, text, -1);
19 } 20 }
@@ -24,6 +25,7 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const char *font, const char *text
24 pango_layout_set_attributes(layout, attrs); 25 pango_layout_set_attributes(layout, attrs);
25 pango_attr_list_unref(attrs); 26 pango_attr_list_unref(attrs);
26 pango_font_description_free(desc); 27 pango_font_description_free(desc);
28 free(buf);
27 return layout; 29 return layout;
28} 30}
29 31