[clutter] stage: Allow tracking dragged actors
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] stage: Allow tracking dragged actors
- Date: Mon, 20 Jun 2011 14:40:21 +0000 (UTC)
commit 530a13f02f710710607732ed21b1493f04931615
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Fri Jun 17 16:51:05 2011 +0100
stage: Allow tracking dragged actors
We should be able to internally attach the actor currently being dragged
to the device that is dragging it.
https://bugzilla.gnome.org/show_bug.cgi?id=652842
clutter/clutter-stage-private.h | 8 ++++++
clutter/clutter-stage.c | 48 +++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-stage-private.h b/clutter/clutter-stage-private.h
index 07ac99d..9911f38 100644
--- a/clutter/clutter-stage-private.h
+++ b/clutter/clutter-stage-private.h
@@ -99,6 +99,14 @@ void _clutter_stage_release_pick_id (ClutterStage *stage,
ClutterActor * _clutter_stage_get_actor_by_pick_id (ClutterStage *stage,
gint32 pick_id);
+void _clutter_stage_add_drag_actor (ClutterStage *stage,
+ ClutterInputDevice *device,
+ ClutterActor *actor);
+ClutterActor * _clutter_stage_get_drag_actor (ClutterStage *stage,
+ ClutterInputDevice *device);
+void _clutter_stage_remove_drag_actor (ClutterStage *stage,
+ ClutterInputDevice *device);
+
G_END_DECLS
#endif /* __CLUTTER_STAGE_PRIVATE_H__ */
diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c
index 10190a9..e045406 100644
--- a/clutter/clutter-stage.c
+++ b/clutter/clutter-stage.c
@@ -4091,3 +4091,51 @@ _clutter_stage_get_actor_by_pick_id (ClutterStage *stage,
return _clutter_id_pool_lookup (priv->pick_id_pool, pick_id);
}
+
+void
+_clutter_stage_add_drag_actor (ClutterStage *stage,
+ ClutterInputDevice *device,
+ ClutterActor *actor)
+{
+ GHashTable *drag_actors;
+
+ drag_actors = g_object_get_data (G_OBJECT (stage), "__clutter_stage_drag_actors");
+ if (drag_actors == NULL)
+ {
+ drag_actors = g_hash_table_new (NULL, NULL);
+ g_object_set_data_full (G_OBJECT (stage), "__clutter_stage_drag_actors",
+ drag_actors,
+ (GDestroyNotify) g_hash_table_destroy);
+ }
+
+ g_hash_table_replace (drag_actors, device, actor);
+}
+
+ClutterActor *
+_clutter_stage_get_drag_actor (ClutterStage *stage,
+ ClutterInputDevice *device)
+{
+ GHashTable *drag_actors;
+
+ drag_actors = g_object_get_data (G_OBJECT (stage), "__clutter_stage_drag_actors");
+ if (drag_actors == NULL)
+ return NULL;
+
+ return g_hash_table_lookup (drag_actors, device);
+}
+
+void
+_clutter_stage_remove_drag_actor (ClutterStage *stage,
+ ClutterInputDevice *device)
+{
+ GHashTable *drag_actors;
+
+ drag_actors = g_object_get_data (G_OBJECT (stage), "__clutter_stage_drag_actors");
+ if (drag_actors == NULL)
+ return;
+
+ g_hash_table_remove (drag_actors, device);
+
+ if (g_hash_table_size (drag_actors) == 0)
+ g_object_set_data (G_OBJECT (stage), "__clutter_stage_drag_actors", NULL);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]