[gnome-shell/gbsneto/icon-grid-dnd-fixes: 3/14] appDisplay: Use new moveItem API to move items
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/icon-grid-dnd-fixes: 3/14] appDisplay: Use new moveItem API to move items
- Date: Thu, 24 Sep 2020 23:28:11 +0000 (UTC)
commit e92c201866539116ac7a56988830025893197f3c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Sep 23 16:53:17 2020 -0300
appDisplay: Use new moveItem API to move items
This uses the API added in the previous commit. The intent here
is to avoid removing and readding actors when moving them around.
Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3165
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447
js/ui/appDisplay.js | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 9094fcf038..3f2f605429 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -746,10 +746,14 @@ var BaseAppView = GObject.registerClass({
if (page === newPage && position === newPosition)
return;
- if (page !== -1 && position !== -1)
- this._removeItem(item);
+ // Update the _orderedItems array
+ let index = this._orderedItems.indexOf(item);
+ this._orderedItems.splice(index, 1);
- this._addItem(item, newPage, newPosition);
+ index = this._getLinearPosition(newPage, newPosition);
+ this._orderedItems.splice(index, 0, item);
+
+ this._grid.moveItem(item, newPage, newPosition);
}
vfunc_allocate(box) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]