diff --git a/src/DragDropAction.vala b/src/DragDropAction.vala index a0fd58d7..b51d704b 100644 --- a/src/DragDropAction.vala +++ b/src/DragDropAction.vala @@ -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 diff --git a/src/Widgets/MultitaskingView/MultitaskingView.vala b/src/Widgets/MultitaskingView/MultitaskingView.vala index 61a00003..aeefc95d 100644 --- a/src/Widgets/MultitaskingView/MultitaskingView.vala +++ b/src/Widgets/MultitaskingView/MultitaskingView.vala @@ -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