[gnome-shell] Rename StBoxShadow to StShadow
- From: Florian Müllner <fmuellner src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-shell] Rename StBoxShadow to StShadow
- Date: Sat, 19 Dec 2009 23:36:55 +0000 (UTC)
commit a7654809c17418610d19ad0c48788d5b13df6ae8
Author: Florian Müllner <fmuellner src gnome org>
Date: Sun Dec 20 00:43:55 2009 +0100
Rename StBoxShadow to StShadow
src/Makefile-st.am | 4 +-
src/st/st-box-shadow.c | 89 ------------------------------------------------
src/st/st-box-shadow.h | 42 ----------------------
src/st/st-shadow.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++
src/st/st-shadow.h | 42 ++++++++++++++++++++++
src/st/st-theme-node.c | 29 +++++++--------
src/st/st-theme-node.h | 4 +-
src/st/st-widget.c | 14 ++++----
8 files changed, 156 insertions(+), 157 deletions(-)
---
diff --git a/src/Makefile-st.am b/src/Makefile-st.am
index b93bf35..bf44016 100644
--- a/src/Makefile-st.am
+++ b/src/Makefile-st.am
@@ -75,7 +75,6 @@ st_source_h = \
st/st-clickable.h \
st/st-clipboard.h \
st/st-drawing-area.h \
- st/st-box-shadow.h \
st/st-entry.h \
st/st-im-text.h \
st/st-label.h \
@@ -85,6 +84,7 @@ st_source_h = \
st/st-scroll-bar.h \
st/st-scroll-view.h \
st/st-shadow-texture.h \
+ st/st-shadow.h \
st/st-subtexture.h \
st/st-table.h \
st/st-table-child.h \
@@ -116,7 +116,6 @@ st_source_c = \
st/st-clickable.c \
st/st-clipboard.c \
st/st-drawing-area.c \
- st/st-box-shadow.c \
st/st-entry.c \
st/st-im-text.c \
st/st-label.c \
@@ -126,6 +125,7 @@ st_source_c = \
st/st-scroll-bar.c \
st/st-scroll-view.c \
st/st-shadow-texture.c \
+ st/st-shadow.c \
st/st-subtexture.c \
st/st-table.c \
st/st-table-child.c \
diff --git a/src/st/st-shadow.c b/src/st/st-shadow.c
new file mode 100644
index 0000000..0f11a6c
--- /dev/null
+++ b/src/st/st-shadow.c
@@ -0,0 +1,89 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+#include "config.h"
+
+#include "st-shadow.h"
+
+/**
+ * SECTION: st-shadow
+ * @short_description: Boxed type for -st-shadow attributes
+ *
+ * #StShadow is a boxed type for storing attributes of the -st-shadow
+ * property, modelled liberally after the CSS3 box-shadow property.
+ * See http://www.css3.info/preview/box-shadow/
+ *
+ */
+
+/**
+ * st_shadow_new:
+ * @color: shadow's color
+ * @xoffset: horizontal offset
+ * @yoffset: vertical offset
+ * @blur: blur radius
+ *
+ * Creates a new #StShadow
+ *
+ * Returns: the newly allocated shadow. Use st_shadow_free() when done
+ */
+StShadow *
+st_shadow_new (ClutterColor *color,
+ gdouble xoffset,
+ gdouble yoffset,
+ gdouble blur)
+{
+ StShadow *shadow;
+
+ shadow = g_slice_new (StShadow);
+
+ shadow->color = *color;
+ shadow->xoffset = xoffset;
+ shadow->yoffset = yoffset;
+ shadow->blur = blur;
+
+ return shadow;
+}
+
+/**
+ * st_shadow_copy:
+ * @shadow: a #StShadow
+ *
+ * Makes a copy of @shadow.
+ *
+ * Returns: an allocated copy of @shadow - the result must be freed with
+ * st_shadow_free() when done
+ */
+StShadow *
+st_shadow_copy (const StShadow *shadow)
+{
+ g_return_val_if_fail (shadow != NULL, NULL);
+
+ return g_slice_dup (StShadow, shadow);
+}
+
+/**
+ * st_shadow_free:
+ * @shadow: a #StShadow
+ *
+ * Frees the shadow structure created with st_shadow_new() or
+ * st_shadow_copy()
+ */
+void
+st_shadow_free (StShadow *shadow)
+{
+ g_return_if_fail (shadow != NULL);
+
+ g_slice_free (StShadow, shadow);
+}
+
+GType
+st_shadow_get_type (void)
+{
+ static GType _st_shadow_type = 0;
+
+ if (G_UNLIKELY (_st_shadow_type == 0))
+ _st_shadow_type =
+ g_boxed_type_register_static ("StShadow",
+ (GBoxedCopyFunc) st_shadow_copy,
+ (GBoxedFreeFunc) st_shadow_free);
+
+ return _st_shadow_type;
+}
diff --git a/src/st/st-shadow.h b/src/st/st-shadow.h
new file mode 100644
index 0000000..cf5bffb
--- /dev/null
+++ b/src/st/st-shadow.h
@@ -0,0 +1,42 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+#ifndef __ST_SHADOW__
+#define __ST_SHADOW__
+
+#include <clutter/clutter.h>
+
+G_BEGIN_DECLS
+
+#define ST_TYPE_SHADOW (st_shadow_get_type ())
+
+typedef struct _StShadow StShadow;
+
+/**
+ * StShadow:
+ * @color: shadow's color
+ * @xoffset: horizontal offset - positive values mean placement to the right,
+ * negative values placement to the left of the element.
+ * @yoffset: vertical offset - positive values mean placement below, negative
+ * values placement above the element.
+ * @blur: shadow's blur radius - a value of 0.0 will result in a hard shadow.
+ *
+ * Attributes of the -st-shadow property.
+ */
+struct _StShadow {
+ ClutterColor color;
+ gdouble xoffset;
+ gdouble yoffset;
+ gdouble blur;
+};
+
+GType st_shadow_get_type (void) G_GNUC_CONST;
+
+StShadow *st_shadow_new (ClutterColor *color,
+ gdouble xoffset,
+ gdouble yoffset,
+ gdouble blur);
+StShadow *st_shadow_copy (const StShadow *shadow);
+void st_shadow_free (StShadow *shadow);
+
+G_END_DECLS
+
+#endif /* __ST_SHADOW__ */
diff --git a/src/st/st-theme-node.c b/src/st/st-theme-node.c
index e9f2585..12b7f27 100644
--- a/src/st/st-theme-node.c
+++ b/src/st/st-theme-node.c
@@ -39,7 +39,7 @@ struct _StThemeNode {
char *background_image;
StBorderImage *border_image;
- StBoxShadow *box_shadow;
+ StShadow *shadow;
GType element_type;
char *element_id;
@@ -58,7 +58,7 @@ struct _StThemeNode {
guint background_computed : 1;
guint foreground_computed : 1;
guint border_image_computed : 1;
- guint box_shadow_computed : 1;
+ guint shadow_computed : 1;
guint link_type : 2;
};
@@ -120,10 +120,10 @@ st_theme_node_finalize (GObject *object)
node->border_image = NULL;
}
- if (node->box_shadow)
+ if (node->shadow)
{
- st_box_shadow_free (node->box_shadow);
- node->box_shadow = NULL;
+ st_shadow_free (node->shadow);
+ node->shadow = NULL;
}
if (node->background_image)
@@ -2122,7 +2122,7 @@ st_theme_node_get_border_image (StThemeNode *node)
}
/**
- * st_theme_node_get_box_shadow:
+ * st_theme_node_get_shadow:
* @node: a #StThemeNode
*
* Gets the value for the box-shadow style property
@@ -2130,16 +2130,16 @@ st_theme_node_get_border_image (StThemeNode *node)
* Return value: (transfer none): the box shadow, or %NULL
* if there is no box shadow.
*/
-StBoxShadow *
-st_theme_node_get_box_shadow (StThemeNode *node)
+StShadow *
+st_theme_node_get_shadow (StThemeNode *node)
{
int i;
- if (node->box_shadow_computed)
- return node->box_shadow;
+ if (node->shadow_computed)
+ return node->shadow;
- node->box_shadow = NULL;
- node->box_shadow_computed = TRUE;
+ node->shadow = NULL;
+ node->shadow_computed = TRUE;
ensure_properties (node);
@@ -2194,10 +2194,9 @@ st_theme_node_get_box_shadow (StThemeNode *node)
continue;
}
}
- node->box_shadow = st_box_shadow_new (&color,
- xoffset, yoffset, blur);
+ node->shadow = st_shadow_new (&color, xoffset, yoffset, blur);
- return node->box_shadow;
+ return node->shadow;
}
}
return NULL;
diff --git a/src/st/st-theme-node.h b/src/st/st-theme-node.h
index b46a75e..31fb08e 100644
--- a/src/st/st-theme-node.h
+++ b/src/st/st-theme-node.h
@@ -4,7 +4,7 @@
#include <clutter/clutter.h>
#include "st-border-image.h"
-#include "st-box-shadow.h"
+#include "st-shadow.h"
G_BEGIN_DECLS
@@ -143,7 +143,7 @@ StTextDecoration st_theme_node_get_text_decoration (StThemeNode *node);
const PangoFontDescription *st_theme_node_get_font (StThemeNode *node);
StBorderImage *st_theme_node_get_border_image (StThemeNode *node);
-StBoxShadow *st_theme_node_get_box_shadow (StThemeNode *node);
+StShadow *st_theme_node_get_shadow (StThemeNode *node);
/* Helpers for get_preferred_width()/get_preferred_height() ClutterActor vfuncs */
void st_theme_node_adjust_for_height (StThemeNode *node,
diff --git a/src/st/st-widget.c b/src/st/st-widget.c
index 29a8c32..118b81c 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -704,7 +704,7 @@ st_widget_real_style_changed (StWidget *self)
StWidgetPrivate *priv = ST_WIDGET (self)->priv;
StThemeNode *theme_node;
StBorderImage *border_image;
- StBoxShadow *box_shadow;
+ StShadow *shadow;
StTextureCache *texture_cache;
ClutterTexture *texture;
const char *bg_file = NULL;
@@ -942,17 +942,17 @@ st_widget_real_style_changed (StWidget *self)
* Note that the current implementation only takes the background-image property into
* account though.
*/
- box_shadow = st_theme_node_get_box_shadow (theme_node);
- if (box_shadow != NULL)
+ shadow = st_theme_node_get_shadow (theme_node);
+ if (shadow != NULL)
{
- priv->shadow_xoffset = box_shadow->xoffset;
- priv->shadow_yoffset = box_shadow->yoffset;
+ priv->shadow_xoffset = shadow->xoffset;
+ priv->shadow_yoffset = shadow->yoffset;
if (priv->background_image)
priv->background_image_shadow =
st_shadow_texture_new (priv->background_image,
- &box_shadow->color,
- box_shadow->blur);
+ &shadow->color,
+ shadow->blur);
if (priv->background_image_shadow)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]