drag-action: fix press coords transform with drag_handle

When setting a drag handle, transform the original press
coordinates using the drag handle as reference instead of the
associated actor.

This causes the initial misplacement of drag handle in
example/drag-action when holding down the Shift key: the handle
gets placed at the main actor origin on the first drag event,
instead of following the mouse pointer.

All subsequent motion events already use the right actor when
transforming the coordinates, thus they are not affected.

https://bugzilla.gnome.org/show_bug.cgi?id=681746
This commit is contained in:
Emanuele Aina 2012-08-10 20:47:46 +02:00 committed by Emmanuele Bassi
parent 7b6ce3fd88
commit 59801ef854

View File

@ -1106,6 +1106,12 @@ clutter_drag_action_set_drag_handle (ClutterDragAction *action,
priv->drag_handle = handle; priv->drag_handle = handle;
priv->transformed_press_x = priv->press_x;
priv->transformed_press_y = priv->press_y;
clutter_actor_transform_stage_point (handle, priv->press_x, priv->press_y,
&priv->transformed_press_x,
&priv->transformed_press_y);
if (priv->drag_handle != NULL) if (priv->drag_handle != NULL)
g_signal_connect (priv->drag_handle, "destroy", g_signal_connect (priv->drag_handle, "destroy",
G_CALLBACK (on_drag_handle_destroy), G_CALLBACK (on_drag_handle_destroy),