]> Dogcows Code - chaz/openbox/blobdiff - render/font.c
popups fixes. if the text for the popup is empty now, there wont be extra padding...
[chaz/openbox] / render / font.c
index 8692a9d10dd195300d771e223d518a3ea3aba5c6..1ca1b768f703be12e7626bdc7aa4c7dbe4a19f87 100644 (file)
@@ -137,7 +137,7 @@ static void font_measure_full(const RrFont *f, const gchar *str,
     pango_layout_set_text(f->layout, str, -1);
     pango_layout_set_width(f->layout, -1);
     pango_layout_get_pixel_extents(f->layout, NULL, &rect);
-    *x = rect.width + ABS(shadow_x);
+    *x = rect.width + ABS(shadow_x) + 4 /* we put a 2 px edge on each side */;
     *y = rect.height + ABS(shadow_y);
 }
 
@@ -252,19 +252,17 @@ void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area)
     if (t->shortcut) {
         const gchar *c = t->string + t->shortcut_pos;
 
-        if (g_utf8_validate(c, -1, NULL)) {
-            t->font->shortcut_underline->start_index = t->shortcut_pos;
-            t->font->shortcut_underline->end_index = t->shortcut_pos +
-                (g_utf8_next_char(c) - c);
-
-            /* the attributes are owned by the layout.
-               re-add the attributes to the layout after changing the
-               start and end index */
-            attrlist = pango_layout_get_attributes(t->font->layout);
-            pango_attr_list_ref(attrlist);
-            pango_layout_set_attributes(t->font->layout, attrlist);
-            pango_attr_list_unref(attrlist);
-        }
+        t->font->shortcut_underline->start_index = t->shortcut_pos;
+        t->font->shortcut_underline->end_index = t->shortcut_pos +
+            (g_utf8_next_char(c) - c);
+
+        /* the attributes are owned by the layout.
+           re-add the attributes to the layout after changing the
+           start and end index */
+        attrlist = pango_layout_get_attributes(t->font->layout);
+        pango_attr_list_ref(attrlist);
+        pango_layout_set_attributes(t->font->layout, attrlist);
+        pango_attr_list_unref(attrlist);
     }
 
     /* layout_line() uses y to specify the baseline
This page took 0.020414 seconds and 4 git commands to generate.