Package: dunst
Version: 1.0.0-2
Followup-For: Bug #740823

I wrongly filed this fix under the wrong bug report before, sorry for the noise.

The problem is caused by pango not knowing the final layout width when 
rendering.
The attached patch fixes the problem.
--- dunst-1.0.0.Orig/x.c	2014-03-05 12:41:03.274349758 +0100
+++ dunst-1.0.0/x.c	2014-03-05 14:46:01.670678667 +0100
@@ -160,6 +160,17 @@
 
 }
 
+static void r_update_layouts_width(GSList *layouts, int width)
+{
+        width -= 2 * settings.h_padding;
+        width -= 2 * settings.frame_width;
+
+        for (GSList *iter = layouts; iter; iter = iter->next) {
+                colored_layout *cl = iter->data;
+                pango_layout_set_width(cl->l, width * PANGO_SCALE);
+        }
+}
+
 static void free_colored_layout(void *data)
 {
         colored_layout *cl = data;
@@ -379,6 +390,10 @@
         int width = dim.w;
         int height = dim.h;
 
+	if (have_dynamic_width() && settings.align != left) {
+                r_update_layouts_width(layouts, width);
+        }
+
         cairo_t *c;
         cairo_surface_t *image_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
         c = cairo_create(image_surface);

Reply via email to