[gnome-shell] panel: Avoid _onEvent() to be called twice



commit a6d8c25494a3a9aabbbd0b21a77b2c4baebfa736
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jul 31 17:26:47 2014 +0200

    panel: Avoid _onEvent() to be called twice
    
    Both Panel.ActivitiesButton and its parent class Panel.MenuButton would
    attempt to connect their own _onEvent() function to Clutter::event,
    which counterintuitively was connecting the child class' _onEvent()
    function twice.
    
    So, actually chain up on the signal handler, and don't connect twice
    to the signal. Both methods were calling this.menu.close(), so only
    do that on the parent class handler, since we're chaining up and doing
    the right thing now.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733840

 js/ui/panel.js |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 10fe169..3c2ab6b 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -571,7 +571,6 @@ const ActivitiesButton = new Lang.Class({
         this.actor.label_actor = this._label;
 
         this.actor.connect('captured-event', Lang.bind(this, this._onCapturedEvent));
-        this.actor.connect_after('event', Lang.bind(this, this._onEvent));
         this.actor.connect_after('key-release-event', Lang.bind(this, this._onKeyRelease));
 
         Main.overview.connect('showing', Lang.bind(this, function() {
@@ -609,12 +608,12 @@ const ActivitiesButton = new Lang.Class({
     },
 
     _onEvent: function(actor, event) {
-        if (event.type() == Clutter.EventType.TOUCH_END ||
-            event.type() == Clutter.EventType.BUTTON_RELEASE) {
+        this.parent(actor, event);
 
+        if (event.type() == Clutter.EventType.TOUCH_END ||
+            event.type() == Clutter.EventType.BUTTON_RELEASE)
             Main.overview.toggle();
-            this.menu.close();
-        }
+
         return Clutter.EVENT_PROPAGATE;
     },
 


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