[metacity/cowbell] out params are optional and additive



commit b7b2a2be61d8e6e4caf1e90a2f71901971594eff
Author: Thomas Thurman <tthurman gnome org>
Date:   Mon Oct 19 14:34:18 2009 -0400

    out params are optional and additive

 src/ui/theme.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/ui/theme.c b/src/ui/theme.c
index d3ecfff..c7ee5eb 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -572,8 +572,10 @@ meta_theme_draw_frame_with_style (MetaTheme              *theme,
 }
 
 /**
- * Finds the size of the edges (optionally padding, borders, and margins) of
- * an element with a given CSS style.
+ * Finds the size of the edges (borders, margins, and optionally padding) of
+ * an element with a given CSS style.  Any of the out parameters can be NULL
+ * in order not to receive the value; if they are not, the answer will be
+ * added to the current value, rather than replacing it.
  *
  * \param style  The style.
  * \param ignore_padding  Whether to ignore padding in the calculation.
@@ -638,10 +640,10 @@ cowbell_get_edge_sizes (ccss_style_t *style,
 
   g_warning ("Results are: T=%f B=%f L=%f R=%f\n", results[0], results[1], results[2], results[3]);
 
-  *top = (int) results[0];
-  *bottom = (int) results[1];
-  *left = (int) results[2];
-  *right = (int) results[3];
+  if (top) *top += (int) results[0];
+  if (bottom) *bottom += (int) results[1];
+  if (left) *left += (int) results[2];
+  if (right) *right += (int) results[3];
 }
 
 /**
@@ -674,6 +676,11 @@ meta_theme_get_frame_borders (MetaTheme         *theme,
   /* stub */
   ccss_style_t *style;
 
+  *top_height = 0;
+  *bottom_height = 0;
+  *left_width = 0;
+  *right_width = 0;
+
   style = cowbell_get_current_style (theme, type, flags, CC_FRAME);
 
   cowbell_get_edge_sizes (style, TRUE,
@@ -720,6 +727,11 @@ meta_theme_calc_geometry (MetaTheme              *theme,
 
   style = cowbell_get_current_style (theme, type, flags, CC_FRAME);
 
+  fgeom->top_height = 0;
+  fgeom->bottom_height = 0;
+  fgeom->left_width = 0;
+  fgeom->right_width = 0;
+
   cowbell_get_edge_sizes (style,
                           TRUE,
                           &(fgeom->top_height),



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