panel: Make the "Activities" button react to touch events

https://bugzilla.gnome.org/show_bug.cgi?id=733633
This commit is contained in:
Carlos Garnacho 2014-07-22 12:32:39 +02:00
parent f8899cf274
commit 38d05a8285

View File

@ -571,7 +571,7 @@ const ActivitiesButton = new Lang.Class({
this.actor.label_actor = this._label; this.actor.label_actor = this._label;
this.actor.connect('captured-event', Lang.bind(this, this._onCapturedEvent)); this.actor.connect('captured-event', Lang.bind(this, this._onCapturedEvent));
this.actor.connect_after('button-release-event', Lang.bind(this, this._onButtonRelease)); this.actor.connect_after('event', Lang.bind(this, this._onEvent));
this.actor.connect_after('key-release-event', Lang.bind(this, this._onKeyRelease)); this.actor.connect_after('key-release-event', Lang.bind(this, this._onKeyRelease));
Main.overview.connect('showing', Lang.bind(this, function() { Main.overview.connect('showing', Lang.bind(this, function() {
@ -600,16 +600,21 @@ const ActivitiesButton = new Lang.Class({
}, },
_onCapturedEvent: function(actor, event) { _onCapturedEvent: function(actor, event) {
if (event.type() == Clutter.EventType.BUTTON_PRESS) { if (event.type() == Clutter.EventType.BUTTON_PRESS ||
event.type() == Clutter.EventType.TOUCH_BEGIN) {
if (!Main.overview.shouldToggleByCornerOrButton()) if (!Main.overview.shouldToggleByCornerOrButton())
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} }
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
}, },
_onButtonRelease: function() { _onEvent: function(actor, event) {
Main.overview.toggle(); if (event.type() == Clutter.EventType.TOUCH_END ||
this.menu.close(); event.type() == Clutter.EventType.BUTTON_RELEASE) {
Main.overview.toggle();
this.menu.close();
}
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
}, },