From 397f3228608b1c7c26f16767742851fb94ca7cc7 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Wed, 2 May 2012 18:08:02 -0400 Subject: [PATCH] ClutterDropAction: Added "drop-cancel" signal. The drop-cancel signal allows the drop action to cleanup its state if the can-drop signal is refused. This is especially useful if the drop action (or its target actor) is managing any drop target animations. https://bugzilla.gnome.org/show_bug.cgi?id=675336 --- clutter/clutter-drop-action.c | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/clutter/clutter-drop-action.c b/clutter/clutter-drop-action.c index e91a3cdcc..4fec01996 100644 --- a/clutter/clutter-drop-action.c +++ b/clutter/clutter-drop-action.c @@ -101,6 +101,7 @@ enum OVER_IN, OVER_OUT, DROP, + DROP_CANCEL, LAST_SIGNAL }; @@ -227,6 +228,13 @@ out: clutter_actor_meta_get_actor (meta), event_x, event_y); } + else + { + g_signal_emit (data->last_action, drop_signals[DROP_CANCEL], 0, + clutter_actor_meta_get_actor (meta), + event_x, event_y); + } + } data->last_action = NULL; @@ -458,6 +466,34 @@ clutter_drop_action_class_init (ClutterDropActionClass *klass) CLUTTER_TYPE_ACTOR, G_TYPE_FLOAT, G_TYPE_FLOAT); + + + /** + * ClutterDropAction::drop-cancel: + * @action: the #ClutterDropAction that emitted the signal + * @actor: the #ClutterActor attached to the @action + * @event_x: the X coordinate (in stage space) of the drop event + * @event_y: the Y coordinate (in stage space) of the drop event + * + * The ::drop-cancel signal is emitted when the drop is refused + * by an emission of the #ClutterDropAction::can-drop signal. + * + * After the ::drop-cancel signal is fired the active drag is + * terminated. + * + * Since: 1.12 + */ + drop_signals[DROP_CANCEL] = + g_signal_new (I_("drop-cancel"), + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ClutterDropActionClass, drop), + NULL, NULL, + _clutter_marshal_VOID__OBJECT_FLOAT_FLOAT, + G_TYPE_NONE, 3, + CLUTTER_TYPE_ACTOR, + G_TYPE_FLOAT, + G_TYPE_FLOAT); } static void