[metacity/cowbell] honour border-radius on frame



commit a2075f9d952ee0393cc98232d543c3927e9e4f68
Author: Thomas Thurman <tthurman gnome org>
Date:   Wed Oct 28 15:20:19 2009 -0400

    honour border-radius on frame

 src/ui/theme.c |   42 ++++++++++++++++++++++++++++++++++--------
 1 files changed, 34 insertions(+), 8 deletions(-)
---
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 4c280a0..6adac4d 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -1237,14 +1237,40 @@ meta_theme_calc_geometry (MetaTheme              *theme,
     }
 #endif
 
-  /****************************************************************/
-  /* Old code which needs replacing: */
-  
-  /* Rounded corners; need to pick these up from the CSS.  FIXME. */
-  fgeom->top_left_corner_rounded_radius = 5;
-  fgeom->top_right_corner_rounded_radius = 5;
-  fgeom->bottom_left_corner_rounded_radius = 5;
-  fgeom->bottom_right_corner_rounded_radius = 5;
+  /* Finally, pick up the rounded corners. */
+  {
+    double d;
+    int default_radius;
+    ccss_style_t *style = ccss_stylesheet_query (theme->stylesheet,
+                                                 (ccss_node_t*) &cowbell_nodes[CC_FRAME]);
+   
+    if (ccss_style_get_double (style, "border-radius", &d))
+      default_radius = (int) d;
+    else
+      default_radius = 0;
+    
+    if (ccss_style_get_double (style, "border-top-left-radius", &d))
+      fgeom->top_left_corner_rounded_radius = (int) d;
+    else
+      fgeom->top_left_corner_rounded_radius = default_radius;
+    
+    if (ccss_style_get_double (style, "border-top-right-radius", &d))
+      fgeom->top_right_corner_rounded_radius = (int) d;
+    else
+      fgeom->top_right_corner_rounded_radius = default_radius;
+    
+    if (ccss_style_get_double (style, "border-bottom-left-radius", &d))
+      fgeom->bottom_left_corner_rounded_radius = (int) d;
+    else
+      fgeom->bottom_left_corner_rounded_radius = default_radius;
+    
+    if (ccss_style_get_double (style, "border-bottom-right-radius", &d))
+      fgeom->bottom_right_corner_rounded_radius = (int) d;
+    else
+      fgeom->bottom_right_corner_rounded_radius = default_radius;
+
+  ccss_style_destroy (style);
+  }
 }
 
 /*



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