[gnome-shell/wip/clutter-deprecation-fixes: 9/21] st-widget: Add st_widget_paint_background
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/clutter-deprecation-fixes: 9/21] st-widget: Add st_widget_paint_background
- Date: Tue, 14 Feb 2012 22:02:12 +0000 (UTC)
commit 738137216a6ba85c466d280d9f07b8b2a81e15f8
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Feb 13 16:41:29 2012 -0500
st-widget: Add st_widget_paint_background
Some actors do dirty things like chaining up to their parent's
parent in order to paint the CSS elements but skip painting
the children. Let's add a new public st_widget_paint_background
method intended to help these vfunc overrides.
https://bugzilla.gnome.org/show_bug.cgi?id=670034
src/shell-slicer.c | 3 +--
src/st/st-box-layout.c | 2 +-
src/st/st-icon.c | 3 +--
src/st/st-label.c | 4 +---
src/st/st-scroll-view.c | 9 +++++----
src/st/st-widget.c | 32 ++++++++++++++++++++++++--------
src/st/st-widget.h | 1 +
7 files changed, 34 insertions(+), 20 deletions(-)
---
diff --git a/src/shell-slicer.c b/src/shell-slicer.c
index c6a9915..986214e 100644
--- a/src/shell-slicer.c
+++ b/src/shell-slicer.c
@@ -134,8 +134,7 @@ shell_slicer_paint_child (ShellSlicer *self)
static void
shell_slicer_paint (ClutterActor *self)
{
- /* StWidget paints CSS elements */
- CLUTTER_ACTOR_CLASS (g_type_class_peek (st_widget_get_type ()))->paint (self);
+ st_widget_paint_background (ST_WIDGET (self));
shell_slicer_paint_child (SHELL_SLICER (self));
}
diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c
index 453a3c2..c57b7e0 100644
--- a/src/st/st-box-layout.c
+++ b/src/st/st-box-layout.c
@@ -915,7 +915,7 @@ st_box_layout_paint (ClutterActor *actor)
cogl_translate ((int)x, (int)y, 0);
}
- CLUTTER_ACTOR_CLASS (st_box_layout_parent_class)->paint (actor);
+ st_widget_paint_background (ST_WIDGET (actor));
if (x != 0 || y != 0)
{
diff --git a/src/st/st-icon.c b/src/st/st-icon.c
index c2c4205..45c2122 100644
--- a/src/st/st-icon.c
+++ b/src/st/st-icon.c
@@ -263,8 +263,7 @@ st_icon_paint (ClutterActor *actor)
{
StIconPrivate *priv = ST_ICON (actor)->priv;
- /* Chain up to paint background */
- CLUTTER_ACTOR_CLASS (st_icon_parent_class)->paint (actor);
+ st_widget_paint_background (ST_WIDGET (actor));
if (priv->icon_texture)
{
diff --git a/src/st/st-label.c b/src/st/st-label.c
index dfb1428..594b5d8 100644
--- a/src/st/st-label.c
+++ b/src/st/st-label.c
@@ -207,12 +207,10 @@ static void
st_label_paint (ClutterActor *actor)
{
StLabelPrivate *priv = ST_LABEL (actor)->priv;
- ClutterActorClass *parent_class;
StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
StShadow *shadow_spec = st_theme_node_get_text_shadow (theme_node);
- parent_class = CLUTTER_ACTOR_CLASS (st_label_parent_class);
- parent_class->paint (actor);
+ st_widget_paint_background (ST_WIDGET (actor));
if (shadow_spec)
{
diff --git a/src/st/st-scroll-view.c b/src/st/st-scroll-view.c
index c4a2796..3dd9327 100644
--- a/src/st/st-scroll-view.c
+++ b/src/st/st-scroll-view.c
@@ -266,10 +266,10 @@ st_scroll_view_paint (ClutterActor *actor)
{
StScrollViewPrivate *priv = ST_SCROLL_VIEW (actor)->priv;
- /* StBin will paint the child */
- CLUTTER_ACTOR_CLASS (st_scroll_view_parent_class)->paint (actor);
+ st_widget_paint_background (ST_WIDGET (actor));
- /* paint our custom children */
+ if (priv->child)
+ clutter_actor_paint (priv->child);
if (priv->hscrollbar_visible)
clutter_actor_paint (priv->hscroll);
if (priv->vscrollbar_visible)
@@ -285,7 +285,8 @@ st_scroll_view_pick (ClutterActor *actor,
/* Chain up so we get a bounding box pained (if we are reactive) */
CLUTTER_ACTOR_CLASS (st_scroll_view_parent_class)->pick (actor, color);
- /* paint our custom children */
+ if (priv->child)
+ clutter_actor_paint (priv->child);
if (priv->hscrollbar_visible)
clutter_actor_paint (priv->hscroll);
if (priv->vscrollbar_visible)
diff --git a/src/st/st-widget.c b/src/st/st-widget.c
index c0214a1..b8e5e57 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -414,22 +414,29 @@ st_widget_allocate (ClutterActor *actor,
}
}
-static void
-st_widget_paint (ClutterActor *actor)
+/**
+ * st_widget_paint_background:
+ * @widget: The #StWidget
+ *
+ * Paint the background of the widget. This is meant to be called by
+ * subclasses of StWiget that need to paint the background without
+ * painting children.
+ */
+void
+st_widget_paint_background (StWidget *widget)
{
- StWidget *self = ST_WIDGET (actor);
StThemeNode *theme_node;
ClutterActorBox allocation;
guint8 opacity;
- theme_node = st_widget_get_theme_node (self);
+ theme_node = st_widget_get_theme_node (widget);
- clutter_actor_get_allocation_box (actor, &allocation);
+ clutter_actor_get_allocation_box (CLUTTER_ACTOR (widget), &allocation);
- opacity = clutter_actor_get_paint_opacity (actor);
+ opacity = clutter_actor_get_paint_opacity (CLUTTER_ACTOR (widget));
- if (self->priv->transition_animation)
- st_theme_node_transition_paint (self->priv->transition_animation,
+ if (widget->priv->transition_animation)
+ st_theme_node_transition_paint (widget->priv->transition_animation,
&allocation,
opacity);
else
@@ -437,6 +444,15 @@ st_widget_paint (ClutterActor *actor)
}
static void
+st_widget_paint (ClutterActor *actor)
+{
+ st_widget_paint_background (ST_WIDGET (actor));
+
+ /* Chain up so we paint children. */
+ CLUTTER_ACTOR_CLASS (st_widget_parent_class)->paint (actor);
+}
+
+static void
st_widget_parent_set (ClutterActor *widget,
ClutterActor *old_parent)
{
diff --git a/src/st/st-widget.h b/src/st/st-widget.h
index e4a57fb..db8e162 100644
--- a/src/st/st-widget.h
+++ b/src/st/st-widget.h
@@ -164,6 +164,7 @@ StThemeNode * st_widget_get_theme_node (StWidget *widg
StThemeNode * st_widget_peek_theme_node (StWidget *widget);
GList * st_widget_get_focus_chain (StWidget *widget);
+void st_widget_paint_background (StWidget *widget);
/* debug methods */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]