[gnome-shell] grabHelper: Remove explicitly having to select modal



commit 393577ee782ff044c5304e60d2cfcae778b55b7c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu May 23 17:20:30 2013 -0400

    grabHelper: Remove explicitly having to select modal
    
    https://bugzilla.gnome.org/show_bug.cgi?id=700735

 js/ui/grabHelper.js  |   23 +++++++++--------------
 js/ui/messageTray.js |    3 ---
 js/ui/popupMenu.js   |    2 +-
 3 files changed, 10 insertions(+), 18 deletions(-)
---
diff --git a/js/ui/grabHelper.js b/js/ui/grabHelper.js
index d69a534..296ce46 100644
--- a/js/ui/grabHelper.js
+++ b/js/ui/grabHelper.js
@@ -144,7 +144,6 @@ const GrabHelper = new Lang.Class({
     // focus on the clicked on menu item.
     grab: function(params) {
         params = Params.parse(params, { actor: null,
-                                        modal: false,
                                         focus: null,
                                         onUngrab: null });
 
@@ -157,7 +156,7 @@ const GrabHelper = new Lang.Class({
 
         params.savedFocus = focus;
 
-        if (params.modal && !this._takeModalGrab())
+        if (!this._takeModalGrab())
             return false;
 
         this._grabStack.push(params);
@@ -169,9 +168,6 @@ const GrabHelper = new Lang.Class({
                 newFocus.grab_key_focus();
         }
 
-        if (params.modal && !this._capturedEventId)
-            this._capturedEventId = global.stage.connect('captured-event', Lang.bind(this, 
this._onCapturedEvent));
-
         return true;
     },
 
@@ -180,6 +176,8 @@ const GrabHelper = new Lang.Class({
         if (firstGrab) {
             if (!Main.pushModal(this._owner, this._modalParams))
                 return false;
+
+            this._capturedEventId = global.stage.connect('captured-event', Lang.bind(this, 
this._onCapturedEvent));
         }
 
         this._modalCount++;
@@ -191,6 +189,11 @@ const GrabHelper = new Lang.Class({
         if (this._modalCount > 0)
             return;
 
+        global.stage.disconnect(this._capturedEventId);
+        this._capturedEventId = 0;
+
+        this._ignoreRelease = false;
+
         Main.popModal(this._owner);
         global.sync_pointer();
     },
@@ -238,15 +241,7 @@ const GrabHelper = new Lang.Class({
             if (poppedGrab.onUngrab)
                 poppedGrab.onUngrab(params.isUser);
 
-            if (poppedGrab.modal)
-                this._releaseModalGrab();
-        }
-
-        if (!this.grabbed && this._capturedEventId > 0) {
-            global.stage.disconnect(this._capturedEventId);
-            this._capturedEventId = 0;
-
-            this._ignoreRelease = false;
+            this._releaseModalGrab();
         }
 
         if (hadFocus) {
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 3bd15c3..4cb1bd6 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1808,7 +1808,6 @@ const MessageTray = new Lang.Class({
         let [x, y, mask] = global.get_pointer();
         this._contextMenu.setPosition(Math.round(x), Math.round(y));
         this._grabHelper.grab({ actor: this._contextMenu.actor,
-                                modal: true,
                                 onUngrab: Lang.bind(this, function () {
                                     this._contextMenu.close(BoxPointer.PopupAnimation.FULL);
                                 })
@@ -2375,7 +2374,6 @@ const MessageTray = new Lang.Class({
 
     _showTray: function() {
         if (!this._grabHelper.grab({ actor: this.actor,
-                                     modal: true,
                                      onUngrab: Lang.bind(this, this._escapeTray) })) {
             this._traySummoned = false;
             return false;
@@ -2720,7 +2718,6 @@ const MessageTray = new Lang.Class({
 
         this._summaryBoxPointer.bin.child = child;
         this._grabHelper.grab({ actor: this._summaryBoxPointer.bin.child,
-                                modal: true,
                                 onUngrab: Lang.bind(this, this._onSummaryBoxPointerUngrabbed) });
 
         this._summaryBoxPointer.actor.opacity = 0;
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index 28d1d26..4b9eb40 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -1701,7 +1701,7 @@ const PopupMenuManager = new Lang.Class({
         if (open) {
             if (this.activeMenu && !this.activeMenu.isChildMenu(menu))
                 this.activeMenu.close(BoxPointer.PopupAnimation.FADE);
-            this._grabHelper.grab({ actor: menu.actor, modal: true, focus: menu.sourceActor,
+            this._grabHelper.grab({ actor: menu.actor, focus: menu.sourceActor,
                                     onUngrab: Lang.bind(this, this._closeMenu, menu) });
         } else {
             this._grabHelper.ungrab({ actor: menu.actor });


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