[gnome-shell/gbsneto/custom-icon-positions: 33/38] appDisplay: Only handle DnD when mapped
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/custom-icon-positions: 33/38] appDisplay: Only handle DnD when mapped
- Date: Thu, 9 Jul 2020 20:48:35 +0000 (UTC)
commit 7372ed492e70e2a278f51462d683ec50aa32eed0
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Jun 24 14:56:32 2020 -0300
appDisplay: Only handle DnD when mapped
Now that the DnD code is shared between AppDisplay and
FolderView, we hit an unexpected problem: FolderView is
handling drag events even when the folder dialog is hidden.
As a side effect, this spams the journal with warnings.
Only handle drag events when mapped. On unmap, disable
the view's drag monitor, and disconnect from all drag
events.
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284
js/ui/appDisplay.js | 64 +++++++++++++++++++++++++++++++----------------------
1 file changed, 37 insertions(+), 27 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 5bb86d0dab..f72f649a79 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -198,39 +198,16 @@ var BaseAppView = GObject.registerClass({
this._targetDropPosition = null;
this._nudgedItem = null;
- this._dragBeginId =
- Main.overview.connect('item-drag-begin', this._onDragBegin.bind(this));
- this._dragEndId =
- Main.overview.connect('item-drag-end', this._onDragEnd.bind(this));
- this._dragCancelledId =
- Main.overview.connect('item-drag-cancelled', this._onDragCancelled.bind(this));
+ this._dragBeginId = 0;
+ this._dragEndId = 0;
+ this._dragCancelledId = 0;
this.connect('destroy', this._onDestroy.bind(this));
}
_onDestroy() {
this._removeDelayedMove();
-
- if (this._dragBeginId > 0) {
- Main.overview.disconnect(this._dragBeginId);
- this._dragBeginId = 0;
- }
-
- if (this._dragEndId > 0) {
- Main.overview.disconnect(this._dragEndId);
- this._dragEndId = 0;
- }
-
- if (this._dragCancelledId > 0) {
- Main.overview.disconnect(this._dragCancelledId);
- this._dragCancelledId = 0;
- }
-
- if (this._dragMonitor) {
- DND.removeDragMonitor(this._dragMonitor);
- this._dragMonitor = null;
- }
-
+ this._disconnectDnD();
}
_createGrid() {
@@ -317,6 +294,37 @@ var BaseAppView = GObject.registerClass({
});
}
+ _connectDnD() {
+ this._dragBeginId =
+ Main.overview.connect('item-drag-begin', this._onDragBegin.bind(this));
+ this._dragEndId =
+ Main.overview.connect('item-drag-end', this._onDragEnd.bind(this));
+ this._dragCancelledId =
+ Main.overview.connect('item-drag-cancelled', this._onDragCancelled.bind(this));
+ }
+
+ _disconnectDnD() {
+ if (this._dragBeginId > 0) {
+ Main.overview.disconnect(this._dragBeginId);
+ this._dragBeginId = 0;
+ }
+
+ if (this._dragEndId > 0) {
+ Main.overview.disconnect(this._dragEndId);
+ this._dragEndId = 0;
+ }
+
+ if (this._dragCancelledId > 0) {
+ Main.overview.disconnect(this._dragCancelledId);
+ this._dragCancelledId = 0;
+ }
+
+ if (this._dragMonitor) {
+ DND.removeDragMonitor(this._dragMonitor);
+ this._dragMonitor = null;
+ }
+ }
+
_maybeMoveItem(dragEvent) {
const [success, x, y] =
this._grid.transform_stage_point(dragEvent.x, dragEvent.y);
@@ -702,12 +710,14 @@ var BaseAppView = GObject.registerClass({
vfunc_map() {
this._swipeTracker.enabled = true;
+ this._connectDnD();
super.vfunc_map();
}
vfunc_unmap() {
this._swipeTracker.enabled = false;
this._clearAnimateLater();
+ this._disconnectDnD();
super.vfunc_unmap();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]