[metacity/cowbell] make text centring/right-justifying actually work



commit e616621d384605d695c48d5fcb312753974c5e00
Author: Thomas Thurman <tthurman gnome org>
Date:   Tue Oct 27 17:41:43 2009 -0400

    make text centring/right-justifying actually work

 src/ui/theme.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 15f61d9..a9d4c59 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -466,6 +466,26 @@ meta_theme_draw_frame_with_style (MetaTheme              *theme,
                    fgeom.areas[CC_TITLE].x + fgeom.areas[CC_TITLE].left_edge,
                    fgeom.areas[CC_TITLE].y + fgeom.areas[CC_TITLE].top_edge);
 
+  pango_layout_set_width (title_layout, fgeom.areas[CC_TITLE].width);
+  pango_layout_set_height (title_layout, fgeom.areas[CC_TITLE].height);
+
+  switch (pango_layout_get_alignment (title_layout))
+    {
+    case PANGO_ALIGN_RIGHT:
+      cairo_translate (cr,
+                       fgeom.areas[CC_TITLE].width,
+                       0);
+      break;
+    case PANGO_ALIGN_CENTER:
+      cairo_translate (cr,
+                       fgeom.areas[CC_TITLE].width/2,
+                       0);
+      break;
+    default:
+      /* nothing */
+      break;
+    }
+
   pango_cairo_show_layout (cr, title_layout);
 
   cairo_destroy (cr);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]