[gnome-shell/gbsneto/custom-icon-positions: 28/38] appDisplay: Restore dragged item's position on drag cancel
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/custom-icon-positions: 28/38] appDisplay: Restore dragged item's position on drag cancel
- Date: Thu, 9 Jul 2020 20:48:10 +0000 (UTC)
commit eff0dc1f86e7e025f585eac71216fe7475e583d7
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Jun 23 10:33:22 2020 -0300
appDisplay: Restore dragged item's position on drag cancel
Otherwise we end up with the grid in an inconsistent state.
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
js/ui/appDisplay.js | 15 +++++++++++++++
1 file changed, 15 insertions(+)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index c5c5514545..85685d19e0 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -650,6 +650,7 @@ class AppDisplay extends BaseAppView {
Main.overview.connect('item-drag-begin', this._onDragBegin.bind(this));
Main.overview.connect('item-drag-end', this._onDragEnd.bind(this));
+ Main.overview.connect('item-drag-cancelled', this._onDragCancelled.bind(this));
this.connect('destroy', this._onDestroy.bind(this));
@@ -1073,6 +1074,20 @@ class AppDisplay extends BaseAppView {
this._removeNudge();
}
+ _onDragCancelled(_overview, source) {
+ const view = _getViewFromIcon(source);
+
+ if (view instanceof FolderView)
+ return;
+
+ // Restore all icon positions, since they may have reflowed
+ // to different pages
+ for (const item of this._orderedItems) {
+ const [page, position] = this._getItemPosition(item);
+ this.moveItem(item, page, position);
+ }
+ }
+
_canAccept(source) {
return source instanceof AppViewItem;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]