abort all drags when the view is closed

This commit is contained in:
Tom Beckmann 2014-06-23 23:14:17 +02:00
parent e00c49f1a7
commit 4971e9b26e
2 changed files with 22 additions and 0 deletions

View File

@ -330,6 +330,26 @@ namespace Gala
drag_canceled ();
}
/**
* Allows you to abort all drags currently running for a given drag-id
*/
public static void cancel_all_by_id (string id)
{
var actors = sources.@get (id);
if (actors == null)
return;
foreach (var actor in actors) {
foreach (var action in actor.get_actions ()) {
var drag_action = action as DragDropAction;
if (drag_action != null && drag_action.dragging) {
drag_action.cancel ();
break;
}
}
}
}
void finish ()
{
// make sure they reset the style or whatever they changed when hovered

View File

@ -342,6 +342,8 @@ namespace Gala
grab_key_focus ();
icon_groups.y = height - WorkspaceClone.BOTTOM_OFFSET + 20;
} else {
DragDropAction.cancel_all_by_id ("multitaskingview-window");
}
// find active workspace clone and raise it, so there are no overlaps while transitioning