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
This commit is contained in:
Carlos Garnacho 2014-07-31 17:26:47 +02:00
parent cd4eda8bef
commit a6d8c25494

View File

@ -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;
},