appDisplay: Animate DnD app icons at the position they were dropped
Indicate whether dropping an app icon was successful or not by using the newly added `animateLaunchAtPos()` API of AppIcon which starts a zoom out animation of the icon at the position the drop happened. To get the position of the drag actor, we have to forward the arguments passed to `acceptDrop()` and `handleDragOver()` to the internal drag handlers of the WorkspaceThumbnails. We can use this position directly without transforming it to stage coordinates because the actor is a child of `Main.uiGroup` and the animation actor will also be a child of this container. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/121
This commit is contained in:
parent
daa5452af2
commit
f8e648b7e3
@ -2032,6 +2032,9 @@ var Workspace = class {
|
|||||||
metaWindow.change_workspace_by_index(workspaceIndex, false);
|
metaWindow.change_workspace_by_index(workspaceIndex, false);
|
||||||
return true;
|
return true;
|
||||||
} else if (source.app && source.app.can_open_new_window()) {
|
} else if (source.app && source.app.can_open_new_window()) {
|
||||||
|
if (source.animateLaunchAtPos)
|
||||||
|
source.animateLaunchAtPos(actor.x, actor.y);
|
||||||
|
|
||||||
source.app.open_new_window(workspaceIndex);
|
source.app.open_new_window(workspaceIndex);
|
||||||
return true;
|
return true;
|
||||||
} else if (!source.app && source.shellWorkspaceLaunch) {
|
} else if (!source.app && source.shellWorkspaceLaunch) {
|
||||||
|
@ -561,7 +561,7 @@ var WorkspaceThumbnail = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draggable target interface used only by ThumbnailsBox
|
// Draggable target interface used only by ThumbnailsBox
|
||||||
handleDragOverInternal(source, time) {
|
handleDragOverInternal(source, actor, time) {
|
||||||
if (source == Main.xdndHandler) {
|
if (source == Main.xdndHandler) {
|
||||||
this.metaWorkspace.activate(time);
|
this.metaWorkspace.activate(time);
|
||||||
return DND.DragMotionResult.CONTINUE;
|
return DND.DragMotionResult.CONTINUE;
|
||||||
@ -580,7 +580,7 @@ var WorkspaceThumbnail = GObject.registerClass({
|
|||||||
return DND.DragMotionResult.CONTINUE;
|
return DND.DragMotionResult.CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
acceptDropInternal(source, time) {
|
acceptDropInternal(source, actor, time) {
|
||||||
if (this.state > ThumbnailState.NORMAL)
|
if (this.state > ThumbnailState.NORMAL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -600,6 +600,9 @@ var WorkspaceThumbnail = GObject.registerClass({
|
|||||||
metaWindow.change_workspace_by_index(this.metaWorkspace.index(), false);
|
metaWindow.change_workspace_by_index(this.metaWorkspace.index(), false);
|
||||||
return true;
|
return true;
|
||||||
} else if (source.app && source.app.can_open_new_window()) {
|
} else if (source.app && source.app.can_open_new_window()) {
|
||||||
|
if (source.animateLaunchAtPos)
|
||||||
|
source.animateLaunchAtPos(actor.x, actor.y);
|
||||||
|
|
||||||
source.app.open_new_window(this.metaWorkspace.index());
|
source.app.open_new_window(this.metaWorkspace.index());
|
||||||
return true;
|
return true;
|
||||||
} else if (!source.app && source.shellWorkspaceLaunch) {
|
} else if (!source.app && source.shellWorkspaceLaunch) {
|
||||||
@ -835,7 +838,7 @@ var ThumbnailsBox = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this._dropWorkspace != -1)
|
if (this._dropWorkspace != -1)
|
||||||
return this._thumbnails[this._dropWorkspace].handleDragOverInternal(source, time);
|
return this._thumbnails[this._dropWorkspace].handleDragOverInternal(source, actor, time);
|
||||||
else if (this._dropPlaceholderPos != -1)
|
else if (this._dropPlaceholderPos != -1)
|
||||||
return source.realWindow ? DND.DragMotionResult.MOVE_DROP : DND.DragMotionResult.COPY_DROP;
|
return source.realWindow ? DND.DragMotionResult.MOVE_DROP : DND.DragMotionResult.COPY_DROP;
|
||||||
else
|
else
|
||||||
@ -844,7 +847,7 @@ var ThumbnailsBox = GObject.registerClass({
|
|||||||
|
|
||||||
acceptDrop(source, actor, x, y, time) {
|
acceptDrop(source, actor, x, y, time) {
|
||||||
if (this._dropWorkspace != -1) {
|
if (this._dropWorkspace != -1) {
|
||||||
return this._thumbnails[this._dropWorkspace].acceptDropInternal(source, time);
|
return this._thumbnails[this._dropWorkspace].acceptDropInternal(source, actor, time);
|
||||||
} else if (this._dropPlaceholderPos != -1) {
|
} else if (this._dropPlaceholderPos != -1) {
|
||||||
if (!source.realWindow &&
|
if (!source.realWindow &&
|
||||||
(!source.app || !source.app.can_open_new_window()) &&
|
(!source.app || !source.app.can_open_new_window()) &&
|
||||||
@ -866,6 +869,9 @@ var ThumbnailsBox = GObject.registerClass({
|
|||||||
source.metaWindow.move_to_monitor(thumbMonitor);
|
source.metaWindow.move_to_monitor(thumbMonitor);
|
||||||
source.metaWindow.change_workspace_by_index(newWorkspaceIndex, true);
|
source.metaWindow.change_workspace_by_index(newWorkspaceIndex, true);
|
||||||
} else if (source.app && source.app.can_open_new_window()) {
|
} else if (source.app && source.app.can_open_new_window()) {
|
||||||
|
if (source.animateLaunchAtPos)
|
||||||
|
source.animateLaunchAtPos(actor.x, actor.y);
|
||||||
|
|
||||||
source.app.open_new_window(newWorkspaceIndex);
|
source.app.open_new_window(newWorkspaceIndex);
|
||||||
} else if (!source.app && source.shellWorkspaceLaunch) {
|
} else if (!source.app && source.shellWorkspaceLaunch) {
|
||||||
// While unused in our own drag sources, shellWorkspaceLaunch allows
|
// While unused in our own drag sources, shellWorkspaceLaunch allows
|
||||||
|
Loading…
Reference in New Issue
Block a user