[metacity/cowbell] max/min button widths



commit c981e806658e4302b23c190b7d42d59f4b3f5b15
Author: Thomas Thurman <tthurman gnome org>
Date:   Fri Oct 23 19:54:28 2009 -0400

    max/min button widths

 src/ui/theme.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/ui/theme.c b/src/ui/theme.c
index c536c91..5c97392 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -643,7 +643,9 @@ cowbell_get_button_width (MetaTheme              *theme,
   double width=0.0, height=0.0;
   ccss_style_t *style = cowbell_get_current_style (theme, type, flags, button);
   double aspect_ratio;
+  double result;
 
+  /* FIXME: maybe check these are ordered correctly */
   ccss_style_get_double (style, "min-width", &min_width);
   ccss_style_get_double (style, "max-width", &max_width);
 
@@ -676,7 +678,12 @@ cowbell_get_button_width (MetaTheme              *theme,
 
   /* FIXME honour min/max width */
 
-  return (int) (width / aspect_ratio);
+  result = width / aspect_ratio;
+
+  if (min_width!=0 && result<min_width) result = min_width;
+  if (max_width!=0 && result>max_width) result = max_width;
+
+  return (int) result;
 }
 
 void



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