layout: Remove _addBarrierEvent

Moving it inline to when we get the event means that we can
remove the duplicate call to _getDistanceAcrossBarrier.

https://bugzilla.gnome.org/show_bug.cgi?id=693854
This commit is contained in:
Jasper St. Pierre 2013-02-14 21:22:49 -05:00
parent 001bbd36f5
commit e3eb4a20a5

View File

@ -1190,11 +1190,6 @@ const PressureBarrier = new Lang.Class({
this._barrierEvents = this._barrierEvents.slice(firstNewEvent);
},
_addBarrierEvent: function(event) {
this._barrierEvents.push(event);
this._currentPressure += this._getDistanceAcrossBarrier(event);
},
_onBarrierLeft: function(barrier, event) {
this._reset();
},
@ -1218,7 +1213,8 @@ const PressureBarrier = new Lang.Class({
this._lastTime = event.time;
this._trimBarrierEvents();
this._addBarrierEvent(event);
this._barrierEvents.push(event);
this._currentPressure += distance;
if (this._currentPressure >= this._threshold) {
this.emit('trigger');