[gnome-shell/gbsneto/icon-grid-dnd: 35/35] folderIcon: Open popup when dragging over
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/icon-grid-dnd: 35/35] folderIcon: Open popup when dragging over
- Date: Thu, 4 Jul 2019 19:59:52 +0000 (UTC)
commit 82061aeb0ee69529a549639e822a97fe6685415f
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Jul 4 16:55:44 2019 -0300
folderIcon: Open popup when dragging over
WIP: commit message
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/603
js/ui/appDisplay.js | 33 +++++++++++++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index ac8661908..c061f549b 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1468,6 +1468,8 @@ var FolderIcon = class FolderIcon {
this._folder.connect('changed', this._redisplay.bind(this));
this._redisplay();
+
+ this._openPopupTimeoutId = 0;
}
getAppIds() {
@@ -1484,6 +1486,27 @@ var FolderIcon = class FolderIcon {
return false;
}
+ _scheduleOpenPopup() {
+ if (this._openPopupTimeoutId > 0)
+ return;
+
+ this._openPopupTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1000, () => {
+ this._ensurePopup();
+ this.view.actor.vscroll.adjustment.value = 0;
+ this._openSpaceForPopup();
+
+ this._openPopupTimeoutId = 0;
+ return GLib.SOURCE_REMOVE;
+ });
+ }
+
+ _unscheduleOpenPopup() {
+ if (this._openPopupTimeoutId > 0) {
+ GLib.source_remove(this._openPopupTimeoutId);
+ this._openPopupTimeoutId = 0;
+ }
+ }
+
_onDragBegin() {
this._dragMonitor = {
dragMotion: this._onDragMotion.bind(this),
@@ -1496,10 +1519,12 @@ var FolderIcon = class FolderIcon {
_onDragMotion(dragEvent) {
let target = dragEvent.targetActor;
- if (!this._isChild(target) || !this._canDropAt(dragEvent.source))
+ if (!this._isChild(target) || !this._canDropAt(dragEvent.source)) {
this.actor.remove_style_pseudo_class('drop');
- else
+ this._unscheduleOpenPopup();
+ } else {
this.actor.add_style_pseudo_class('drop');
+ }
return DND.DragMotionResult.CONTINUE;
}
@@ -1524,6 +1549,8 @@ var FolderIcon = class FolderIcon {
}
handleDragOver(source, actor, x, y, time) {
+ this._scheduleOpenPopup();
+
if (!this._canDropAt(source))
return DND.DragMotionResult.NO_DROP;
@@ -1531,6 +1558,8 @@ var FolderIcon = class FolderIcon {
}
acceptDrop(source, actor, x, y, time) {
+ this._unscheduleOpenPopup();
+
if (!this._canDropAt(source))
return true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]