[clutter] scroll-actor: Implement pick()
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] scroll-actor: Implement pick()
- Date: Mon, 14 May 2012 09:36:43 +0000 (UTC)
commit 39a4929d75bb882551cd51632befd02c0c2fcf4b
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Mon May 14 10:33:13 2012 +0100
scroll-actor: Implement pick()
We need to clip the children during picking as well as we do when
painting, to avoid reactive children outside of the visible area
receiving events.
This also allows us to refactor some common code into proper functions.
clutter/clutter-scroll-actor.c | 48 ++++++++++++++++++++++++++++++---------
1 files changed, 37 insertions(+), 11 deletions(-)
---
diff --git a/clutter/clutter-scroll-actor.c b/clutter/clutter-scroll-actor.c
index 2cb71b1..888dd59 100644
--- a/clutter/clutter-scroll-actor.c
+++ b/clutter/clutter-scroll-actor.c
@@ -113,8 +113,8 @@ clutter_scroll_actor_apply_transform (ClutterActor *actor,
cogl_matrix_translate (transform, x_factor, y_factor, 0.0f);
}
-static void
-clutter_scroll_actor_paint (ClutterActor *actor)
+static inline void
+clutter_scroll_actor_push_clip (ClutterActor *actor)
{
ClutterScrollActorPrivate *priv = CLUTTER_SCROLL_ACTOR (actor)->priv;
ClutterActorBox allocation;
@@ -139,6 +139,12 @@ clutter_scroll_actor_paint (ClutterActor *actor)
y,
x + width,
y + height);
+}
+
+static void
+clutter_scroll_actor_paint (ClutterActor *actor)
+{
+ clutter_scroll_actor_push_clip (actor);
CLUTTER_ACTOR_CLASS (clutter_scroll_actor_parent_class)->paint (actor);
@@ -146,6 +152,32 @@ clutter_scroll_actor_paint (ClutterActor *actor)
}
static void
+clutter_scroll_actor_pick (ClutterActor *actor,
+ const ClutterColor *pick_color)
+{
+ clutter_scroll_actor_push_clip (actor);
+
+ CLUTTER_ACTOR_CLASS (clutter_scroll_actor_parent_class)->pick (actor, pick_color);
+
+ cogl_clip_pop ();
+}
+
+static void
+clutter_scroll_actor_set_scroll_to_internal (ClutterScrollActor *self,
+ const ClutterPoint *point)
+{
+ ClutterScrollActorPrivate *priv = self->priv;
+ ClutterActor *actor = CLUTTER_ACTOR (self);
+
+ if (point == NULL)
+ clutter_point_init (&priv->scroll_to, 0.f, 0.f);
+ else
+ priv->scroll_to = *point;
+
+ clutter_actor_queue_redraw (actor);
+}
+
+static void
clutter_scroll_actor_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
@@ -196,6 +228,7 @@ clutter_scroll_actor_class_init (ClutterScrollActorClass *klass)
actor_class->apply_transform = clutter_scroll_actor_apply_transform;
actor_class->paint = clutter_scroll_actor_paint;
+ actor_class->pick = clutter_scroll_actor_pick;
/**
* ClutterScrollActor:scroll-mode:
@@ -245,12 +278,7 @@ clutter_scroll_actor_set_final_state (ClutterAnimatable *animatable,
ClutterScrollActor *self = CLUTTER_SCROLL_ACTOR (animatable);
const ClutterPoint *point = g_value_get_boxed (value);
- if (point == NULL)
- clutter_point_init (&self->priv->scroll_to, 0.f, 0.f);
- else
- self->priv->scroll_to = *point;
-
- clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
+ clutter_scroll_actor_set_scroll_to_internal (self, point);
}
else
parent_animatable_iface->set_final_state (animatable, property_name, value);
@@ -404,9 +432,7 @@ clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
priv->transition = NULL;
}
- priv->scroll_to = *point;
-
- clutter_actor_queue_redraw (CLUTTER_ACTOR (actor));
+ clutter_scroll_actor_set_scroll_to_internal (actor, point);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]