[mutter] introspection: remove --allow-unprefixed



commit 52bc675fcb84219483d597e5c3bfd7102e108c46
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Mon Oct 18 14:34:14 2010 -0400

    introspection: remove --allow-unprefixed
    
    Remove --allow-unprefixed option to the scanner, and fix resulting
    problems:
    
     * theme.h and boxes.h are split into a main -header and a private
       header that includes stuff that is not generally useful and
       hard to introspect. Merge theme-parser.h into theme.h.
    
     * meta_display_get_atom() and meta_window_get_window_type_atom()
       are marked as (skip)
    
     * Fix annotation: (element-type Strut) => (element-type Meta.Strut)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=632494

 src/Makefile.am            |    6 +-
 src/core/boxes-private.h   |  220 ++++++++
 src/core/boxes.c           |    2 +-
 src/core/constraints.c     |    1 +
 src/core/display.c         |    7 +
 src/core/edge-resistance.c |    2 +-
 src/core/place.c           |    1 +
 src/core/testboxes.c       |    2 +-
 src/core/window.c          |   12 +
 src/core/workspace.c       |    3 +-
 src/include/boxes.h        |  189 -------
 src/ui/frames.h            |    2 +-
 src/ui/preview-widget.h    |    2 +-
 src/ui/theme-parser.c      |    2 +-
 src/ui/theme-parser.h      |   32 --
 src/ui/theme-private.h     | 1220 ++++++++++++++++++++++++++++++++++++++++++++
 src/ui/theme-viewer.c      |    1 -
 src/ui/theme.c             |    3 +-
 src/ui/theme.h             | 1192 +------------------------------------------
 src/ui/ui.c                |    2 +-
 20 files changed, 1477 insertions(+), 1424 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index b65ca12..0d966e0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,6 +23,7 @@ mutter_SOURCES= 				\
 	core/bell.c				\
 	core/bell.h				\
 	core/boxes.c				\
+	core/boxes-private.h			\
 	include/boxes.h				\
 	compositor/compositor.c			\
 	compositor/compositor-private.h		\
@@ -126,9 +127,9 @@ mutter_SOURCES= 				\
 	ui/tile-preview.c			\
 	include/tile-preview.h			\
 	ui/theme-parser.c			\
-	ui/theme-parser.h			\
 	ui/theme.c				\
 	ui/theme.h				\
+	ui/theme-private.h			\
 	ui/ui.c					\
 	include/all-keybindings.h               \
 	$(mutter_built_sources)
@@ -149,7 +150,6 @@ libmutter_private_la_SOURCES=			\
 	gdk2-drawing-utils.c			\
 	gdk2-drawing-utils.h			\
 	ui/theme-parser.c			\
-	ui/theme-parser.h			\
 	ui/theme.c				\
 	ui/theme.h
 
@@ -164,7 +164,6 @@ libmutterinclude_base_headers =		\
 	include/main.h				\
 	include/util.h				\
 	include/common.h			\
-	ui/theme-parser.h			\
 	ui/theme.h				\
 	include/prefs.h				\
 	include/window.h			\
@@ -226,7 +225,6 @@ Meta-$(api_version).gir: $(G_IR_SCANNER) mutter $(libmutterinclude_HEADERS) $(mu
 		--nsversion=$(api_version)		\
 		--warn-all				\
 		--warn-error				\
-		--accept-unprefixed			\
 		--include=GObject-2.0			\
 		--include=Gdk- GTK_API_VERSION@		\
 		--include=Gtk- GTK_API_VERSION@		\
diff --git a/src/core/boxes-private.h b/src/core/boxes-private.h
new file mode 100644
index 0000000..a185bf1
--- /dev/null
+++ b/src/core/boxes-private.h
@@ -0,0 +1,220 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/* Simple box operations */
+
+/* 
+ * Copyright (C) 2005, 2006 Elijah Newren
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef META_BOXES_PRIVATE_H
+#define META_BOXES_PRIVATE_H
+
+#include <glib-object.h>
+#include "common.h"
+#include "boxes.h"
+
+#define BOX_LEFT(box)    ((box).x)                /* Leftmost pixel of rect */
+#define BOX_RIGHT(box)   ((box).x + (box).width)  /* One pixel past right   */
+#define BOX_TOP(box)     ((box).y)                /* Topmost pixel of rect  */
+#define BOX_BOTTOM(box)  ((box).y + (box).height) /* One pixel past bottom  */
+
+typedef enum
+{
+  FIXED_DIRECTION_NONE = 0,
+  FIXED_DIRECTION_X    = 1 << 0,
+  FIXED_DIRECTION_Y    = 1 << 1,
+} FixedDirections;
+
+/* Output functions -- note that the output buffer had better be big enough:
+ *   rect_to_string:   RECT_LENGTH
+ *   region_to_string: (RECT_LENGTH+strlen(separator_string)) *
+ *                     g_list_length (region)
+ *   edge_to_string:   EDGE_LENGTH
+ *   edge_list_to_...: (EDGE_LENGTH+strlen(separator_string)) * 
+ *                     g_list_length (edge_list)
+ */
+#define RECT_LENGTH 27
+#define EDGE_LENGTH 37
+char* meta_rectangle_to_string        (const MetaRectangle *rect,
+                                       char                *output);
+char* meta_rectangle_region_to_string (GList               *region,
+                                       const char          *separator_string,
+                                       char                *output);
+char* meta_rectangle_edge_to_string   (const MetaEdge      *edge,
+                                       char                *output);
+char* meta_rectangle_edge_list_to_string (
+                                       GList               *edge_list,
+                                       const char          *separator_string,
+                                       char                *output);
+
+/* Resize old_rect to the given new_width and new_height, but store the
+ * result in rect.  NOTE THAT THIS IS RESIZE ONLY SO IT CANNOT BE USED FOR
+ * A MOVERESIZE OPERATION (that simplies the routine a little bit as it
+ * means there's no difference between NorthWestGravity and StaticGravity.
+ * Also, I lied a little bit--technically, you could use it in a MoveResize
+ * operation if you muck with old_rect just right).
+ */
+void meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
+                                         MetaRectangle       *rect,
+                                         int                  gravity,
+                                         int                  new_width,
+                                         int                  new_height);
+
+/* find a list of rectangles with the property that a window is contained
+ * in the given region if and only if it is contained in one of the
+ * rectangles in the list.
+ *
+ * In this case, the region is given by taking basic_rect, removing from
+ * it the intersections with all the rectangles in the all_struts list,
+ * then expanding all the rectangles in the resulting list by the given
+ * amounts on each side.
+ *
+ * See boxes.c for more details.
+ */
+GList*   meta_rectangle_get_minimal_spanning_set_for_region (
+                                         const MetaRectangle *basic_rect,
+                                         const GSList        *all_struts);
+
+/* Expand all rectangles in region by the given amount on each side */
+GList*   meta_rectangle_expand_region   (GList               *region,
+                                         const int            left_expand,
+                                         const int            right_expand,
+                                         const int            top_expand,
+                                         const int            bottom_expand);
+/* Same as for meta_rectangle_expand_region except that rectangles not at
+ * least min_x or min_y in size are not expanded in that direction
+ */
+GList*   meta_rectangle_expand_region_conditionally (
+                                         GList                *region,
+                                         const int            left_expand,
+                                         const int            right_expand,
+                                         const int            top_expand,
+                                         const int            bottom_expand,
+                                         const int            min_x,
+                                         const int            min_y);
+
+/* Expand rect in direction to the size of expand_to, and then clip out any
+ * overlapping struts oriented orthognal to the expansion direction.  (Think
+ * horizontal or vertical maximization)
+ */
+void     meta_rectangle_expand_to_avoiding_struts (
+                                         MetaRectangle       *rect,
+                                         const MetaRectangle *expand_to,
+                                         const MetaDirection  direction,
+                                         const GSList        *all_struts);
+
+/* Free the list created by
+ *   meta_rectangle_get_minimal_spanning_set_for_region()
+ * or
+ *   meta_rectangle_find_onscreen_edges ()
+ * or
+ *   meta_rectangle_find_nonintersected_monitor_edges()
+ */
+void     meta_rectangle_free_list_and_elements (GList *filled_list);
+
+/* could_fit_in_region determines whether one of the spanning_rects is
+ * big enough to contain rect.  contained_in_region checks whether one
+ * actually contains it.
+ */
+gboolean meta_rectangle_could_fit_in_region (
+                                         const GList         *spanning_rects,
+                                         const MetaRectangle *rect);
+gboolean meta_rectangle_contained_in_region (
+                                         const GList         *spanning_rects,
+                                         const MetaRectangle *rect);
+gboolean meta_rectangle_overlaps_with_region (
+                                         const GList         *spanning_rects,
+                                         const MetaRectangle *rect);
+
+/* Make the rectangle small enough to fit into one of the spanning_rects,
+ * but make it no smaller than min_size.
+ */
+void     meta_rectangle_clamp_to_fit_into_region (
+                                         const GList         *spanning_rects,
+                                         FixedDirections      fixed_directions,
+                                         MetaRectangle       *rect,
+                                         const MetaRectangle *min_size);
+
+/* Clip the rectangle so that it fits into one of the spanning_rects, assuming
+ * it overlaps with at least one of them
+ */
+void     meta_rectangle_clip_to_region  (const GList         *spanning_rects,
+                                         FixedDirections      fixed_directions,
+                                         MetaRectangle       *rect);
+
+/* Shove the rectangle into one of the spanning_rects, assuming it fits in
+ * one of them.
+ */
+void     meta_rectangle_shove_into_region(
+                                         const GList         *spanning_rects,
+                                         FixedDirections      fixed_directions,
+                                         MetaRectangle       *rect);
+
+/* Finds the point on the line connecting (x1,y1) to (x2,y2) which is closest
+ * to (px, py).  Useful for finding an optimal rectangle size when given a
+ * range between two sizes that are all candidates.
+ */
+void meta_rectangle_find_linepoint_closest_to_point (double x1,    double y1,
+                                                     double x2,    double y2,
+                                                     double px,    double py,
+                                                     double *valx, double *valy);
+
+/***************************************************************************/
+/*                                                                         */
+/* Switching gears to code for edges instead of just rectangles            */
+/*                                                                         */
+/***************************************************************************/
+
+/* Return whether an edge overlaps or is adjacent to the rectangle in the
+ * nonzero-width dimension of the edge.
+ */
+gboolean meta_rectangle_edge_aligns (const MetaRectangle *rect, 
+                                     const MetaEdge      *edge);
+
+/* Compare two edges, so that sorting functions can put a list of edges in
+ * canonical order.
+ */
+gint   meta_rectangle_edge_cmp (gconstpointer a, gconstpointer b);
+
+/* Compare two edges, so that sorting functions can put a list of edges in
+ * order.  This function doesn't separate left edges first, then right edges,
+ * etc., but rather compares only upon location.
+ */
+gint   meta_rectangle_edge_cmp_ignore_type (gconstpointer a, gconstpointer b);
+
+/* Removes an parts of edges in the given list that intersect any box in the
+ * given rectangle list.  Returns the result.
+ */
+GList* meta_rectangle_remove_intersections_with_boxes_from_edges (
+                                           GList *edges,
+                                           const GSList *rectangles);
+
+/* Finds all the edges of an onscreen region, returning a GList* of
+ * MetaEdgeRect's.
+ */
+GList* meta_rectangle_find_onscreen_edges (const MetaRectangle *basic_rect,
+                                           const GSList        *all_struts);
+
+/* Finds edges between adjacent monitors which are not covered by the given
+ * struts.
+ */
+GList* meta_rectangle_find_nonintersected_monitor_edges (
+                                           const GList         *monitor_rects,
+                                           const GSList        *all_struts);
+
+#endif /* META_BOXES_PRIVATE_H */
diff --git a/src/core/boxes.c b/src/core/boxes.c
index ecf6e47..a1528a2 100644
--- a/src/core/boxes.c
+++ b/src/core/boxes.c
@@ -26,7 +26,7 @@
  * 02111-1307, USA.
  */
 
-#include "boxes.h"
+#include "boxes-private.h"
 #include "util.h"
 #include <X11/Xutil.h>  /* Just for the definition of the various gravities */
 
diff --git a/src/core/constraints.c b/src/core/constraints.c
index 6cddb4d..d5d7353 100644
--- a/src/core/constraints.c
+++ b/src/core/constraints.c
@@ -24,6 +24,7 @@
  */
 
 #include <config.h>
+#include "boxes-private.h"
 #include "constraints.h"
 #include "workspace-private.h"
 #include "place.h"
diff --git a/src/core/display.c b/src/core/display.c
index c87bf11..6909c39 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -5491,6 +5491,13 @@ meta_display_get_shape_event_base (MetaDisplay *display)
 }
 #endif
 
+/**
+ * meta_display_get_atom: (skip)
+ *
+ * Gets up an X atom that Mutter prefetched at startup.
+ *
+ * Return value: the X atom corresponding to the given atom enumeration
+ */
 Atom meta_display_get_atom (MetaDisplay *display, MetaAtom meta_atom)
 {
   Atom *atoms = & display->atom_WM_PROTOCOLS;
diff --git a/src/core/edge-resistance.c b/src/core/edge-resistance.c
index 34be3bb..5972002 100644
--- a/src/core/edge-resistance.c
+++ b/src/core/edge-resistance.c
@@ -23,7 +23,7 @@
 
 #include <config.h>
 #include "edge-resistance.h"
-#include "boxes.h"
+#include "boxes-private.h"
 #include "display-private.h"
 #include "workspace-private.h"
 
diff --git a/src/core/place.c b/src/core/place.c
index 6edba53..9d7a9f2 100644
--- a/src/core/place.c
+++ b/src/core/place.c
@@ -26,6 +26,7 @@
 
 #include <config.h>
 
+#include "boxes-private.h"
 #include "place.h"
 #include "workspace.h"
 #include "prefs.h"
diff --git a/src/core/testboxes.c b/src/core/testboxes.c
index 596990b..128efac 100644
--- a/src/core/testboxes.c
+++ b/src/core/testboxes.c
@@ -21,7 +21,7 @@
  * 02111-1307, USA.
  */
 
-#include "boxes.h"
+#include "boxes-private.h"
 #include <glib.h>
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/src/core/window.c b/src/core/window.c
index 19a3f62..26942b6 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -26,6 +26,7 @@
 
 #include <config.h>
 #include "window-private.h"
+#include "boxes-private.h"
 #include "edge-resistance.h"
 #include "util.h"
 #include "frame-private.h"
@@ -9376,6 +9377,17 @@ meta_window_get_window_type (MetaWindow *window)
   return window->type;
 }
 
+/**
+ * meta_window_get_window_type_atom: (skip)
+ * @window: a #MetaWindow
+ *
+ * Gets the X atom from the _NET_WM_WINDOW_TYPE property used by the
+ * application to set the window type. (Note that this is constrained
+ * to be some value that Mutter recognizes - a completely unrecognized
+ * type atom will be returned as None.)
+ *
+ * Return value: the raw X atom for the window type, or None
+ */
 Atom
 meta_window_get_window_type_atom (MetaWindow *window)
 {
diff --git a/src/core/workspace.c b/src/core/workspace.c
index 70fdf4c..8ec9c76 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -26,6 +26,7 @@
 #include <config.h>
 #include "workspace.h"
 #include "workspace-private.h"
+#include "boxes-private.h"
 #include "errors.h"
 #include "prefs.h"
 
@@ -1048,7 +1049,7 @@ strut_lists_equal (GSList *l,
 /**
  * meta_workspace_set_builtin_struts:
  * @workspace: a #MetaWorkspace
- * @struts: (element-type Strut) (transfer none): list of #MetaStrut
+ * @struts: (element-type Meta.Strut) (transfer none): list of #MetaStrut
  *
  * Sets a list of struts that will be used in addition to the struts
  * of the windows in the workspace when computing the work area of
diff --git a/src/include/boxes.h b/src/include/boxes.h
index e38b546..3fabe2a 100644
--- a/src/include/boxes.h
+++ b/src/include/boxes.h
@@ -45,18 +45,6 @@ struct _MetaStrut
   MetaSide side;
 };
 
-#define BOX_LEFT(box)    ((box).x)                /* Leftmost pixel of rect */
-#define BOX_RIGHT(box)   ((box).x + (box).width)  /* One pixel past right   */
-#define BOX_TOP(box)     ((box).y)                /* Topmost pixel of rect  */
-#define BOX_BOTTOM(box)  ((box).y + (box).height) /* One pixel past bottom  */
-
-typedef enum
-{
-  FIXED_DIRECTION_NONE = 0,
-  FIXED_DIRECTION_X    = 1 << 0,
-  FIXED_DIRECTION_Y    = 1 << 1,
-} FixedDirections;
-
 typedef enum
 {
   META_EDGE_WINDOW,
@@ -77,28 +65,6 @@ GType meta_rectangle_get_type (void);
 MetaRectangle *meta_rectangle_copy (const MetaRectangle *rect);
 void           meta_rectangle_free (MetaRectangle       *rect);
 
-/* Output functions -- note that the output buffer had better be big enough:
- *   rect_to_string:   RECT_LENGTH
- *   region_to_string: (RECT_LENGTH+strlen(separator_string)) *
- *                     g_list_length (region)
- *   edge_to_string:   EDGE_LENGTH
- *   edge_list_to_...: (EDGE_LENGTH+strlen(separator_string)) * 
- *                     g_list_length (edge_list)
- */
-#define RECT_LENGTH 27
-#define EDGE_LENGTH 37
-char* meta_rectangle_to_string        (const MetaRectangle *rect,
-                                       char                *output);
-char* meta_rectangle_region_to_string (GList               *region,
-                                       const char          *separator_string,
-                                       char                *output);
-char* meta_rectangle_edge_to_string   (const MetaEdge      *edge,
-                                       char                *output);
-char* meta_rectangle_edge_list_to_string (
-                                       GList               *edge_list,
-                                       const char          *separator_string,
-                                       char                *output);
-
 /* Function to make initializing a rect with a single line of code easy */
 MetaRectangle                 meta_rect (int x, int y, int width, int height);
 
@@ -139,159 +105,4 @@ gboolean meta_rectangle_could_fit_rect  (const MetaRectangle *outer_rect,
 gboolean meta_rectangle_contains_rect   (const MetaRectangle *outer_rect,
                                          const MetaRectangle *inner_rect);
 
-/* Resize old_rect to the given new_width and new_height, but store the
- * result in rect.  NOTE THAT THIS IS RESIZE ONLY SO IT CANNOT BE USED FOR
- * A MOVERESIZE OPERATION (that simplies the routine a little bit as it
- * means there's no difference between NorthWestGravity and StaticGravity.
- * Also, I lied a little bit--technically, you could use it in a MoveResize
- * operation if you muck with old_rect just right).
- */
-void meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
-                                         MetaRectangle       *rect,
-                                         int                  gravity,
-                                         int                  new_width,
-                                         int                  new_height);
-
-/* find a list of rectangles with the property that a window is contained
- * in the given region if and only if it is contained in one of the
- * rectangles in the list.
- *
- * In this case, the region is given by taking basic_rect, removing from
- * it the intersections with all the rectangles in the all_struts list,
- * then expanding all the rectangles in the resulting list by the given
- * amounts on each side.
- *
- * See boxes.c for more details.
- */
-GList*   meta_rectangle_get_minimal_spanning_set_for_region (
-                                         const MetaRectangle *basic_rect,
-                                         const GSList        *all_struts);
-
-/* Expand all rectangles in region by the given amount on each side */
-GList*   meta_rectangle_expand_region   (GList               *region,
-                                         const int            left_expand,
-                                         const int            right_expand,
-                                         const int            top_expand,
-                                         const int            bottom_expand);
-/* Same as for meta_rectangle_expand_region except that rectangles not at
- * least min_x or min_y in size are not expanded in that direction
- */
-GList*   meta_rectangle_expand_region_conditionally (
-                                         GList                *region,
-                                         const int            left_expand,
-                                         const int            right_expand,
-                                         const int            top_expand,
-                                         const int            bottom_expand,
-                                         const int            min_x,
-                                         const int            min_y);
-
-/* Expand rect in direction to the size of expand_to, and then clip out any
- * overlapping struts oriented orthognal to the expansion direction.  (Think
- * horizontal or vertical maximization)
- */
-void     meta_rectangle_expand_to_avoiding_struts (
-                                         MetaRectangle       *rect,
-                                         const MetaRectangle *expand_to,
-                                         const MetaDirection  direction,
-                                         const GSList        *all_struts);
-
-/* Free the list created by
- *   meta_rectangle_get_minimal_spanning_set_for_region()
- * or
- *   meta_rectangle_find_onscreen_edges ()
- * or
- *   meta_rectangle_find_nonintersected_monitor_edges()
- */
-void     meta_rectangle_free_list_and_elements (GList *filled_list);
-
-/* could_fit_in_region determines whether one of the spanning_rects is
- * big enough to contain rect.  contained_in_region checks whether one
- * actually contains it.
- */
-gboolean meta_rectangle_could_fit_in_region (
-                                         const GList         *spanning_rects,
-                                         const MetaRectangle *rect);
-gboolean meta_rectangle_contained_in_region (
-                                         const GList         *spanning_rects,
-                                         const MetaRectangle *rect);
-gboolean meta_rectangle_overlaps_with_region (
-                                         const GList         *spanning_rects,
-                                         const MetaRectangle *rect);
-
-/* Make the rectangle small enough to fit into one of the spanning_rects,
- * but make it no smaller than min_size.
- */
-void     meta_rectangle_clamp_to_fit_into_region (
-                                         const GList         *spanning_rects,
-                                         FixedDirections      fixed_directions,
-                                         MetaRectangle       *rect,
-                                         const MetaRectangle *min_size);
-
-/* Clip the rectangle so that it fits into one of the spanning_rects, assuming
- * it overlaps with at least one of them
- */
-void     meta_rectangle_clip_to_region  (const GList         *spanning_rects,
-                                         FixedDirections      fixed_directions,
-                                         MetaRectangle       *rect);
-
-/* Shove the rectangle into one of the spanning_rects, assuming it fits in
- * one of them.
- */
-void     meta_rectangle_shove_into_region(
-                                         const GList         *spanning_rects,
-                                         FixedDirections      fixed_directions,
-                                         MetaRectangle       *rect);
-
-/* Finds the point on the line connecting (x1,y1) to (x2,y2) which is closest
- * to (px, py).  Useful for finding an optimal rectangle size when given a
- * range between two sizes that are all candidates.
- */
-void meta_rectangle_find_linepoint_closest_to_point (double x1,    double y1,
-                                                     double x2,    double y2,
-                                                     double px,    double py,
-                                                     double *valx, double *valy);
-
-/***************************************************************************/
-/*                                                                         */
-/* Switching gears to code for edges instead of just rectangles            */
-/*                                                                         */
-/***************************************************************************/
-
-/* Return whether an edge overlaps or is adjacent to the rectangle in the
- * nonzero-width dimension of the edge.
- */
-gboolean meta_rectangle_edge_aligns (const MetaRectangle *rect, 
-                                     const MetaEdge      *edge);
-
-/* Compare two edges, so that sorting functions can put a list of edges in
- * canonical order.
- */
-gint   meta_rectangle_edge_cmp (gconstpointer a, gconstpointer b);
-
-/* Compare two edges, so that sorting functions can put a list of edges in
- * order.  This function doesn't separate left edges first, then right edges,
- * etc., but rather compares only upon location.
- */
-gint   meta_rectangle_edge_cmp_ignore_type (gconstpointer a, gconstpointer b);
-
-/* Removes an parts of edges in the given list that intersect any box in the
- * given rectangle list.  Returns the result.
- */
-GList* meta_rectangle_remove_intersections_with_boxes_from_edges (
-                                           GList *edges,
-                                           const GSList *rectangles);
-
-/* Finds all the edges of an onscreen region, returning a GList* of
- * MetaEdgeRect's.
- */
-GList* meta_rectangle_find_onscreen_edges (const MetaRectangle *basic_rect,
-                                           const GSList        *all_struts);
-
-/* Finds edges between adjacent monitors which are not covered by the given
- * struts.
- */
-GList* meta_rectangle_find_nonintersected_monitor_edges (
-                                           const GList         *monitor_rects,
-                                           const GSList        *all_struts);
-
 #endif /* META_BOXES_H */
diff --git a/src/ui/frames.h b/src/ui/frames.h
index ad8d361..8889096 100644
--- a/src/ui/frames.h
+++ b/src/ui/frames.h
@@ -27,7 +27,7 @@
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
 #include "common.h"
-#include "theme.h"
+#include "theme-private.h"
 
 typedef enum
 {
diff --git a/src/ui/preview-widget.h b/src/ui/preview-widget.h
index 4d678e3..0faff98 100644
--- a/src/ui/preview-widget.h
+++ b/src/ui/preview-widget.h
@@ -23,7 +23,7 @@
 
 #include <config.h>
 
-#include "theme.h"
+#include "theme-private.h"
 #include <gtk/gtk.h>
 
 #ifndef META_PREVIEW_WIDGET_H
diff --git a/src/ui/theme-parser.c b/src/ui/theme-parser.c
index 5d1ae68..fc9a791 100644
--- a/src/ui/theme-parser.c
+++ b/src/ui/theme-parser.c
@@ -22,7 +22,7 @@
  */
 
 #include <config.h>
-#include "theme-parser.h"
+#include "theme-private.h"
 #include "util.h"
 #include <string.h>
 #include <stdlib.h>
diff --git a/src/ui/theme-private.h b/src/ui/theme-private.h
new file mode 100644
index 0000000..9c5f7d7
--- /dev/null
+++ b/src/ui/theme-private.h
@@ -0,0 +1,1220 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/* Metacity Theme Rendering */
+
+/* 
+ * Copyright (C) 2001 Havoc Pennington
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef META_THEME_PRIVATE_H
+#define META_THEME_PRIVATE_H
+
+#include "boxes.h"
+#include "gradient.h"
+#include "theme.h"
+#include "common.h"
+#include <gtk/gtk.h>
+
+/**
+ * MetaFrameStyle: (skip)
+ *
+ */
+typedef struct _MetaFrameStyle MetaFrameStyle;
+/**
+ * MetaFrameStyleSet: (skip)
+ *
+ */
+typedef struct _MetaFrameStyleSet MetaFrameStyleSet;
+/**
+ * MetaDrawOp: (skip)
+ *
+ */
+typedef struct _MetaDrawOp MetaDrawOp;
+/**
+ * MetaDrawOpList: (skip)
+ *
+ */
+typedef struct _MetaDrawOpList MetaDrawOpList;
+/**
+ * MetaGradientSpec: (skip)
+ *
+ */
+typedef struct _MetaGradientSpec MetaGradientSpec;
+/**
+ * MetaAlphaGradientSpec: (skip)
+ *
+ */
+typedef struct _MetaAlphaGradientSpec MetaAlphaGradientSpec; 
+/**
+ * MetaColorSpec: (skip)
+ *
+ */
+typedef struct _MetaColorSpec MetaColorSpec;
+/**
+ * MetaFrameLayout: (skip)
+ *
+ */
+typedef struct _MetaFrameLayout MetaFrameLayout;
+/**
+ * MetaButtonSpace: (skip)
+ *
+ */
+typedef struct _MetaButtonSpace MetaButtonSpace;
+/**
+ * MetaFrameGeometry: (skip)
+ *
+ */
+typedef struct _MetaFrameGeometry MetaFrameGeometry;
+
+/**
+ * MetaPositionExprEnv: (skip)
+ *
+ */
+typedef struct _MetaPositionExprEnv MetaPositionExprEnv;
+/**
+ * MetaDrawInfo: (skip)
+ *
+ */
+typedef struct _MetaDrawInfo MetaDrawInfo;
+
+#define META_THEME_ERROR (g_quark_from_static_string ("meta-theme-error"))
+
+typedef enum
+{
+  META_THEME_ERROR_FRAME_GEOMETRY,
+  META_THEME_ERROR_BAD_CHARACTER,
+  META_THEME_ERROR_BAD_PARENS,
+  META_THEME_ERROR_UNKNOWN_VARIABLE,
+  META_THEME_ERROR_DIVIDE_BY_ZERO,
+  META_THEME_ERROR_MOD_ON_FLOAT,
+  META_THEME_ERROR_FAILED
+} MetaThemeError;
+
+/**
+ * Whether a button's size is calculated from the area around it (aspect
+ * sizing) or is given as a fixed height and width in pixels (fixed sizing).
+ *
+ * \bug This could be done away with; see the comment at the top of
+ * MetaFrameLayout.
+ */
+typedef enum
+{
+  META_BUTTON_SIZING_ASPECT,
+  META_BUTTON_SIZING_FIXED,
+  META_BUTTON_SIZING_LAST
+} MetaButtonSizing;
+
+/**
+ * Various parameters used to calculate the geometry of a frame.
+ * They are used inside a MetaFrameStyle.
+ * This corresponds closely to the <frame_geometry> tag in a theme file.
+ *
+ * \bug button_sizing isn't really necessary, because we could easily say
+ * that if button_aspect is zero, the height and width are fixed values.
+ * This would also mean that MetaButtonSizing didn't need to exist, and
+ * save code.
+ **/
+struct _MetaFrameLayout
+{
+  /** Reference count. */
+  int refcount;
+  
+  /** Size of left side */
+  int left_width;
+  /** Size of right side */
+  int right_width;
+  /** Size of bottom side */
+  int bottom_height;
+  
+  /** Border of blue title region
+   * \bug (blue?!)
+   **/
+  GtkBorder title_border;
+
+  /** Extra height for inside of title region, above the font height */
+  int title_vertical_pad;
+  
+  /** Right indent of buttons from edges of frame */
+  int right_titlebar_edge;
+  /** Left indent of buttons from edges of frame */
+  int left_titlebar_edge;
+  
+  /**
+   * Sizing rule of buttons, either META_BUTTON_SIZING_ASPECT
+   * (in which case button_aspect will be honoured, and
+   * button_width and button_height set from it), or
+   * META_BUTTON_SIZING_FIXED (in which case we read the width
+   * and height directly).
+   */
+  MetaButtonSizing button_sizing;
+
+  /**
+   * Ratio of height/width. Honoured only if
+   * button_sizing==META_BUTTON_SIZING_ASPECT.
+   * Otherwise we figure out the height from the button_border.
+   */
+  double button_aspect;
+  
+  /** Width of a button; set even when we are using aspect sizing */
+  int button_width;
+
+  /** Height of a button; set even when we are using aspect sizing */
+  int button_height;
+
+  /** Space around buttons */
+  GtkBorder button_border;
+
+  /** scale factor for title text */
+  double title_scale;
+  
+  /** Whether title text will be displayed */
+  guint has_title : 1;
+
+  /** Whether we should hide the buttons */
+  guint hide_buttons : 1;
+
+  /** Radius of the top left-hand corner; 0 if not rounded */
+  guint top_left_corner_rounded_radius;
+  /** Radius of the top right-hand corner; 0 if not rounded */
+  guint top_right_corner_rounded_radius;
+  /** Radius of the bottom left-hand corner; 0 if not rounded */
+  guint bottom_left_corner_rounded_radius;
+  /** Radius of the bottom right-hand corner; 0 if not rounded */
+  guint bottom_right_corner_rounded_radius;
+};
+
+/**
+ * The computed size of a button (really just a way of tying its
+ * visible and clickable areas together).
+ * The reason for two different rectangles here is Fitts' law & maximized
+ * windows; see bug #97703 for more details.
+ */
+struct _MetaButtonSpace
+{
+  /** The screen area where the button's image is drawn */
+  GdkRectangle visible;
+  /** The screen area where the button can be activated by clicking */
+  GdkRectangle clickable;
+};
+
+/**
+ * Calculated actual geometry of the frame
+ */
+struct _MetaFrameGeometry
+{
+  int left_width;
+  int right_width;
+  int top_height;
+  int bottom_height;
+
+  int width;
+  int height;  
+
+  GdkRectangle title_rect;
+
+  int left_titlebar_edge;
+  int right_titlebar_edge;
+  int top_titlebar_edge;
+  int bottom_titlebar_edge;
+
+  /* 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))
+  
+  /* The button rects (if changed adjust memset hack) */
+  MetaButtonSpace close_rect;
+  MetaButtonSpace max_rect;
+  MetaButtonSpace min_rect;
+  MetaButtonSpace menu_rect;
+  MetaButtonSpace shade_rect;
+  MetaButtonSpace above_rect;
+  MetaButtonSpace stick_rect;
+  MetaButtonSpace unshade_rect;
+  MetaButtonSpace unabove_rect;
+  MetaButtonSpace unstick_rect;
+
+#define MAX_MIDDLE_BACKGROUNDS (MAX_BUTTONS_PER_CORNER - 2)
+  GdkRectangle left_left_background;
+  GdkRectangle left_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
+  GdkRectangle left_right_background;
+  GdkRectangle right_left_background;
+  GdkRectangle right_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
+  GdkRectangle right_right_background;
+  /* End of button rects (if changed adjust memset hack) */
+  
+  /* Round corners */
+  guint top_left_corner_rounded_radius;
+  guint top_right_corner_rounded_radius;
+  guint bottom_left_corner_rounded_radius;
+  guint bottom_right_corner_rounded_radius;
+};
+
+typedef enum
+{
+  META_IMAGE_FILL_SCALE, /* default, needs to be all-bits-zero for g_new0 */
+  META_IMAGE_FILL_TILE
+} MetaImageFillType;
+
+typedef enum
+{
+  META_COLOR_SPEC_BASIC,
+  META_COLOR_SPEC_GTK,
+  META_COLOR_SPEC_BLEND,
+  META_COLOR_SPEC_SHADE
+} MetaColorSpecType;
+
+typedef enum
+{
+  META_GTK_COLOR_FG,
+  META_GTK_COLOR_BG,
+  META_GTK_COLOR_LIGHT,
+  META_GTK_COLOR_DARK,
+  META_GTK_COLOR_MID,
+  META_GTK_COLOR_TEXT,
+  META_GTK_COLOR_BASE,
+  META_GTK_COLOR_TEXT_AA,
+  META_GTK_COLOR_LAST
+} MetaGtkColorComponent;
+
+struct _MetaColorSpec
+{
+  MetaColorSpecType type;
+  union
+  {
+    struct {
+      GdkColor color;
+    } basic;
+    struct {
+      MetaGtkColorComponent component;
+      GtkStateType state;
+    } gtk;
+    struct {
+      MetaColorSpec *foreground;
+      MetaColorSpec *background;
+      double alpha;
+
+      GdkColor color;
+    } blend;
+    struct {
+      MetaColorSpec *base;
+      double factor;
+
+      GdkColor color;
+    } shade;
+  } data;
+};
+
+struct _MetaGradientSpec
+{
+  MetaGradientType type;
+  GSList *color_specs;
+};
+
+struct _MetaAlphaGradientSpec
+{
+  MetaGradientType type;
+  unsigned char *alphas;
+  int n_alphas;
+};
+
+struct _MetaDrawInfo
+{
+  GdkPixbuf   *mini_icon;
+  GdkPixbuf   *icon;
+  PangoLayout *title_layout;
+  int title_layout_width;
+  int title_layout_height;
+  const MetaFrameGeometry *fgeom;
+};
+
+/**
+ * A drawing operation in our simple vector drawing language.
+ */
+typedef enum
+{
+  /** Basic drawing-- line */
+  META_DRAW_LINE,
+  /** Basic drawing-- rectangle */
+  META_DRAW_RECTANGLE,
+  /** Basic drawing-- arc */
+  META_DRAW_ARC,
+
+  /** Clip to a rectangle */
+  META_DRAW_CLIP,
+  
+  /* Texture thingies */
+
+  /** Just a filled rectangle with alpha */
+  META_DRAW_TINT,
+  META_DRAW_GRADIENT,
+  META_DRAW_IMAGE,
+  
+  /** GTK theme engine stuff */
+  META_DRAW_GTK_ARROW,
+  META_DRAW_GTK_BOX,
+  META_DRAW_GTK_VLINE,
+
+  /** App's window icon */
+  META_DRAW_ICON,
+  /** App's window title */
+  META_DRAW_TITLE,
+  /** a draw op list */
+  META_DRAW_OP_LIST,
+  /** tiled draw op list */
+  META_DRAW_TILE
+} MetaDrawType;
+
+typedef enum
+{
+  POS_TOKEN_INT,
+  POS_TOKEN_DOUBLE,
+  POS_TOKEN_OPERATOR,
+  POS_TOKEN_VARIABLE,
+  POS_TOKEN_OPEN_PAREN,
+  POS_TOKEN_CLOSE_PAREN
+} PosTokenType;
+
+typedef enum
+{
+  POS_OP_NONE,
+  POS_OP_ADD,
+  POS_OP_SUBTRACT,
+  POS_OP_MULTIPLY,
+  POS_OP_DIVIDE,
+  POS_OP_MOD,
+  POS_OP_MAX,
+  POS_OP_MIN
+} PosOperatorType;
+
+/**
+ * A token, as output by the tokeniser.
+ *
+ * \ingroup tokenizer
+ */
+typedef struct
+{
+  PosTokenType type;
+
+  union
+  {
+    struct {
+      int val;
+    } i;
+
+    struct {
+      double val;
+    } d;
+
+    struct {
+      PosOperatorType op;
+    } o;
+
+    struct {
+      char *name;
+      GQuark name_quark;
+    } v;
+
+  } d;
+} PosToken;
+
+/**
+ * MetaDrawSpec: (skip)
+ *
+ * A computed expression in our simple vector drawing language.
+ * While it appears to take the form of a tree, this is actually
+ * merely a list; concerns such as precedence of operators are
+ * currently recomputed on every recalculation.
+ *
+ * Created by meta_draw_spec_new(), destroyed by meta_draw_spec_free().
+ * pos_eval() fills this with ...FIXME. Are tokens a tree or a list?
+ * \ingroup parser
+ */
+typedef struct _MetaDrawSpec MetaDrawSpec;
+struct _MetaDrawSpec
+{
+  /**
+   * If this spec is constant, this is the value of the constant;
+   * otherwise it is zero.
+   */
+  int value;
+  
+  /** A list of tokens in the expression. */
+  PosToken *tokens;
+
+  /** How many tokens are in the tokens list. */
+  int n_tokens;
+
+  /** Does the expression contain any variables? */
+  gboolean constant : 1;
+};
+
+/**
+ * A single drawing operation in our simple vector drawing language.
+ */
+struct _MetaDrawOp
+{
+  MetaDrawType type;
+
+  /* Positions are strings because they can be expressions */
+  union
+  {
+    struct {
+      MetaColorSpec *color_spec;
+      int dash_on_length;
+      int dash_off_length;
+      int width;
+      MetaDrawSpec *x1;
+      MetaDrawSpec *y1;
+      MetaDrawSpec *x2;
+      MetaDrawSpec *y2;
+    } line;
+
+    struct {
+      MetaColorSpec *color_spec;
+      gboolean filled;
+      MetaDrawSpec *x;
+      MetaDrawSpec *y;
+      MetaDrawSpec *width;
+      MetaDrawSpec *height;
+    } rectangle;
+
+    struct {
+      MetaColorSpec *color_spec;
+      gboolean filled;
+      MetaDrawSpec *x;
+      MetaDrawSpec *y;
+      MetaDrawSpec *width;
+      MetaDrawSpec *height;
+      double start_angle;
+      double extent_angle;
+    } arc;
+
+    struct {
+      MetaDrawSpec *x;
+      MetaDrawSpec *y;
+      MetaDrawSpec *width;
+      MetaDrawSpec *height;
+    } clip;
+    
+    struct {
+      MetaColorSpec *color_spec;
+      MetaAlphaGradientSpec *alpha_spec;
+      MetaDrawSpec *x;
+      MetaDrawSpec *y;
+      MetaDrawSpec *width;
+      MetaDrawSpec *height;
+    } tint;
+
+    struct {
+      MetaGradientSpec *gradient_spec;
+      MetaAlphaGradientSpec *alpha_spec;
+      MetaDrawSpec *x;
+      MetaDrawSpec *y;
+      MetaDrawSpec *width;
+      MetaDrawSpec *height;
+    } gradient;
+
+    struct {
+      MetaColorSpec *colorize_spec;
+      MetaAlphaGradientSpec *alpha_spec;
+      GdkPixbuf *pixbuf;
+      MetaDrawSpec *x;
+      MetaDrawSpec *y;
+      MetaDrawSpec *width;
+      MetaDrawSpec *height;
+
+      guint32 colorize_cache_pixel;
+      GdkPixbuf *colorize_cache_pixbuf;
+      MetaImageFillType fill_type;
+      unsigned int vertical_stripes : 1;
+      unsigned int horizontal_stripes : 1;
+    } image;
+    
+    struct {
+      GtkStateType state;
+      GtkShadowType shadow;
+      GtkArrowType arrow;
+      gboolean filled;
+
+      MetaDrawSpec *x;
+      MetaDrawSpec *y;
+      MetaDrawSpec *width;
+      MetaDrawSpec *height;
+    } gtk_arrow;
+
+    struct {
+      GtkStateType state;
+      GtkShadowType shadow;
+      MetaDrawSpec *x;
+      MetaDrawSpec *y;
+      MetaDrawSpec *width;
+      MetaDrawSpec *height;
+    } gtk_box;
+
+    struct {
+      GtkStateType state;
+      MetaDrawSpec *x;
+      MetaDrawSpec *y1;
+      MetaDrawSpec *y2;  
+    } gtk_vline;
+
+    struct {
+      MetaAlphaGradientSpec *alpha_spec;
+      MetaDrawSpec *x;
+      MetaDrawSpec *y;
+      MetaDrawSpec *width;
+      MetaDrawSpec *height;
+      MetaImageFillType fill_type;
+    } icon;
+
+    struct {
+      MetaColorSpec *color_spec;
+      MetaDrawSpec *x;
+      MetaDrawSpec *y;
+      MetaDrawSpec *ellipsize_width;
+    } title;
+
+    struct {
+      MetaDrawOpList *op_list;
+      MetaDrawSpec *x;
+      MetaDrawSpec *y;
+      MetaDrawSpec *width;
+      MetaDrawSpec *height;
+    } op_list;
+
+    struct {
+      MetaDrawOpList *op_list;
+      MetaDrawSpec *x;
+      MetaDrawSpec *y;
+      MetaDrawSpec *width;
+      MetaDrawSpec *height;
+      MetaDrawSpec *tile_xoffset;
+      MetaDrawSpec *tile_yoffset;
+      MetaDrawSpec *tile_width;
+      MetaDrawSpec *tile_height;
+    } tile;
+    
+  } data;
+};
+
+/**
+ * A list of MetaDrawOp objects. Maintains a reference count.
+ * Grows as necessary and allows the allocation of unused spaces
+ * to keep reallocations to a minimum.
+ *
+ * \bug Do we really win anything from not using the equivalent
+ * GLib structures?
+ */
+struct _MetaDrawOpList
+{
+  int refcount;
+  MetaDrawOp **ops;
+  int n_ops;
+  int n_allocated;
+};
+
+typedef enum
+{
+  META_BUTTON_STATE_NORMAL,
+  META_BUTTON_STATE_PRESSED,
+  META_BUTTON_STATE_PRELIGHT,
+  META_BUTTON_STATE_LAST
+} MetaButtonState;
+
+typedef enum
+{
+  /* Ordered so that background is drawn first */
+  META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND,
+  META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND,
+  META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND,
+  META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND,
+  META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND,
+  META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND,
+  META_BUTTON_TYPE_CLOSE,
+  META_BUTTON_TYPE_MAXIMIZE,
+  META_BUTTON_TYPE_MINIMIZE,
+  META_BUTTON_TYPE_MENU,
+  META_BUTTON_TYPE_SHADE,
+  META_BUTTON_TYPE_ABOVE,
+  META_BUTTON_TYPE_STICK,
+  META_BUTTON_TYPE_UNSHADE,
+  META_BUTTON_TYPE_UNABOVE,
+  META_BUTTON_TYPE_UNSTICK,
+  META_BUTTON_TYPE_LAST
+} MetaButtonType;
+
+typedef enum
+{
+  META_MENU_ICON_TYPE_CLOSE,
+  META_MENU_ICON_TYPE_MAXIMIZE,
+  META_MENU_ICON_TYPE_UNMAXIMIZE,
+  META_MENU_ICON_TYPE_MINIMIZE,
+  META_MENU_ICON_TYPE_LAST
+} MetaMenuIconType;
+
+typedef enum
+{
+  /* Listed in the order in which the textures are drawn.
+   * (though this only matters for overlaps of course.)
+   * Buttons are drawn after the frame textures.
+   *
+   * On the corners, horizontal pieces are arbitrarily given the
+   * corner area:
+   *
+   *   =====                 |====
+   *   |                     |
+   *   |       rather than   |
+   *
+   */
+  
+  /* entire frame */
+  META_FRAME_PIECE_ENTIRE_BACKGROUND,
+  /* entire titlebar background */
+  META_FRAME_PIECE_TITLEBAR,
+  /* portion of the titlebar background inside the titlebar
+   * background edges
+   */
+  META_FRAME_PIECE_TITLEBAR_MIDDLE,
+  /* left end of titlebar */
+  META_FRAME_PIECE_LEFT_TITLEBAR_EDGE,
+  /* right end of titlebar */
+  META_FRAME_PIECE_RIGHT_TITLEBAR_EDGE,
+  /* top edge of titlebar */
+  META_FRAME_PIECE_TOP_TITLEBAR_EDGE,
+  /* bottom edge of titlebar */
+  META_FRAME_PIECE_BOTTOM_TITLEBAR_EDGE,
+  /* render over title background (text area) */
+  META_FRAME_PIECE_TITLE,
+  /* left edge of the frame */
+  META_FRAME_PIECE_LEFT_EDGE,
+  /* right edge of the frame */
+  META_FRAME_PIECE_RIGHT_EDGE,
+  /* bottom edge of the frame */
+  META_FRAME_PIECE_BOTTOM_EDGE,
+  /* place over entire frame, after drawing everything else */
+  META_FRAME_PIECE_OVERLAY,
+  /* Used to get size of the enum */
+  META_FRAME_PIECE_LAST
+} MetaFramePiece;
+
+#define N_GTK_STATES 5
+
+/**
+ * How to draw a frame in a particular state (say, a focussed, non-maximised,
+ * resizable frame). This corresponds closely to the <frame_style> tag
+ * in a theme file.
+ */
+struct _MetaFrameStyle
+{
+  /** Reference count. */
+  int refcount;
+  /**
+   * Parent style.
+   * Settings which are unspecified here will be taken from there.
+   */
+  MetaFrameStyle *parent;
+  /** Operations for drawing each kind of button in each state. */
+  MetaDrawOpList *buttons[META_BUTTON_TYPE_LAST][META_BUTTON_STATE_LAST];
+  /** Operations for drawing each piece of the frame. */
+  MetaDrawOpList *pieces[META_FRAME_PIECE_LAST];
+  /**
+   * Details such as the height and width of each edge, the corner rounding,
+   * and the aspect ratio of the buttons.
+   */
+  MetaFrameLayout *layout;
+  /**
+   * Background colour of the window. Only present in theme formats
+   * 2 and above. Can be NULL to use the standard GTK theme engine.
+   */
+  MetaColorSpec *window_background_color;
+  /**
+   * Transparency of the window background. 0=transparent; 255=opaque.
+   */
+  guint8 window_background_alpha;
+};
+
+/* Kinds of frame...
+ * 
+ *  normal ->   noresize / vert only / horz only / both
+ *              focused / unfocused
+ *  max    ->   focused / unfocused
+ *  shaded ->   focused / unfocused
+ *  max/shaded -> focused / unfocused
+ *
+ *  so 4 states with 8 sub-states in one, 2 sub-states in the other 3,
+ *  meaning 14 total
+ *
+ * 14 window states times 7 or 8 window types. Except some
+ * window types never get a frame so that narrows it down a bit.
+ * 
+ */
+typedef enum
+{
+  META_FRAME_STATE_NORMAL,
+  META_FRAME_STATE_MAXIMIZED,
+  META_FRAME_STATE_SHADED,
+  META_FRAME_STATE_MAXIMIZED_AND_SHADED,
+  META_FRAME_STATE_LAST
+} MetaFrameState;
+
+typedef enum
+{
+  META_FRAME_RESIZE_NONE,
+  META_FRAME_RESIZE_VERTICAL,
+  META_FRAME_RESIZE_HORIZONTAL,
+  META_FRAME_RESIZE_BOTH,
+  META_FRAME_RESIZE_LAST
+} MetaFrameResize;
+
+typedef enum
+{
+  META_FRAME_FOCUS_NO,
+  META_FRAME_FOCUS_YES,
+  META_FRAME_FOCUS_LAST
+} MetaFrameFocus;
+
+/**
+ * How to draw frames at different times: when it's maximised or not, shaded
+ * or not, when it's focussed or not, and (for non-maximised windows), when
+ * it can be horizontally or vertically resized, both, or neither.
+ * Not all window types actually get a frame.
+ *
+ * A theme contains one of these objects for each type of window (each
+ * MetaFrameType), that is, normal, dialogue (modal and non-modal), etc.
+ *
+ * This corresponds closely to the <frame_style_set> tag in a theme file.
+ */
+struct _MetaFrameStyleSet
+{
+  int refcount;
+  MetaFrameStyleSet *parent;
+  MetaFrameStyle *normal_styles[META_FRAME_RESIZE_LAST][META_FRAME_FOCUS_LAST];
+  MetaFrameStyle *maximized_styles[META_FRAME_FOCUS_LAST];
+  MetaFrameStyle *shaded_styles[META_FRAME_RESIZE_LAST][META_FRAME_FOCUS_LAST];
+  MetaFrameStyle *maximized_and_shaded_styles[META_FRAME_FOCUS_LAST];
+};
+
+/**
+ * A theme. This is a singleton class which groups all settings from a theme
+ * on disk together.
+ *
+ * \bug It is rather useless to keep the metadata fields in core, I think.
+ */
+struct _MetaTheme
+{
+  /** Name of the theme (on disk), e.g. "Crux" */
+  char *name;
+  /** Path to the files associated with the theme */
+  char *dirname;
+  /**
+   * Filename of the XML theme file.
+   * \bug Kept lying around for no discernable reason.
+   */
+  char *filename;
+  /** Metadata: Human-readable name of the theme. */
+  char *readable_name;
+  /** Metadata: Author of the theme. */
+  char *author;
+  /** Metadata: Copyright holder. */
+  char *copyright;
+  /** Metadata: Date of the theme. */
+  char *date;
+  /** Metadata: Description of the theme. */
+  char *description;
+  /** Version of the theme format. Older versions cannot use the features
+   * of newer versions even if they think they can (this is to allow forward
+   * and backward compatibility.
+   */
+  guint format_version;
+
+  /** Symbol table of integer constants. */
+  GHashTable *integer_constants;
+  /** Symbol table of float constants. */
+  GHashTable *float_constants;
+  /**
+   * Symbol table of colour constants (hex triples, and triples
+   * plus alpha).
+   * */
+  GHashTable *color_constants;
+  GHashTable *images_by_filename;
+  GHashTable *layouts_by_name;
+  GHashTable *draw_op_lists_by_name;
+  GHashTable *styles_by_name;
+  GHashTable *style_sets_by_name;
+  MetaFrameStyleSet *style_sets_by_type[META_FRAME_TYPE_LAST];
+
+  GQuark quark_width;
+  GQuark quark_height;
+  GQuark quark_object_width;
+  GQuark quark_object_height;
+  GQuark quark_left_width;
+  GQuark quark_right_width;
+  GQuark quark_top_height;
+  GQuark quark_bottom_height;
+  GQuark quark_mini_icon_width;
+  GQuark quark_mini_icon_height;
+  GQuark quark_icon_width;
+  GQuark quark_icon_height;
+  GQuark quark_title_width;
+  GQuark quark_title_height;
+  GQuark quark_frame_x_center;
+  GQuark quark_frame_y_center;
+};
+
+struct _MetaPositionExprEnv
+{
+  MetaRectangle rect;
+  /* size of an object being drawn, if it has a natural size */
+  int object_width;
+  int object_height;
+  /* global object sizes, always available */
+  int left_width;
+  int right_width;
+  int top_height;
+  int bottom_height;
+  int title_width;
+  int title_height;
+  int frame_x_center;
+  int frame_y_center;
+  int mini_icon_width;
+  int mini_icon_height;
+  int icon_width;
+  int icon_height;
+  /* Theme so we can look up constants */
+  MetaTheme *theme;
+};
+
+MetaFrameLayout* meta_frame_layout_new           (void);
+MetaFrameLayout* meta_frame_layout_copy          (const MetaFrameLayout *src);
+void             meta_frame_layout_ref           (MetaFrameLayout       *layout);
+void             meta_frame_layout_unref         (MetaFrameLayout       *layout);
+void             meta_frame_layout_get_borders   (const MetaFrameLayout *layout,
+                                                  int                    text_height,
+                                                  MetaFrameFlags         flags,
+                                                  int                   *top_height,
+                                                  int                   *bottom_height,
+                                                  int                   *left_width,
+                                                  int                   *right_width);
+void             meta_frame_layout_calc_geometry (const MetaFrameLayout  *layout,
+                                                  int                     text_height,
+                                                  MetaFrameFlags          flags,
+                                                  int                     client_width,
+                                                  int                     client_height,
+                                                  const MetaButtonLayout *button_layout,
+                                                  MetaFrameGeometry      *fgeom,
+                                                  MetaTheme              *theme);
+
+gboolean         meta_frame_layout_validate      (const MetaFrameLayout *layout,
+                                                  GError               **error);
+
+gboolean meta_parse_position_expression (MetaDrawSpec               *spec,
+                                         const MetaPositionExprEnv  *env,
+                                         int                        *x_return,
+                                         int                        *y_return,
+                                         GError                    **err);
+gboolean meta_parse_size_expression     (MetaDrawSpec               *spec,
+                                         const MetaPositionExprEnv  *env,
+                                         int                        *val_return,
+                                         GError                    **err);
+
+MetaDrawSpec* meta_draw_spec_new (MetaTheme  *theme,
+                                  const char *expr,
+                                  GError    **error);
+void          meta_draw_spec_free (MetaDrawSpec *spec);
+
+MetaColorSpec* meta_color_spec_new             (MetaColorSpecType  type);
+MetaColorSpec* meta_color_spec_new_from_string (const char        *str,
+                                                GError           **err);
+MetaColorSpec* meta_color_spec_new_gtk         (MetaGtkColorComponent component,
+                                                GtkStateType          state);
+void           meta_color_spec_free            (MetaColorSpec     *spec);
+void           meta_color_spec_render          (MetaColorSpec     *spec,
+                                                GtkWidget         *widget,
+                                                GdkColor          *color);
+
+
+MetaDrawOp*    meta_draw_op_new  (MetaDrawType        type);
+void           meta_draw_op_free (MetaDrawOp          *op);
+void           meta_draw_op_draw (const MetaDrawOp    *op,
+                                  GtkWidget           *widget,
+                                  cairo_t             *cr,
+                                  const MetaDrawInfo  *info,
+                                  /* logical region being drawn */
+                                  MetaRectangle        logical_region);
+
+void           meta_draw_op_draw_with_style (const MetaDrawOp    *op,
+                                             GtkStyle            *style_gtk,
+                                             GtkWidget           *widget,
+                                             cairo_t             *cr,
+                                             const MetaDrawInfo  *info,
+                                             /* logical region being drawn */
+                                             MetaRectangle        logical_region);
+
+MetaDrawOpList* meta_draw_op_list_new   (int                   n_preallocs);
+void            meta_draw_op_list_ref   (MetaDrawOpList       *op_list);
+void            meta_draw_op_list_unref (MetaDrawOpList       *op_list);
+void            meta_draw_op_list_draw  (const MetaDrawOpList *op_list,
+                                         GtkWidget            *widget,
+                                         cairo_t              *cr,
+                                         const MetaDrawInfo   *info,
+                                         MetaRectangle         rect);
+void            meta_draw_op_list_draw_with_style  (const MetaDrawOpList *op_list,
+                                                    GtkStyle             *style_gtk,
+                                                    GtkWidget            *widget,
+                                                    cairo_t              *cr,
+                                                    const MetaDrawInfo   *info,
+                                                    MetaRectangle         rect);
+void           meta_draw_op_list_append (MetaDrawOpList       *op_list,
+                                         MetaDrawOp           *op);
+gboolean       meta_draw_op_list_validate (MetaDrawOpList    *op_list,
+                                           GError           **error);
+gboolean       meta_draw_op_list_contains (MetaDrawOpList    *op_list,
+                                           MetaDrawOpList    *child);
+
+MetaGradientSpec* meta_gradient_spec_new    (MetaGradientType        type);
+void              meta_gradient_spec_free   (MetaGradientSpec       *desc);
+GdkPixbuf*        meta_gradient_spec_render (const MetaGradientSpec *desc,
+                                             GtkWidget              *widget,
+                                             int                     width,
+                                             int                     height);
+gboolean          meta_gradient_spec_validate (MetaGradientSpec     *spec,
+                                               GError              **error);
+
+MetaAlphaGradientSpec* meta_alpha_gradient_spec_new  (MetaGradientType       type,
+                                                      int                    n_alphas);
+void                   meta_alpha_gradient_spec_free (MetaAlphaGradientSpec *spec);
+
+
+MetaFrameStyle* meta_frame_style_new   (MetaFrameStyle *parent);
+void            meta_frame_style_ref   (MetaFrameStyle *style);
+void            meta_frame_style_unref (MetaFrameStyle *style);
+
+void meta_frame_style_draw (MetaFrameStyle          *style,
+                            GtkWidget               *widget,
+                            cairo_t                 *cr,
+                            const MetaFrameGeometry *fgeom,
+                            int                      client_width,
+                            int                      client_height,
+                            PangoLayout             *title_layout,
+                            int                      text_height,
+                            MetaButtonState          button_states[META_BUTTON_TYPE_LAST],
+                            GdkPixbuf               *mini_icon,
+                            GdkPixbuf               *icon);
+
+
+void meta_frame_style_draw_with_style (MetaFrameStyle          *style,
+                                       GtkStyle                *style_gtk,
+                                       GtkWidget               *widget,
+                                       cairo_t                 *cr,
+                                       const MetaFrameGeometry *fgeom,
+                                       int                      client_width,
+                                       int                      client_height,
+                                       PangoLayout             *title_layout,
+                                       int                      text_height,
+                                       MetaButtonState          button_states[META_BUTTON_TYPE_LAST],
+                                       GdkPixbuf               *mini_icon,
+                                       GdkPixbuf               *icon);
+
+
+gboolean       meta_frame_style_validate (MetaFrameStyle    *style,
+                                          guint              current_theme_version,
+                                          GError           **error);
+
+MetaFrameStyleSet* meta_frame_style_set_new   (MetaFrameStyleSet *parent);
+void               meta_frame_style_set_ref   (MetaFrameStyleSet *style_set);
+void               meta_frame_style_set_unref (MetaFrameStyleSet *style_set);
+
+gboolean       meta_frame_style_set_validate  (MetaFrameStyleSet *style_set,
+                                               GError           **error);
+
+GdkPixbuf* meta_theme_load_image (MetaTheme  *theme,
+                                  const char *filename,
+                                  guint       size_of_theme_icons,
+                                  GError    **error);
+
+MetaFrameStyle* meta_theme_get_frame_style (MetaTheme     *theme,
+                                            MetaFrameType  type,
+                                            MetaFrameFlags flags);
+
+double meta_theme_get_title_scale (MetaTheme     *theme,
+                                   MetaFrameType  type,
+                                   MetaFrameFlags flags);
+
+void meta_theme_draw_frame (MetaTheme              *theme,
+                            GtkWidget              *widget,
+                            cairo_t                *cr,
+                            MetaFrameType           type,
+                            MetaFrameFlags          flags,
+                            int                     client_width,
+                            int                     client_height,
+                            PangoLayout            *title_layout,
+                            int                     text_height,
+                            const MetaButtonLayout *button_layout,
+                            MetaButtonState         button_states[META_BUTTON_TYPE_LAST],
+                            GdkPixbuf              *mini_icon,
+                            GdkPixbuf              *icon);
+
+void meta_theme_draw_frame_by_name (MetaTheme              *theme,
+                                    GtkWidget              *widget,
+                                    cairo_t                *cr,
+                                    const gchar             *style_name,
+                                    MetaFrameFlags          flags,
+                                    int                     client_width,
+                                    int                     client_height,
+                                    PangoLayout            *title_layout,
+                                    int                     text_height,
+                                    const MetaButtonLayout *button_layout,
+                                    MetaButtonState         button_states[META_BUTTON_TYPE_LAST],
+                                    GdkPixbuf              *mini_icon,
+                                    GdkPixbuf              *icon);
+
+void meta_theme_draw_frame_with_style (MetaTheme              *theme,
+                                       GtkStyle               *style_gtk,
+                                       GtkWidget              *widget,
+                                       cairo_t                *cr,
+                                       MetaFrameType           type,
+                                       MetaFrameFlags          flags,
+                                       int                     client_width,
+                                       int                     client_height,
+                                       PangoLayout            *title_layout,
+                                       int                     text_height,
+                                       const MetaButtonLayout *button_layout,
+                                       MetaButtonState         button_states[META_BUTTON_TYPE_LAST],
+                                       GdkPixbuf              *mini_icon,
+                                       GdkPixbuf              *icon);
+
+void meta_theme_get_frame_borders (MetaTheme         *theme,
+                                   MetaFrameType      type,
+                                   int                text_height,
+                                   MetaFrameFlags     flags,
+                                   int               *top_height,
+                                   int               *bottom_height,
+                                   int               *left_width,
+                                   int               *right_width);
+void meta_theme_calc_geometry (MetaTheme              *theme,
+                               MetaFrameType           type,
+                               int                     text_height,
+                               MetaFrameFlags          flags,
+                               int                     client_width,
+                               int                     client_height,
+                               const MetaButtonLayout *button_layout,
+                               MetaFrameGeometry      *fgeom);
+                                   
+MetaFrameLayout*   meta_theme_lookup_layout       (MetaTheme         *theme,
+                                                   const char        *name);
+void               meta_theme_insert_layout       (MetaTheme         *theme,
+                                                   const char        *name,
+                                                   MetaFrameLayout   *layout);
+MetaDrawOpList*    meta_theme_lookup_draw_op_list (MetaTheme         *theme,
+                                                   const char        *name);
+void               meta_theme_insert_draw_op_list (MetaTheme         *theme,
+                                                   const char        *name,
+                                                   MetaDrawOpList    *op_list);
+MetaFrameStyle*    meta_theme_lookup_style        (MetaTheme         *theme,
+                                                   const char        *name);
+void               meta_theme_insert_style        (MetaTheme         *theme,
+                                                   const char        *name,
+                                                   MetaFrameStyle    *style);
+MetaFrameStyleSet* meta_theme_lookup_style_set    (MetaTheme         *theme,
+                                                   const char        *name);
+void               meta_theme_insert_style_set    (MetaTheme         *theme,
+                                                   const char        *name,
+                                                   MetaFrameStyleSet *style_set);
+gboolean meta_theme_define_int_constant   (MetaTheme   *theme,
+                                           const char  *name,
+                                           int          value,
+                                           GError     **error);
+gboolean meta_theme_lookup_int_constant   (MetaTheme   *theme,
+                                           const char  *name,
+                                           int         *value);
+gboolean meta_theme_define_float_constant (MetaTheme   *theme,
+                                           const char  *name,
+                                           double       value,
+                                           GError     **error);
+gboolean meta_theme_lookup_float_constant (MetaTheme   *theme,
+                                           const char  *name,
+                                           double      *value);
+
+gboolean meta_theme_define_color_constant (MetaTheme   *theme,
+                                           const char  *name,
+                                           const char  *value,
+                                           GError     **error);
+gboolean meta_theme_lookup_color_constant (MetaTheme   *theme,
+                                           const char  *name,
+                                           char       **value);
+
+gboolean     meta_theme_replace_constants     (MetaTheme    *theme,
+                                               PosToken     *tokens,
+                                               int           n_tokens,
+                                               GError      **err);
+
+/* random stuff */
+
+PangoFontDescription* meta_gtk_widget_get_font_desc        (GtkWidget            *widget,
+                                                            double                scale,
+							    const PangoFontDescription *override);
+int                   meta_pango_font_desc_get_text_height (const PangoFontDescription *font_desc,
+                                                            PangoContext         *context);
+
+
+/* Enum converters */
+MetaGtkColorComponent meta_color_component_from_string (const char            *str);
+const char*           meta_color_component_to_string   (MetaGtkColorComponent  component);
+MetaButtonState       meta_button_state_from_string    (const char            *str);
+const char*           meta_button_state_to_string      (MetaButtonState        state);
+MetaButtonType        meta_button_type_from_string     (const char            *str,
+                                                        MetaTheme             *theme);
+const char*           meta_button_type_to_string       (MetaButtonType         type);
+MetaFramePiece        meta_frame_piece_from_string     (const char            *str);
+const char*           meta_frame_piece_to_string       (MetaFramePiece         piece);
+MetaFrameState        meta_frame_state_from_string     (const char            *str);
+const char*           meta_frame_state_to_string       (MetaFrameState         state);
+MetaFrameResize       meta_frame_resize_from_string    (const char            *str);
+const char*           meta_frame_resize_to_string      (MetaFrameResize        resize);
+MetaFrameFocus        meta_frame_focus_from_string     (const char            *str);
+const char*           meta_frame_focus_to_string       (MetaFrameFocus         focus);
+MetaFrameType         meta_frame_type_from_string      (const char            *str);
+const char*           meta_frame_type_to_string        (MetaFrameType          type);
+MetaGradientType      meta_gradient_type_from_string   (const char            *str);
+const char*           meta_gradient_type_to_string     (MetaGradientType       type);
+GtkStateType          meta_gtk_state_from_string       (const char            *str);
+const char*           meta_gtk_state_to_string         (GtkStateType           state);
+GtkShadowType         meta_gtk_shadow_from_string      (const char            *str);
+const char*           meta_gtk_shadow_to_string        (GtkShadowType          shadow);
+GtkArrowType          meta_gtk_arrow_from_string       (const char            *str);
+const char*           meta_gtk_arrow_to_string         (GtkArrowType           arrow);
+MetaImageFillType     meta_image_fill_type_from_string (const char            *str);
+const char*           meta_image_fill_type_to_string   (MetaImageFillType      fill_type);
+
+guint meta_theme_earliest_version_with_button (MetaButtonType type);
+
+
+#define META_THEME_ALLOWS(theme, feature) (theme->format_version >= feature)
+
+/* What version of the theme file format were various features introduced in? */
+#define META_THEME_SHADE_STICK_ABOVE_BUTTONS 2
+#define META_THEME_UBIQUITOUS_CONSTANTS 2
+#define META_THEME_VARIED_ROUND_CORNERS 2
+#define META_THEME_IMAGES_FROM_ICON_THEMES 2
+#define META_THEME_UNRESIZABLE_SHADED_STYLES 2
+#define META_THEME_DEGREES_IN_ARCS 2
+#define META_THEME_HIDDEN_BUTTONS 2
+#define META_THEME_COLOR_CONSTANTS 2
+#define META_THEME_FRAME_BACKGROUNDS 2
+
+#endif /* META_THEME_PRIVATE_H */
diff --git a/src/ui/theme-viewer.c b/src/ui/theme-viewer.c
index 4e6fe3e..86fa344 100644
--- a/src/ui/theme-viewer.c
+++ b/src/ui/theme-viewer.c
@@ -24,7 +24,6 @@
 #include <config.h>
 #include "util.h"
 #include "theme.h"
-#include "theme-parser.h"
 #include "preview-widget.h"
 #include <gtk/gtk.h>
 #include <time.h>
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 082a454..6514882 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -53,8 +53,7 @@
  */
 
 #include <config.h>
-#include "theme.h"
-#include "theme-parser.h"
+#include "theme-private.h"
 #include "util.h"
 #include "gradient.h"
 #include <gtk/gtk.h>
diff --git a/src/ui/theme.h b/src/ui/theme.h
index af1f832..a6aa5d8 100644
--- a/src/ui/theme.h
+++ b/src/ui/theme.h
@@ -24,1026 +24,13 @@
 #ifndef META_THEME_H
 #define META_THEME_H
 
-#include "boxes.h"
-#include "gradient.h"
-#include "common.h"
-#include <gtk/gtk.h>
+#include <glib.h>
 
 /**
- * MetaFrameStyle: (skip)
- *
- */
-typedef struct _MetaFrameStyle MetaFrameStyle;
-/**
- * MetaFrameStyleSet: (skip)
- *
- */
-typedef struct _MetaFrameStyleSet MetaFrameStyleSet;
-/**
- * MetaDrawOp: (skip)
- *
- */
-typedef struct _MetaDrawOp MetaDrawOp;
-/**
- * MetaDrawOpList: (skip)
- *
- */
-typedef struct _MetaDrawOpList MetaDrawOpList;
-/**
- * MetaGradientSpec: (skip)
- *
- */
-typedef struct _MetaGradientSpec MetaGradientSpec;
-/**
- * MetaAlphaGradientSpec: (skip)
- *
- */
-typedef struct _MetaAlphaGradientSpec MetaAlphaGradientSpec; 
-/**
- * MetaColorSpec: (skip)
- *
- */
-typedef struct _MetaColorSpec MetaColorSpec;
-/**
- * MetaFrameLayout: (skip)
- *
- */
-typedef struct _MetaFrameLayout MetaFrameLayout;
-/**
- * MetaButtonSpace: (skip)
- *
- */
-typedef struct _MetaButtonSpace MetaButtonSpace;
-/**
- * MetaFrameGeometry: (skip)
- *
- */
-typedef struct _MetaFrameGeometry MetaFrameGeometry;
-/**
- * MetaTheme: (skip)
+ * MetaTheme:
  *
  */
 typedef struct _MetaTheme MetaTheme;
-/**
- * MetaPositionExprEnv: (skip)
- *
- */
-typedef struct _MetaPositionExprEnv MetaPositionExprEnv;
-/**
- * MetaDrawInfo: (skip)
- *
- */
-typedef struct _MetaDrawInfo MetaDrawInfo;
-
-#define META_THEME_ERROR (g_quark_from_static_string ("meta-theme-error"))
-
-typedef enum
-{
-  META_THEME_ERROR_FRAME_GEOMETRY,
-  META_THEME_ERROR_BAD_CHARACTER,
-  META_THEME_ERROR_BAD_PARENS,
-  META_THEME_ERROR_UNKNOWN_VARIABLE,
-  META_THEME_ERROR_DIVIDE_BY_ZERO,
-  META_THEME_ERROR_MOD_ON_FLOAT,
-  META_THEME_ERROR_FAILED
-} MetaThemeError;
-
-/**
- * Whether a button's size is calculated from the area around it (aspect
- * sizing) or is given as a fixed height and width in pixels (fixed sizing).
- *
- * \bug This could be done away with; see the comment at the top of
- * MetaFrameLayout.
- */
-typedef enum
-{
-  META_BUTTON_SIZING_ASPECT,
-  META_BUTTON_SIZING_FIXED,
-  META_BUTTON_SIZING_LAST
-} MetaButtonSizing;
-
-/**
- * Various parameters used to calculate the geometry of a frame.
- * They are used inside a MetaFrameStyle.
- * This corresponds closely to the <frame_geometry> tag in a theme file.
- *
- * \bug button_sizing isn't really necessary, because we could easily say
- * that if button_aspect is zero, the height and width are fixed values.
- * This would also mean that MetaButtonSizing didn't need to exist, and
- * save code.
- **/
-struct _MetaFrameLayout
-{
-  /** Reference count. */
-  int refcount;
-  
-  /** Size of left side */
-  int left_width;
-  /** Size of right side */
-  int right_width;
-  /** Size of bottom side */
-  int bottom_height;
-  
-  /** Border of blue title region
-   * \bug (blue?!)
-   **/
-  GtkBorder title_border;
-
-  /** Extra height for inside of title region, above the font height */
-  int title_vertical_pad;
-  
-  /** Right indent of buttons from edges of frame */
-  int right_titlebar_edge;
-  /** Left indent of buttons from edges of frame */
-  int left_titlebar_edge;
-  
-  /**
-   * Sizing rule of buttons, either META_BUTTON_SIZING_ASPECT
-   * (in which case button_aspect will be honoured, and
-   * button_width and button_height set from it), or
-   * META_BUTTON_SIZING_FIXED (in which case we read the width
-   * and height directly).
-   */
-  MetaButtonSizing button_sizing;
-
-  /**
-   * Ratio of height/width. Honoured only if
-   * button_sizing==META_BUTTON_SIZING_ASPECT.
-   * Otherwise we figure out the height from the button_border.
-   */
-  double button_aspect;
-  
-  /** Width of a button; set even when we are using aspect sizing */
-  int button_width;
-
-  /** Height of a button; set even when we are using aspect sizing */
-  int button_height;
-
-  /** Space around buttons */
-  GtkBorder button_border;
-
-  /** scale factor for title text */
-  double title_scale;
-  
-  /** Whether title text will be displayed */
-  guint has_title : 1;
-
-  /** Whether we should hide the buttons */
-  guint hide_buttons : 1;
-
-  /** Radius of the top left-hand corner; 0 if not rounded */
-  guint top_left_corner_rounded_radius;
-  /** Radius of the top right-hand corner; 0 if not rounded */
-  guint top_right_corner_rounded_radius;
-  /** Radius of the bottom left-hand corner; 0 if not rounded */
-  guint bottom_left_corner_rounded_radius;
-  /** Radius of the bottom right-hand corner; 0 if not rounded */
-  guint bottom_right_corner_rounded_radius;
-};
-
-/**
- * The computed size of a button (really just a way of tying its
- * visible and clickable areas together).
- * The reason for two different rectangles here is Fitts' law & maximized
- * windows; see bug #97703 for more details.
- */
-struct _MetaButtonSpace
-{
-  /** The screen area where the button's image is drawn */
-  GdkRectangle visible;
-  /** The screen area where the button can be activated by clicking */
-  GdkRectangle clickable;
-};
-
-/**
- * Calculated actual geometry of the frame
- */
-struct _MetaFrameGeometry
-{
-  int left_width;
-  int right_width;
-  int top_height;
-  int bottom_height;
-
-  int width;
-  int height;  
-
-  GdkRectangle title_rect;
-
-  int left_titlebar_edge;
-  int right_titlebar_edge;
-  int top_titlebar_edge;
-  int bottom_titlebar_edge;
-
-  /* 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))
-  
-  /* The button rects (if changed adjust memset hack) */
-  MetaButtonSpace close_rect;
-  MetaButtonSpace max_rect;
-  MetaButtonSpace min_rect;
-  MetaButtonSpace menu_rect;
-  MetaButtonSpace shade_rect;
-  MetaButtonSpace above_rect;
-  MetaButtonSpace stick_rect;
-  MetaButtonSpace unshade_rect;
-  MetaButtonSpace unabove_rect;
-  MetaButtonSpace unstick_rect;
-
-#define MAX_MIDDLE_BACKGROUNDS (MAX_BUTTONS_PER_CORNER - 2)
-  GdkRectangle left_left_background;
-  GdkRectangle left_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
-  GdkRectangle left_right_background;
-  GdkRectangle right_left_background;
-  GdkRectangle right_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
-  GdkRectangle right_right_background;
-  /* End of button rects (if changed adjust memset hack) */
-  
-  /* Round corners */
-  guint top_left_corner_rounded_radius;
-  guint top_right_corner_rounded_radius;
-  guint bottom_left_corner_rounded_radius;
-  guint bottom_right_corner_rounded_radius;
-};
-
-typedef enum
-{
-  META_IMAGE_FILL_SCALE, /* default, needs to be all-bits-zero for g_new0 */
-  META_IMAGE_FILL_TILE
-} MetaImageFillType;
-
-typedef enum
-{
-  META_COLOR_SPEC_BASIC,
-  META_COLOR_SPEC_GTK,
-  META_COLOR_SPEC_BLEND,
-  META_COLOR_SPEC_SHADE
-} MetaColorSpecType;
-
-typedef enum
-{
-  META_GTK_COLOR_FG,
-  META_GTK_COLOR_BG,
-  META_GTK_COLOR_LIGHT,
-  META_GTK_COLOR_DARK,
-  META_GTK_COLOR_MID,
-  META_GTK_COLOR_TEXT,
-  META_GTK_COLOR_BASE,
-  META_GTK_COLOR_TEXT_AA,
-  META_GTK_COLOR_LAST
-} MetaGtkColorComponent;
-
-struct _MetaColorSpec
-{
-  MetaColorSpecType type;
-  union
-  {
-    struct {
-      GdkColor color;
-    } basic;
-    struct {
-      MetaGtkColorComponent component;
-      GtkStateType state;
-    } gtk;
-    struct {
-      MetaColorSpec *foreground;
-      MetaColorSpec *background;
-      double alpha;
-
-      GdkColor color;
-    } blend;
-    struct {
-      MetaColorSpec *base;
-      double factor;
-
-      GdkColor color;
-    } shade;
-  } data;
-};
-
-struct _MetaGradientSpec
-{
-  MetaGradientType type;
-  GSList *color_specs;
-};
-
-struct _MetaAlphaGradientSpec
-{
-  MetaGradientType type;
-  unsigned char *alphas;
-  int n_alphas;
-};
-
-struct _MetaDrawInfo
-{
-  GdkPixbuf   *mini_icon;
-  GdkPixbuf   *icon;
-  PangoLayout *title_layout;
-  int title_layout_width;
-  int title_layout_height;
-  const MetaFrameGeometry *fgeom;
-};
-
-/**
- * A drawing operation in our simple vector drawing language.
- */
-typedef enum
-{
-  /** Basic drawing-- line */
-  META_DRAW_LINE,
-  /** Basic drawing-- rectangle */
-  META_DRAW_RECTANGLE,
-  /** Basic drawing-- arc */
-  META_DRAW_ARC,
-
-  /** Clip to a rectangle */
-  META_DRAW_CLIP,
-  
-  /* Texture thingies */
-
-  /** Just a filled rectangle with alpha */
-  META_DRAW_TINT,
-  META_DRAW_GRADIENT,
-  META_DRAW_IMAGE,
-  
-  /** GTK theme engine stuff */
-  META_DRAW_GTK_ARROW,
-  META_DRAW_GTK_BOX,
-  META_DRAW_GTK_VLINE,
-
-  /** App's window icon */
-  META_DRAW_ICON,
-  /** App's window title */
-  META_DRAW_TITLE,
-  /** a draw op list */
-  META_DRAW_OP_LIST,
-  /** tiled draw op list */
-  META_DRAW_TILE
-} MetaDrawType;
-
-typedef enum
-{
-  POS_TOKEN_INT,
-  POS_TOKEN_DOUBLE,
-  POS_TOKEN_OPERATOR,
-  POS_TOKEN_VARIABLE,
-  POS_TOKEN_OPEN_PAREN,
-  POS_TOKEN_CLOSE_PAREN
-} PosTokenType;
-
-typedef enum
-{
-  POS_OP_NONE,
-  POS_OP_ADD,
-  POS_OP_SUBTRACT,
-  POS_OP_MULTIPLY,
-  POS_OP_DIVIDE,
-  POS_OP_MOD,
-  POS_OP_MAX,
-  POS_OP_MIN
-} PosOperatorType;
-
-/**
- * A token, as output by the tokeniser.
- *
- * \ingroup tokenizer
- */
-typedef struct
-{
-  PosTokenType type;
-
-  union
-  {
-    struct {
-      int val;
-    } i;
-
-    struct {
-      double val;
-    } d;
-
-    struct {
-      PosOperatorType op;
-    } o;
-
-    struct {
-      char *name;
-      GQuark name_quark;
-    } v;
-
-  } d;
-} PosToken;
-
-/**
- * MetaDrawSpec: (skip)
- *
- * A computed expression in our simple vector drawing language.
- * While it appears to take the form of a tree, this is actually
- * merely a list; concerns such as precedence of operators are
- * currently recomputed on every recalculation.
- *
- * Created by meta_draw_spec_new(), destroyed by meta_draw_spec_free().
- * pos_eval() fills this with ...FIXME. Are tokens a tree or a list?
- * \ingroup parser
- */
-typedef struct _MetaDrawSpec MetaDrawSpec;
-struct _MetaDrawSpec
-{
-  /**
-   * If this spec is constant, this is the value of the constant;
-   * otherwise it is zero.
-   */
-  int value;
-  
-  /** A list of tokens in the expression. */
-  PosToken *tokens;
-
-  /** How many tokens are in the tokens list. */
-  int n_tokens;
-
-  /** Does the expression contain any variables? */
-  gboolean constant : 1;
-};
-
-/**
- * A single drawing operation in our simple vector drawing language.
- */
-struct _MetaDrawOp
-{
-  MetaDrawType type;
-
-  /* Positions are strings because they can be expressions */
-  union
-  {
-    struct {
-      MetaColorSpec *color_spec;
-      int dash_on_length;
-      int dash_off_length;
-      int width;
-      MetaDrawSpec *x1;
-      MetaDrawSpec *y1;
-      MetaDrawSpec *x2;
-      MetaDrawSpec *y2;
-    } line;
-
-    struct {
-      MetaColorSpec *color_spec;
-      gboolean filled;
-      MetaDrawSpec *x;
-      MetaDrawSpec *y;
-      MetaDrawSpec *width;
-      MetaDrawSpec *height;
-    } rectangle;
-
-    struct {
-      MetaColorSpec *color_spec;
-      gboolean filled;
-      MetaDrawSpec *x;
-      MetaDrawSpec *y;
-      MetaDrawSpec *width;
-      MetaDrawSpec *height;
-      double start_angle;
-      double extent_angle;
-    } arc;
-
-    struct {
-      MetaDrawSpec *x;
-      MetaDrawSpec *y;
-      MetaDrawSpec *width;
-      MetaDrawSpec *height;
-    } clip;
-    
-    struct {
-      MetaColorSpec *color_spec;
-      MetaAlphaGradientSpec *alpha_spec;
-      MetaDrawSpec *x;
-      MetaDrawSpec *y;
-      MetaDrawSpec *width;
-      MetaDrawSpec *height;
-    } tint;
-
-    struct {
-      MetaGradientSpec *gradient_spec;
-      MetaAlphaGradientSpec *alpha_spec;
-      MetaDrawSpec *x;
-      MetaDrawSpec *y;
-      MetaDrawSpec *width;
-      MetaDrawSpec *height;
-    } gradient;
-
-    struct {
-      MetaColorSpec *colorize_spec;
-      MetaAlphaGradientSpec *alpha_spec;
-      GdkPixbuf *pixbuf;
-      MetaDrawSpec *x;
-      MetaDrawSpec *y;
-      MetaDrawSpec *width;
-      MetaDrawSpec *height;
-
-      guint32 colorize_cache_pixel;
-      GdkPixbuf *colorize_cache_pixbuf;
-      MetaImageFillType fill_type;
-      unsigned int vertical_stripes : 1;
-      unsigned int horizontal_stripes : 1;
-    } image;
-    
-    struct {
-      GtkStateType state;
-      GtkShadowType shadow;
-      GtkArrowType arrow;
-      gboolean filled;
-
-      MetaDrawSpec *x;
-      MetaDrawSpec *y;
-      MetaDrawSpec *width;
-      MetaDrawSpec *height;
-    } gtk_arrow;
-
-    struct {
-      GtkStateType state;
-      GtkShadowType shadow;
-      MetaDrawSpec *x;
-      MetaDrawSpec *y;
-      MetaDrawSpec *width;
-      MetaDrawSpec *height;
-    } gtk_box;
-
-    struct {
-      GtkStateType state;
-      MetaDrawSpec *x;
-      MetaDrawSpec *y1;
-      MetaDrawSpec *y2;  
-    } gtk_vline;
-
-    struct {
-      MetaAlphaGradientSpec *alpha_spec;
-      MetaDrawSpec *x;
-      MetaDrawSpec *y;
-      MetaDrawSpec *width;
-      MetaDrawSpec *height;
-      MetaImageFillType fill_type;
-    } icon;
-
-    struct {
-      MetaColorSpec *color_spec;
-      MetaDrawSpec *x;
-      MetaDrawSpec *y;
-      MetaDrawSpec *ellipsize_width;
-    } title;
-
-    struct {
-      MetaDrawOpList *op_list;
-      MetaDrawSpec *x;
-      MetaDrawSpec *y;
-      MetaDrawSpec *width;
-      MetaDrawSpec *height;
-    } op_list;
-
-    struct {
-      MetaDrawOpList *op_list;
-      MetaDrawSpec *x;
-      MetaDrawSpec *y;
-      MetaDrawSpec *width;
-      MetaDrawSpec *height;
-      MetaDrawSpec *tile_xoffset;
-      MetaDrawSpec *tile_yoffset;
-      MetaDrawSpec *tile_width;
-      MetaDrawSpec *tile_height;
-    } tile;
-    
-  } data;
-};
-
-/**
- * A list of MetaDrawOp objects. Maintains a reference count.
- * Grows as necessary and allows the allocation of unused spaces
- * to keep reallocations to a minimum.
- *
- * \bug Do we really win anything from not using the equivalent
- * GLib structures?
- */
-struct _MetaDrawOpList
-{
-  int refcount;
-  MetaDrawOp **ops;
-  int n_ops;
-  int n_allocated;
-};
-
-typedef enum
-{
-  META_BUTTON_STATE_NORMAL,
-  META_BUTTON_STATE_PRESSED,
-  META_BUTTON_STATE_PRELIGHT,
-  META_BUTTON_STATE_LAST
-} MetaButtonState;
-
-typedef enum
-{
-  /* Ordered so that background is drawn first */
-  META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND,
-  META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND,
-  META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND,
-  META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND,
-  META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND,
-  META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND,
-  META_BUTTON_TYPE_CLOSE,
-  META_BUTTON_TYPE_MAXIMIZE,
-  META_BUTTON_TYPE_MINIMIZE,
-  META_BUTTON_TYPE_MENU,
-  META_BUTTON_TYPE_SHADE,
-  META_BUTTON_TYPE_ABOVE,
-  META_BUTTON_TYPE_STICK,
-  META_BUTTON_TYPE_UNSHADE,
-  META_BUTTON_TYPE_UNABOVE,
-  META_BUTTON_TYPE_UNSTICK,
-  META_BUTTON_TYPE_LAST
-} MetaButtonType;
-
-typedef enum
-{
-  META_MENU_ICON_TYPE_CLOSE,
-  META_MENU_ICON_TYPE_MAXIMIZE,
-  META_MENU_ICON_TYPE_UNMAXIMIZE,
-  META_MENU_ICON_TYPE_MINIMIZE,
-  META_MENU_ICON_TYPE_LAST
-} MetaMenuIconType;
-
-typedef enum
-{
-  /* Listed in the order in which the textures are drawn.
-   * (though this only matters for overlaps of course.)
-   * Buttons are drawn after the frame textures.
-   *
-   * On the corners, horizontal pieces are arbitrarily given the
-   * corner area:
-   *
-   *   =====                 |====
-   *   |                     |
-   *   |       rather than   |
-   *
-   */
-  
-  /* entire frame */
-  META_FRAME_PIECE_ENTIRE_BACKGROUND,
-  /* entire titlebar background */
-  META_FRAME_PIECE_TITLEBAR,
-  /* portion of the titlebar background inside the titlebar
-   * background edges
-   */
-  META_FRAME_PIECE_TITLEBAR_MIDDLE,
-  /* left end of titlebar */
-  META_FRAME_PIECE_LEFT_TITLEBAR_EDGE,
-  /* right end of titlebar */
-  META_FRAME_PIECE_RIGHT_TITLEBAR_EDGE,
-  /* top edge of titlebar */
-  META_FRAME_PIECE_TOP_TITLEBAR_EDGE,
-  /* bottom edge of titlebar */
-  META_FRAME_PIECE_BOTTOM_TITLEBAR_EDGE,
-  /* render over title background (text area) */
-  META_FRAME_PIECE_TITLE,
-  /* left edge of the frame */
-  META_FRAME_PIECE_LEFT_EDGE,
-  /* right edge of the frame */
-  META_FRAME_PIECE_RIGHT_EDGE,
-  /* bottom edge of the frame */
-  META_FRAME_PIECE_BOTTOM_EDGE,
-  /* place over entire frame, after drawing everything else */
-  META_FRAME_PIECE_OVERLAY,
-  /* Used to get size of the enum */
-  META_FRAME_PIECE_LAST
-} MetaFramePiece;
-
-#define N_GTK_STATES 5
-
-/**
- * How to draw a frame in a particular state (say, a focussed, non-maximised,
- * resizable frame). This corresponds closely to the <frame_style> tag
- * in a theme file.
- */
-struct _MetaFrameStyle
-{
-  /** Reference count. */
-  int refcount;
-  /**
-   * Parent style.
-   * Settings which are unspecified here will be taken from there.
-   */
-  MetaFrameStyle *parent;
-  /** Operations for drawing each kind of button in each state. */
-  MetaDrawOpList *buttons[META_BUTTON_TYPE_LAST][META_BUTTON_STATE_LAST];
-  /** Operations for drawing each piece of the frame. */
-  MetaDrawOpList *pieces[META_FRAME_PIECE_LAST];
-  /**
-   * Details such as the height and width of each edge, the corner rounding,
-   * and the aspect ratio of the buttons.
-   */
-  MetaFrameLayout *layout;
-  /**
-   * Background colour of the window. Only present in theme formats
-   * 2 and above. Can be NULL to use the standard GTK theme engine.
-   */
-  MetaColorSpec *window_background_color;
-  /**
-   * Transparency of the window background. 0=transparent; 255=opaque.
-   */
-  guint8 window_background_alpha;
-};
-
-/* Kinds of frame...
- * 
- *  normal ->   noresize / vert only / horz only / both
- *              focused / unfocused
- *  max    ->   focused / unfocused
- *  shaded ->   focused / unfocused
- *  max/shaded -> focused / unfocused
- *
- *  so 4 states with 8 sub-states in one, 2 sub-states in the other 3,
- *  meaning 14 total
- *
- * 14 window states times 7 or 8 window types. Except some
- * window types never get a frame so that narrows it down a bit.
- * 
- */
-typedef enum
-{
-  META_FRAME_STATE_NORMAL,
-  META_FRAME_STATE_MAXIMIZED,
-  META_FRAME_STATE_SHADED,
-  META_FRAME_STATE_MAXIMIZED_AND_SHADED,
-  META_FRAME_STATE_LAST
-} MetaFrameState;
-
-typedef enum
-{
-  META_FRAME_RESIZE_NONE,
-  META_FRAME_RESIZE_VERTICAL,
-  META_FRAME_RESIZE_HORIZONTAL,
-  META_FRAME_RESIZE_BOTH,
-  META_FRAME_RESIZE_LAST
-} MetaFrameResize;
-
-typedef enum
-{
-  META_FRAME_FOCUS_NO,
-  META_FRAME_FOCUS_YES,
-  META_FRAME_FOCUS_LAST
-} MetaFrameFocus;
-
-/**
- * How to draw frames at different times: when it's maximised or not, shaded
- * or not, when it's focussed or not, and (for non-maximised windows), when
- * it can be horizontally or vertically resized, both, or neither.
- * Not all window types actually get a frame.
- *
- * A theme contains one of these objects for each type of window (each
- * MetaFrameType), that is, normal, dialogue (modal and non-modal), etc.
- *
- * This corresponds closely to the <frame_style_set> tag in a theme file.
- */
-struct _MetaFrameStyleSet
-{
-  int refcount;
-  MetaFrameStyleSet *parent;
-  MetaFrameStyle *normal_styles[META_FRAME_RESIZE_LAST][META_FRAME_FOCUS_LAST];
-  MetaFrameStyle *maximized_styles[META_FRAME_FOCUS_LAST];
-  MetaFrameStyle *shaded_styles[META_FRAME_RESIZE_LAST][META_FRAME_FOCUS_LAST];
-  MetaFrameStyle *maximized_and_shaded_styles[META_FRAME_FOCUS_LAST];
-};
-
-/**
- * A theme. This is a singleton class which groups all settings from a theme
- * on disk together.
- *
- * \bug It is rather useless to keep the metadata fields in core, I think.
- */
-struct _MetaTheme
-{
-  /** Name of the theme (on disk), e.g. "Crux" */
-  char *name;
-  /** Path to the files associated with the theme */
-  char *dirname;
-  /**
-   * Filename of the XML theme file.
-   * \bug Kept lying around for no discernable reason.
-   */
-  char *filename;
-  /** Metadata: Human-readable name of the theme. */
-  char *readable_name;
-  /** Metadata: Author of the theme. */
-  char *author;
-  /** Metadata: Copyright holder. */
-  char *copyright;
-  /** Metadata: Date of the theme. */
-  char *date;
-  /** Metadata: Description of the theme. */
-  char *description;
-  /** Version of the theme format. Older versions cannot use the features
-   * of newer versions even if they think they can (this is to allow forward
-   * and backward compatibility.
-   */
-  guint format_version;
-
-  /** Symbol table of integer constants. */
-  GHashTable *integer_constants;
-  /** Symbol table of float constants. */
-  GHashTable *float_constants;
-  /**
-   * Symbol table of colour constants (hex triples, and triples
-   * plus alpha).
-   * */
-  GHashTable *color_constants;
-  GHashTable *images_by_filename;
-  GHashTable *layouts_by_name;
-  GHashTable *draw_op_lists_by_name;
-  GHashTable *styles_by_name;
-  GHashTable *style_sets_by_name;
-  MetaFrameStyleSet *style_sets_by_type[META_FRAME_TYPE_LAST];
-
-  GQuark quark_width;
-  GQuark quark_height;
-  GQuark quark_object_width;
-  GQuark quark_object_height;
-  GQuark quark_left_width;
-  GQuark quark_right_width;
-  GQuark quark_top_height;
-  GQuark quark_bottom_height;
-  GQuark quark_mini_icon_width;
-  GQuark quark_mini_icon_height;
-  GQuark quark_icon_width;
-  GQuark quark_icon_height;
-  GQuark quark_title_width;
-  GQuark quark_title_height;
-  GQuark quark_frame_x_center;
-  GQuark quark_frame_y_center;
-};
-
-struct _MetaPositionExprEnv
-{
-  MetaRectangle rect;
-  /* size of an object being drawn, if it has a natural size */
-  int object_width;
-  int object_height;
-  /* global object sizes, always available */
-  int left_width;
-  int right_width;
-  int top_height;
-  int bottom_height;
-  int title_width;
-  int title_height;
-  int frame_x_center;
-  int frame_y_center;
-  int mini_icon_width;
-  int mini_icon_height;
-  int icon_width;
-  int icon_height;
-  /* Theme so we can look up constants */
-  MetaTheme *theme;
-};
-
-MetaFrameLayout* meta_frame_layout_new           (void);
-MetaFrameLayout* meta_frame_layout_copy          (const MetaFrameLayout *src);
-void             meta_frame_layout_ref           (MetaFrameLayout       *layout);
-void             meta_frame_layout_unref         (MetaFrameLayout       *layout);
-void             meta_frame_layout_get_borders   (const MetaFrameLayout *layout,
-                                                  int                    text_height,
-                                                  MetaFrameFlags         flags,
-                                                  int                   *top_height,
-                                                  int                   *bottom_height,
-                                                  int                   *left_width,
-                                                  int                   *right_width);
-void             meta_frame_layout_calc_geometry (const MetaFrameLayout  *layout,
-                                                  int                     text_height,
-                                                  MetaFrameFlags          flags,
-                                                  int                     client_width,
-                                                  int                     client_height,
-                                                  const MetaButtonLayout *button_layout,
-                                                  MetaFrameGeometry      *fgeom,
-                                                  MetaTheme              *theme);
-
-gboolean         meta_frame_layout_validate      (const MetaFrameLayout *layout,
-                                                  GError               **error);
-
-gboolean meta_parse_position_expression (MetaDrawSpec               *spec,
-                                         const MetaPositionExprEnv  *env,
-                                         int                        *x_return,
-                                         int                        *y_return,
-                                         GError                    **err);
-gboolean meta_parse_size_expression     (MetaDrawSpec               *spec,
-                                         const MetaPositionExprEnv  *env,
-                                         int                        *val_return,
-                                         GError                    **err);
-
-MetaDrawSpec* meta_draw_spec_new (MetaTheme  *theme,
-                                  const char *expr,
-                                  GError    **error);
-void          meta_draw_spec_free (MetaDrawSpec *spec);
-
-MetaColorSpec* meta_color_spec_new             (MetaColorSpecType  type);
-MetaColorSpec* meta_color_spec_new_from_string (const char        *str,
-                                                GError           **err);
-MetaColorSpec* meta_color_spec_new_gtk         (MetaGtkColorComponent component,
-                                                GtkStateType          state);
-void           meta_color_spec_free            (MetaColorSpec     *spec);
-void           meta_color_spec_render          (MetaColorSpec     *spec,
-                                                GtkWidget         *widget,
-                                                GdkColor          *color);
-
-
-MetaDrawOp*    meta_draw_op_new  (MetaDrawType        type);
-void           meta_draw_op_free (MetaDrawOp          *op);
-void           meta_draw_op_draw (const MetaDrawOp    *op,
-                                  GtkWidget           *widget,
-                                  cairo_t             *cr,
-                                  const MetaDrawInfo  *info,
-                                  /* logical region being drawn */
-                                  MetaRectangle        logical_region);
-
-void           meta_draw_op_draw_with_style (const MetaDrawOp    *op,
-                                             GtkStyle            *style_gtk,
-                                             GtkWidget           *widget,
-                                             cairo_t             *cr,
-                                             const MetaDrawInfo  *info,
-                                             /* logical region being drawn */
-                                             MetaRectangle        logical_region);
-
-MetaDrawOpList* meta_draw_op_list_new   (int                   n_preallocs);
-void            meta_draw_op_list_ref   (MetaDrawOpList       *op_list);
-void            meta_draw_op_list_unref (MetaDrawOpList       *op_list);
-void            meta_draw_op_list_draw  (const MetaDrawOpList *op_list,
-                                         GtkWidget            *widget,
-                                         cairo_t              *cr,
-                                         const MetaDrawInfo   *info,
-                                         MetaRectangle         rect);
-void            meta_draw_op_list_draw_with_style  (const MetaDrawOpList *op_list,
-                                                    GtkStyle             *style_gtk,
-                                                    GtkWidget            *widget,
-                                                    cairo_t              *cr,
-                                                    const MetaDrawInfo   *info,
-                                                    MetaRectangle         rect);
-void           meta_draw_op_list_append (MetaDrawOpList       *op_list,
-                                         MetaDrawOp           *op);
-gboolean       meta_draw_op_list_validate (MetaDrawOpList    *op_list,
-                                           GError           **error);
-gboolean       meta_draw_op_list_contains (MetaDrawOpList    *op_list,
-                                           MetaDrawOpList    *child);
-
-MetaGradientSpec* meta_gradient_spec_new    (MetaGradientType        type);
-void              meta_gradient_spec_free   (MetaGradientSpec       *desc);
-GdkPixbuf*        meta_gradient_spec_render (const MetaGradientSpec *desc,
-                                             GtkWidget              *widget,
-                                             int                     width,
-                                             int                     height);
-gboolean          meta_gradient_spec_validate (MetaGradientSpec     *spec,
-                                               GError              **error);
-
-MetaAlphaGradientSpec* meta_alpha_gradient_spec_new  (MetaGradientType       type,
-                                                      int                    n_alphas);
-void                   meta_alpha_gradient_spec_free (MetaAlphaGradientSpec *spec);
-
-
-MetaFrameStyle* meta_frame_style_new   (MetaFrameStyle *parent);
-void            meta_frame_style_ref   (MetaFrameStyle *style);
-void            meta_frame_style_unref (MetaFrameStyle *style);
-
-void meta_frame_style_draw (MetaFrameStyle          *style,
-                            GtkWidget               *widget,
-                            cairo_t                 *cr,
-                            const MetaFrameGeometry *fgeom,
-                            int                      client_width,
-                            int                      client_height,
-                            PangoLayout             *title_layout,
-                            int                      text_height,
-                            MetaButtonState          button_states[META_BUTTON_TYPE_LAST],
-                            GdkPixbuf               *mini_icon,
-                            GdkPixbuf               *icon);
-
-
-void meta_frame_style_draw_with_style (MetaFrameStyle          *style,
-                                       GtkStyle                *style_gtk,
-                                       GtkWidget               *widget,
-                                       cairo_t                 *cr,
-                                       const MetaFrameGeometry *fgeom,
-                                       int                      client_width,
-                                       int                      client_height,
-                                       PangoLayout             *title_layout,
-                                       int                      text_height,
-                                       MetaButtonState          button_states[META_BUTTON_TYPE_LAST],
-                                       GdkPixbuf               *mini_icon,
-                                       GdkPixbuf               *icon);
-
-
-gboolean       meta_frame_style_validate (MetaFrameStyle    *style,
-                                          guint              current_theme_version,
-                                          GError           **error);
-
-MetaFrameStyleSet* meta_frame_style_set_new   (MetaFrameStyleSet *parent);
-void               meta_frame_style_set_ref   (MetaFrameStyleSet *style_set);
-void               meta_frame_style_set_unref (MetaFrameStyleSet *style_set);
-
-gboolean       meta_frame_style_set_validate  (MetaFrameStyleSet *style_set,
-                                               GError           **error);
 
 MetaTheme* meta_theme_get_current (void);
 void       meta_theme_set_current (const char *name,
@@ -1053,179 +40,8 @@ MetaTheme* meta_theme_new      (void);
 void       meta_theme_free     (MetaTheme *theme);
 gboolean   meta_theme_validate (MetaTheme *theme,
                                 GError   **error);
-GdkPixbuf* meta_theme_load_image (MetaTheme  *theme,
-                                  const char *filename,
-                                  guint       size_of_theme_icons,
-                                  GError    **error);
-
-MetaFrameStyle* meta_theme_get_frame_style (MetaTheme     *theme,
-                                            MetaFrameType  type,
-                                            MetaFrameFlags flags);
-
-double meta_theme_get_title_scale (MetaTheme     *theme,
-                                   MetaFrameType  type,
-                                   MetaFrameFlags flags);
-
-void meta_theme_draw_frame (MetaTheme              *theme,
-                            GtkWidget              *widget,
-                            cairo_t                *cr,
-                            MetaFrameType           type,
-                            MetaFrameFlags          flags,
-                            int                     client_width,
-                            int                     client_height,
-                            PangoLayout            *title_layout,
-                            int                     text_height,
-                            const MetaButtonLayout *button_layout,
-                            MetaButtonState         button_states[META_BUTTON_TYPE_LAST],
-                            GdkPixbuf              *mini_icon,
-                            GdkPixbuf              *icon);
-
-void meta_theme_draw_frame_by_name (MetaTheme              *theme,
-                                    GtkWidget              *widget,
-                                    cairo_t                *cr,
-                                    const gchar             *style_name,
-                                    MetaFrameFlags          flags,
-                                    int                     client_width,
-                                    int                     client_height,
-                                    PangoLayout            *title_layout,
-                                    int                     text_height,
-                                    const MetaButtonLayout *button_layout,
-                                    MetaButtonState         button_states[META_BUTTON_TYPE_LAST],
-                                    GdkPixbuf              *mini_icon,
-                                    GdkPixbuf              *icon);
-
-void meta_theme_draw_frame_with_style (MetaTheme              *theme,
-                                       GtkStyle               *style_gtk,
-                                       GtkWidget              *widget,
-                                       cairo_t                *cr,
-                                       MetaFrameType           type,
-                                       MetaFrameFlags          flags,
-                                       int                     client_width,
-                                       int                     client_height,
-                                       PangoLayout            *title_layout,
-                                       int                     text_height,
-                                       const MetaButtonLayout *button_layout,
-                                       MetaButtonState         button_states[META_BUTTON_TYPE_LAST],
-                                       GdkPixbuf              *mini_icon,
-                                       GdkPixbuf              *icon);
-
-void meta_theme_get_frame_borders (MetaTheme         *theme,
-                                   MetaFrameType      type,
-                                   int                text_height,
-                                   MetaFrameFlags     flags,
-                                   int               *top_height,
-                                   int               *bottom_height,
-                                   int               *left_width,
-                                   int               *right_width);
-void meta_theme_calc_geometry (MetaTheme              *theme,
-                               MetaFrameType           type,
-                               int                     text_height,
-                               MetaFrameFlags          flags,
-                               int                     client_width,
-                               int                     client_height,
-                               const MetaButtonLayout *button_layout,
-                               MetaFrameGeometry      *fgeom);
-                                   
-MetaFrameLayout*   meta_theme_lookup_layout       (MetaTheme         *theme,
-                                                   const char        *name);
-void               meta_theme_insert_layout       (MetaTheme         *theme,
-                                                   const char        *name,
-                                                   MetaFrameLayout   *layout);
-MetaDrawOpList*    meta_theme_lookup_draw_op_list (MetaTheme         *theme,
-                                                   const char        *name);
-void               meta_theme_insert_draw_op_list (MetaTheme         *theme,
-                                                   const char        *name,
-                                                   MetaDrawOpList    *op_list);
-MetaFrameStyle*    meta_theme_lookup_style        (MetaTheme         *theme,
-                                                   const char        *name);
-void               meta_theme_insert_style        (MetaTheme         *theme,
-                                                   const char        *name,
-                                                   MetaFrameStyle    *style);
-MetaFrameStyleSet* meta_theme_lookup_style_set    (MetaTheme         *theme,
-                                                   const char        *name);
-void               meta_theme_insert_style_set    (MetaTheme         *theme,
-                                                   const char        *name,
-                                                   MetaFrameStyleSet *style_set);
-gboolean meta_theme_define_int_constant   (MetaTheme   *theme,
-                                           const char  *name,
-                                           int          value,
-                                           GError     **error);
-gboolean meta_theme_lookup_int_constant   (MetaTheme   *theme,
-                                           const char  *name,
-                                           int         *value);
-gboolean meta_theme_define_float_constant (MetaTheme   *theme,
-                                           const char  *name,
-                                           double       value,
-                                           GError     **error);
-gboolean meta_theme_lookup_float_constant (MetaTheme   *theme,
-                                           const char  *name,
-                                           double      *value);
-
-gboolean meta_theme_define_color_constant (MetaTheme   *theme,
-                                           const char  *name,
-                                           const char  *value,
-                                           GError     **error);
-gboolean meta_theme_lookup_color_constant (MetaTheme   *theme,
-                                           const char  *name,
-                                           char       **value);
-
-gboolean     meta_theme_replace_constants     (MetaTheme    *theme,
-                                               PosToken     *tokens,
-                                               int           n_tokens,
-                                               GError      **err);
-
-/* random stuff */
-
-PangoFontDescription* meta_gtk_widget_get_font_desc        (GtkWidget            *widget,
-                                                            double                scale,
-							    const PangoFontDescription *override);
-int                   meta_pango_font_desc_get_text_height (const PangoFontDescription *font_desc,
-                                                            PangoContext         *context);
-
-
-/* Enum converters */
-MetaGtkColorComponent meta_color_component_from_string (const char            *str);
-const char*           meta_color_component_to_string   (MetaGtkColorComponent  component);
-MetaButtonState       meta_button_state_from_string    (const char            *str);
-const char*           meta_button_state_to_string      (MetaButtonState        state);
-MetaButtonType        meta_button_type_from_string     (const char            *str,
-                                                        MetaTheme             *theme);
-const char*           meta_button_type_to_string       (MetaButtonType         type);
-MetaFramePiece        meta_frame_piece_from_string     (const char            *str);
-const char*           meta_frame_piece_to_string       (MetaFramePiece         piece);
-MetaFrameState        meta_frame_state_from_string     (const char            *str);
-const char*           meta_frame_state_to_string       (MetaFrameState         state);
-MetaFrameResize       meta_frame_resize_from_string    (const char            *str);
-const char*           meta_frame_resize_to_string      (MetaFrameResize        resize);
-MetaFrameFocus        meta_frame_focus_from_string     (const char            *str);
-const char*           meta_frame_focus_to_string       (MetaFrameFocus         focus);
-MetaFrameType         meta_frame_type_from_string      (const char            *str);
-const char*           meta_frame_type_to_string        (MetaFrameType          type);
-MetaGradientType      meta_gradient_type_from_string   (const char            *str);
-const char*           meta_gradient_type_to_string     (MetaGradientType       type);
-GtkStateType          meta_gtk_state_from_string       (const char            *str);
-const char*           meta_gtk_state_to_string         (GtkStateType           state);
-GtkShadowType         meta_gtk_shadow_from_string      (const char            *str);
-const char*           meta_gtk_shadow_to_string        (GtkShadowType          shadow);
-GtkArrowType          meta_gtk_arrow_from_string       (const char            *str);
-const char*           meta_gtk_arrow_to_string         (GtkArrowType           arrow);
-MetaImageFillType     meta_image_fill_type_from_string (const char            *str);
-const char*           meta_image_fill_type_to_string   (MetaImageFillType      fill_type);
-
-guint meta_theme_earliest_version_with_button (MetaButtonType type);
-
-
-#define META_THEME_ALLOWS(theme, feature) (theme->format_version >= feature)
 
-/* What version of the theme file format were various features introduced in? */
-#define META_THEME_SHADE_STICK_ABOVE_BUTTONS 2
-#define META_THEME_UBIQUITOUS_CONSTANTS 2
-#define META_THEME_VARIED_ROUND_CORNERS 2
-#define META_THEME_IMAGES_FROM_ICON_THEMES 2
-#define META_THEME_UNRESIZABLE_SHADED_STYLES 2
-#define META_THEME_DEGREES_IN_ARCS 2
-#define META_THEME_HIDDEN_BUTTONS 2
-#define META_THEME_COLOR_CONSTANTS 2
-#define META_THEME_FRAME_BACKGROUNDS 2
+MetaTheme* meta_theme_load (const char *theme_name,
+                            GError    **err);
 
 #endif
diff --git a/src/ui/ui.c b/src/ui/ui.c
index 53d9f87..6e80617 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -29,7 +29,7 @@
 #include "util.h"
 #include "menu.h"
 #include "core.h"
-#include "theme.h"
+#include "theme-private.h"
 
 #include "inlinepixbufs.h"
 #include "gdk-compat.h"



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