[gnome-shell/gbsneto/folder-dialog-improvements: 18/30] appDisplay: Move click action to dialog



commit 76401ddf759cf02535e1327be096ae7d25faac1e
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Jun 4 01:49:14 2020 -0300

    appDisplay: Move click action to dialog
    
    Now that the folder dialog covers the whole primary
    monitor, it eats all input events, and doesn't allow
    the event blocker to detect clicks.
    
    Move the click action to the folder dialog itself, and
    popdown the dialog if a click is triggered on the dialog
    (but not on any children).
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1301

 js/ui/appDisplay.js | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index dad8fdc925..4aff3b24bf 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -387,18 +387,6 @@ class AppDisplay extends BaseAppView {
         this._swipeTracker.connect('update', this._swipeUpdate.bind(this));
         this._swipeTracker.connect('end', this._swipeEnd.bind(this));
 
-        this._clickAction = new Clutter.ClickAction();
-        this._clickAction.connect('clicked', () => {
-            if (!this._currentDialog)
-                return;
-
-            let [x, y] = this._clickAction.get_coords();
-            let actor = global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y);
-            if (!this._currentDialog.contains(actor))
-                this._currentDialog.popdown();
-        });
-        this._eventBlocker.add_action(this._clickAction);
-
         this._currentDialog = null;
         this._displayingDialog = false;
         this._currentDialogDestroyId = 0;
@@ -1449,6 +1437,17 @@ var AppFolderDialog = GObject.registerClass({
             work_area: true,
         }));
 
+        const clickAction = new Clutter.ClickAction();
+        clickAction.connect('clicked', () => {
+            const [x, y] = clickAction.get_coords();
+            const actor =
+                global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y);
+
+            if (actor === this)
+                this.popdown();
+        });
+        this.add_action(clickAction);
+
         this._source = source;
         this._folder = folder;
         this._view = source.view;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]