[metacity/cowbell] added struct for calculations



commit f1227920e2371a80cfa62228f3849329acfd5178
Author: Thomas Thurman <tthurman gnome org>
Date:   Fri Oct 23 01:24:36 2009 -0400

    added struct for calculations

 src/ui/theme.c |   24 ++++++++++++++++++++++++
 src/ui/theme.h |    4 ++++
 2 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 4e0adc3..ba064ec 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -7,6 +7,25 @@
 #include <ccss-cairo/ccss-cairo.h>
 #include <gtk/gtk.h>
 
+struct _CowbellArea {
+  /**
+   * Sizes of padding (except for the frame) plus
+   * borders plus margins.
+   */
+  int top_edge;
+  int left_edge;
+  int bottom_edge;
+  int right_edge;
+
+  /**
+   * The position of the area.
+   */
+  int x;
+  int y;
+  int width;
+  int height;
+};
+
 struct _MetaTheme {
   ccss_grammar_t        *grammar;
   ccss_stylesheet_t	*stylesheet;
@@ -750,6 +769,11 @@ meta_theme_calc_geometry (MetaTheme              *theme,
 {
   /* stub */
 
+  /* FIXME FIXME FIXME */
+  /* This will cause leaks.  We must provide a constructor and destructor fn. */
+  g_free (fgeom->areas);
+  fgeom->areas = g_new0 (CowbellArea, CC_LAST);
+
   /* see if we can write meta_theme_calc_geometry in terms of
    * meta_theme_get_frame_borders
    */
diff --git a/src/ui/theme.h b/src/ui/theme.h
index 5f88830..8a98053 100644
--- a/src/ui/theme.h
+++ b/src/ui/theme.h
@@ -81,6 +81,8 @@ typedef struct
   GdkRectangle clickable;
 } MetaButtonSpace;
 
+typedef struct _CowbellArea CowbellArea;
+
 /**
  * Calculated actual geometry of the frame
  */
@@ -101,6 +103,8 @@ typedef struct
   int top_titlebar_edge;
   int bottom_titlebar_edge;
 
+  CowbellArea *areas;
+
   /* used for a memset hack */
 #define ADDRESS_OF_BUTTON_RECTS(fgeom) (((char*)(fgeom)) + G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
 #define LENGTH_OF_BUTTON_RECTS (G_STRUCT_OFFSET (MetaFrameGeometry, right_right_background) + sizeof (GdkRectangle) - G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))



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