layout: Debounce triggering barriers

Ensure that the pointer leaves the barrier before we trigger again.

For the message tray case, this doesn't matter much, as the trigger
won't have any effect after the grab is taken, but in the overview
HotCorner case, this ensures that we don't trigger the overview
transition many times simply by holding pressure against the hot
corner, which is easy to do accidentally.
This commit is contained in:
Jasper St. Pierre 2013-03-01 15:29:42 -05:00
parent d4259fa8aa
commit 0cc1615252

View File

@ -1264,6 +1264,7 @@ const PressureBarrier = new Lang.Class({
this._timeout = timeout; this._timeout = timeout;
this._orientation = (barrier.y1 == barrier.y2) ? Clutter.Orientation.HORIZONTAL : Clutter.Orientation.VERTICAL; this._orientation = (barrier.y1 == barrier.y2) ? Clutter.Orientation.HORIZONTAL : Clutter.Orientation.VERTICAL;
this._isTriggered = false;
this._reset(); this._reset();
this._barrierHitId = this._barrier.connect('hit', Lang.bind(this, this._onBarrierHit)); this._barrierHitId = this._barrier.connect('hit', Lang.bind(this, this._onBarrierHit));
@ -1322,14 +1323,21 @@ const PressureBarrier = new Lang.Class({
_onBarrierLeft: function(barrier, event) { _onBarrierLeft: function(barrier, event) {
this._reset(); this._reset();
this._isTriggered = false;
}, },
_trigger: function() { _trigger: function() {
this._isTriggered = true;
this.emit('trigger'); this.emit('trigger');
this._reset(); this._reset();
}, },
_onBarrierHit: function(barrier, event) { _onBarrierHit: function(barrier, event) {
// If we've triggered the barrier, wait until the pointer has the
// left the barrier hitbox until we trigger it again.
if (this._isTriggered)
return;
// Throw out all events where the pointer was grabbed by another // Throw out all events where the pointer was grabbed by another
// client, as the client that grabbed the pointer expects to have // client, as the client that grabbed the pointer expects to have
// complete control over it // complete control over it