[metacity/cowbell: 3/11] basic stubs (no longer compiles)



commit 5ed06eaebfeab74de9e47ca4e0b5125f3998055b
Author: Thomas Thurman <tthurman gnome org>
Date:   Sun Sep 20 17:27:41 2009 -0400

    basic stubs (no longer compiles)

 src/ui/preview-widget.c |   29 ++++++++
 src/ui/theme.c          |  100 +++++++++++++++++++++++++++++
 src/ui/theme.h          |  163 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 292 insertions(+), 0 deletions(-)
---
diff --git a/src/ui/preview-widget.c b/src/ui/preview-widget.c
index 32fbc70..391ceda 100644
--- a/src/ui/preview-widget.c
+++ b/src/ui/preview-widget.c
@@ -28,6 +28,7 @@
 #include <gtk/gtk.h>
 #include "preview-widget.h"
 
+#if 0 /* temp FIXME */
 static void     meta_preview_class_init    (MetaPreviewClass *klass);
 static void     meta_preview_init          (MetaPreview      *preview);
 static void     meta_preview_size_request  (GtkWidget        *widget,
@@ -39,10 +40,12 @@ static gboolean meta_preview_expose        (GtkWidget        *widget,
 static void     meta_preview_finalize      (GObject          *object);
 
 static GtkWidgetClass *parent_class;
+#endif
 
 GType
 meta_preview_get_type (void)
 {
+#if 0 /* temp FIXME */
   static GType preview_type = 0;
 
   if (!preview_type)
@@ -63,8 +66,12 @@ meta_preview_get_type (void)
     }
 
   return preview_type;
+#endif
+  return 0;
 }
 
+#if 0 /* temp FIXME */
+
 static void
 meta_preview_class_init (MetaPreviewClass *class)
 {
@@ -332,7 +339,9 @@ meta_preview_size_allocate (GtkWidget         *widget,
       gtk_widget_size_allocate (GTK_BIN (widget)->child, &child_allocation);
     }
 }
+#endif
 
+#if 0 /* temp FIXME */
 static void
 clear_cache (MetaPreview *preview)
 {
@@ -347,11 +356,13 @@ clear_cache (MetaPreview *preview)
   preview->top_height = -1;
   preview->bottom_height = -1;
 }
+#endif
 
 void
 meta_preview_set_theme (MetaPreview    *preview,
                         MetaTheme      *theme)
 {
+#if 0 /* temp FIXME */
   g_return_if_fail (META_IS_PREVIEW (preview));
 
   preview->theme = theme;
@@ -359,12 +370,14 @@ meta_preview_set_theme (MetaPreview    *preview,
   clear_cache (preview);
 
   gtk_widget_queue_resize (GTK_WIDGET (preview));
+#endif
 }
 
 void
 meta_preview_set_title (MetaPreview    *preview,
                         const char     *title)
 {
+#if 0 /* temp FIXME */
   g_return_if_fail (META_IS_PREVIEW (preview));
 
   g_free (preview->title);
@@ -373,12 +386,14 @@ meta_preview_set_title (MetaPreview    *preview,
   clear_cache (preview);
 
   gtk_widget_queue_resize (GTK_WIDGET (preview));
+#endif
 }
 
 void
 meta_preview_set_frame_type (MetaPreview    *preview,
                              MetaFrameType   type)
 {
+#if 0 /* temp FIXME */
   g_return_if_fail (META_IS_PREVIEW (preview));
 
   preview->type = type;
@@ -386,12 +401,14 @@ meta_preview_set_frame_type (MetaPreview    *preview,
   clear_cache (preview);
 
   gtk_widget_queue_resize (GTK_WIDGET (preview));
+#endif
 }
 
 void
 meta_preview_set_frame_flags (MetaPreview    *preview,
                               MetaFrameFlags  flags)
 {
+#if 0 /* temp FIXME */
   g_return_if_fail (META_IS_PREVIEW (preview));
 
   preview->flags = flags;
@@ -399,22 +416,26 @@ meta_preview_set_frame_flags (MetaPreview    *preview,
   clear_cache (preview);
 
   gtk_widget_queue_resize (GTK_WIDGET (preview));
+#endif
 }
 
 void
 meta_preview_set_button_layout (MetaPreview            *preview,
                                 const MetaButtonLayout *button_layout)
 {
+#if 0 /* temp FIXME */
   g_return_if_fail (META_IS_PREVIEW (preview));
   
   preview->button_layout = *button_layout;  
   
   gtk_widget_queue_draw (GTK_WIDGET (preview));
+#endif
 }
 
 GdkPixbuf*
 meta_preview_get_icon (void)
 {
+#if 0 /* temp FIXME */
   static GdkPixbuf *default_icon = NULL;
 
   if (default_icon == NULL)
@@ -443,11 +464,14 @@ meta_preview_get_icon (void)
     }
   
   return default_icon;
+#endif
+  return NULL; /* stub */
 }
 
 GdkPixbuf*
 meta_preview_get_mini_icon (void)
 {
+#if 0 /* temp FIXME */
   static GdkPixbuf *default_icon = NULL;
 
   if (default_icon == NULL)
@@ -476,11 +500,14 @@ meta_preview_get_mini_icon (void)
     }
   
   return default_icon;
+#endif
+  return NULL; /* stub */
 }
 
 GdkRegion *
 meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint new_window_height)
 {
+#if 0 /* temp FIXME */
   GdkRectangle xrect;
   GdkRegion *corners_xregion, *window_xregion;
   gint flags;
@@ -588,6 +615,8 @@ meta_preview_get_clip_region (MetaPreview *preview, gint new_window_width, gint
   gdk_region_destroy (corners_xregion);
 
   return window_xregion;
+#endif
+  return NULL; /* stub */
 }
 
 
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 175eb5b..cedf8ef 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -1,5 +1,104 @@
 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 
+#include "theme.h"
+
+MetaTheme*
+meta_theme_get_current (void)
+{
+  /* stub */
+}
+
+void
+meta_theme_set_current (const char *name,
+                        gboolean    force_reload)
+{
+  /* stub */
+}
+
+MetaFrameStyle*
+meta_theme_get_frame_style (MetaTheme     *theme,
+                            MetaFrameType  type,
+                            MetaFrameFlags flags)
+{
+  /* stub */
+}
+
+double
+meta_theme_get_title_scale (MetaTheme     *theme,
+                            MetaFrameType  type,
+                            MetaFrameFlags flags)
+{
+  /* stub */
+}
+
+void
+meta_theme_draw_frame_with_style (MetaTheme              *theme,
+                                  GtkStyle               *style_gtk,
+                                  GtkWidget              *widget,
+                                  GdkDrawable            *drawable,
+                                  const GdkRectangle     *clip,
+                                  int                     x_offset,
+                                  int                     y_offset,
+                                  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)
+{
+  /* stub */
+}
+
+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)
+{
+  /* stub */
+}
+
+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)
+{
+  /* stub */
+}
+
+PangoFontDescription*
+meta_gtk_widget_get_font_desc        (GtkWidget            *widget,
+                                      double                scale,
+                                      const PangoFontDescription *override)
+{
+  /* stub */
+}
+
+int
+meta_pango_font_desc_get_text_height (const PangoFontDescription *font_desc,
+                                      PangoContext         *context)
+{
+  /* stub */
+}
+
+#if 0
+/****************************************************************/
+
+
+
 /* Metacity Theme Rendering */
 
 /*
@@ -6632,3 +6731,4 @@ meta_theme_earliest_version_with_button (MetaButtonType type)
       return 1; 
     }
 }
+#endif
diff --git a/src/ui/theme.h b/src/ui/theme.h
index ddf777d..64ddf50 100644
--- a/src/ui/theme.h
+++ b/src/ui/theme.h
@@ -29,6 +29,167 @@
 #include "common.h"
 #include <gtk/gtk.h>
 
+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_BUTTON_STATE_NORMAL,
+  META_BUTTON_STATE_PRESSED,
+  META_BUTTON_STATE_PRELIGHT,
+  META_BUTTON_STATE_LAST
+} MetaButtonState;
+
+/**
+ * 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.
+ */
+typedef struct
+{
+  /** 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;
+} MetaButtonSpace;
+
+/**
+ * Calculated actual geometry of the frame
+ */
+typedef struct
+{
+  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;
+} MetaFrameGeometry;
+
+typedef struct {
+  gboolean dummy;
+} MetaTheme;
+
+typedef struct {
+  gboolean dummy;
+} MetaFrameStyle;
+
+MetaTheme* meta_theme_get_current (void);
+void       meta_theme_set_current (const char *name,
+                                   gboolean    force_reload);
+
+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_with_style (MetaTheme              *theme,
+                                       GtkStyle               *style_gtk,
+                                       GtkWidget              *widget,
+                                       GdkDrawable            *drawable,
+                                       const GdkRectangle     *clip,
+                                       int                     x_offset,
+                                       int                     y_offset,
+                                       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);
+
+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);
+
+/****************************************************************/
+
+#if 0 /* let's see how much we get to keep */
 typedef struct _MetaFrameStyle MetaFrameStyle;
 typedef struct _MetaFrameStyleSet MetaFrameStyleSet;
 typedef struct _MetaDrawOp MetaDrawOp;
@@ -1188,3 +1349,5 @@ guint meta_theme_earliest_version_with_button (MetaButtonType type);
 #define META_THEME_FRAME_BACKGROUNDS 2
 
 #endif
+
+#endif



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