[gnome-shell/gbsneto/icon-grid-dnd: 38/41] appDisplay: Close popup when dragging
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/icon-grid-dnd: 38/41] appDisplay: Close popup when dragging
- Date: Thu, 4 Jul 2019 22:29:14 +0000 (UTC)
commit 87710981abf40d4544d88738f6a3f6a1486ed13c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Jul 4 16:03:20 2019 -0300
appDisplay: Close popup when dragging
When a drag starts inside a folder, and the cursor moves to
outside it, close the currently opened folder popup.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/603
js/ui/appDisplay.js | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index e86198823..ac8661908 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -396,6 +396,7 @@ var AllView = class AllView extends BaseAppView {
Main.overview.connect('item-drag-end', this._onDragEnd.bind(this));
this._nEventBlockerInhibits = 0;
+ this._popdownId = 0;
}
_refilterApps() {
@@ -785,6 +786,25 @@ var AllView = class AllView extends BaseAppView {
}
}
+ _schedulePopdown() {
+ if (this._popdownId > 0)
+ return;
+
+ this._popdownId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1000, () => {
+ if (this._currentPopup)
+ this._currentPopup.popdown();
+ this._popdownId = 0;
+ return GLib.SOURCE_REMOVE;
+ });
+ }
+
+ _unschedulePopdown() {
+ if (this._popdownId > 0) {
+ GLib.source_remove(this._popdownId);
+ this._popdownId = 0;
+ }
+ }
+
_onDragBegin() {
this._dragMonitor = {
dragMotion: this._onDragMotion.bind(this)
@@ -798,8 +818,10 @@ var AllView = class AllView extends BaseAppView {
// Handle the drag overshoot. When dragging to above the
// icon grid, move to the page above; when dragging below,
// move to the page below.
- if (appIcon.parentView == this)
+ if (!this._currentPopup)
this._handleDragOvershoot(dragEvent);
+ else
+ this._unschedulePopdown();
return DND.DragMotionResult.CONTINUE;
}
@@ -823,8 +845,8 @@ var AllView = class AllView extends BaseAppView {
let [index, dragLocation] = this.canDropAt(x, y);
this.removeNudges();
- if (source.parentView != this)
- source.parentView.removeNudges();
+ if (this._currentPopup)
+ this._schedulePopdown();
if (index != -1) {
if (sourceIndex == -1 || (index != sourceIndex && index != sourceIndex + 1))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]