[gnome-shell] appDisplay: Animate DnD app icons at the position they were dropped
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] appDisplay: Animate DnD app icons at the position they were dropped
- Date: Wed, 18 Sep 2019 17:20:45 +0000 (UTC)
commit f8e648b7e35e0acef5f922fc64164caa7bdd46e3
Author: Jonas Dreßler <verdre v0yd nl>
Date: Sun Sep 15 11:45:47 2019 +0200
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
js/ui/workspace.js | 3 +++
js/ui/workspaceThumbnail.js | 14 ++++++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 92f9622f2d..3177928320 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -2032,6 +2032,9 @@ var Workspace = class {
metaWindow.change_workspace_by_index(workspaceIndex, false);
return true;
} 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);
return true;
} else if (!source.app && source.shellWorkspaceLaunch) {
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index 91286e2b35..206fbd8632 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -561,7 +561,7 @@ var WorkspaceThumbnail = GObject.registerClass({
}
// Draggable target interface used only by ThumbnailsBox
- handleDragOverInternal(source, time) {
+ handleDragOverInternal(source, actor, time) {
if (source == Main.xdndHandler) {
this.metaWorkspace.activate(time);
return DND.DragMotionResult.CONTINUE;
@@ -580,7 +580,7 @@ var WorkspaceThumbnail = GObject.registerClass({
return DND.DragMotionResult.CONTINUE;
}
- acceptDropInternal(source, time) {
+ acceptDropInternal(source, actor, time) {
if (this.state > ThumbnailState.NORMAL)
return false;
@@ -600,6 +600,9 @@ var WorkspaceThumbnail = GObject.registerClass({
metaWindow.change_workspace_by_index(this.metaWorkspace.index(), false);
return true;
} 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());
return true;
} else if (!source.app && source.shellWorkspaceLaunch) {
@@ -835,7 +838,7 @@ var ThumbnailsBox = GObject.registerClass({
}
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)
return source.realWindow ? DND.DragMotionResult.MOVE_DROP : DND.DragMotionResult.COPY_DROP;
else
@@ -844,7 +847,7 @@ var ThumbnailsBox = GObject.registerClass({
acceptDrop(source, actor, x, y, time) {
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) {
if (!source.realWindow &&
(!source.app || !source.app.can_open_new_window()) &&
@@ -866,6 +869,9 @@ var ThumbnailsBox = GObject.registerClass({
source.metaWindow.move_to_monitor(thumbMonitor);
source.metaWindow.change_workspace_by_index(newWorkspaceIndex, true);
} 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);
} else if (!source.app && source.shellWorkspaceLaunch) {
// While unused in our own drag sources, shellWorkspaceLaunch allows
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]