[Pkg-mozext-commits] [firegestures] 01/07: clean up codes for continuous swipe gesture
David Prévot
taffit at moszumanska.debian.org
Sun Jan 11 16:59:17 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository firegestures.
commit d5af8b6c416bff6ab3166817a2dcd6ffb187a193
Author: Gomita <gomita at xuldev.org>
Date: Sat Jan 3 11:05:13 2015 +0900
clean up codes for continuous swipe gesture
---
chrome/content/firegestures/remote.js | 2 +-
components/xdGestureHandler.js | 17 ++++++-----------
2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/chrome/content/firegestures/remote.js b/chrome/content/firegestures/remote.js
index a8985d3..968203c 100644
--- a/chrome/content/firegestures/remote.js
+++ b/chrome/content/firegestures/remote.js
@@ -57,7 +57,7 @@ let FireGesturesRemote = {
this._startX = aData.x;
this._startY = aData.y;
let { doc: doc, elt: elt } = this._elementFromPoint(aData.x, aData.y);
- if (aData.button == 0) {
+ if (aData.type != "MozSwipeGesture" && aData.button == 0) {
// cancel starting gesture on form elements
let localName = elt.localName;
if (["input", "textarea", "select", "option", "textbox", "menulist"].indexOf(localName) >= 0) {
diff --git a/components/xdGestureHandler.js b/components/xdGestureHandler.js
index 0d5cf59..744f389 100644
--- a/components/xdGestureHandler.js
+++ b/components/xdGestureHandler.js
@@ -386,8 +386,6 @@ xdGestureHandler.prototype = {
case event.DIRECTION_DOWN : direction = "down"; break;
}
this.sourceNode = event.target;
- this._lastX = event.screenX;
- this._lastY = event.screenY;
this._invokeExtraGesture(event, "swipe-" + direction);
this.sourceNode = null;
return;
@@ -400,9 +398,7 @@ xdGestureHandler.prototype = {
this._swipeTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
this._swipeTimer.initWithCallback(this, this._swipeTimeout, Ci.nsITimer.TYPE_ONE_SHOT);
if (!this._directionChain) {
- this.sourceNode = event.target;
- this._lastX = event.screenX;
- this._lastY = event.screenY;
+ this._startGesture(event);
}
var direction;
switch (event.direction) {
@@ -465,7 +461,7 @@ xdGestureHandler.prototype = {
tabbar.advanceSelectedTab(event.detail < 0 ? -1 : 1, true);
},
- // called from handleEvent (type is "mousedown")
+ // called from handleEvent (type is "mousedown", "MozSwipeGesture")
_startGesture: function FGH__startGesture(event) {
if (this._drawArea.localName == "tabbrowser")
this._isRemote = this._drawArea.mCurrentBrowser.getAttribute("remote") == "true";
@@ -476,11 +472,12 @@ xdGestureHandler.prototype = {
this._directionChain = "";
this._shouldFireContext = false;
// trail drawing
- if (this._trailEnabled)
+ if (!this._swipeTimer && this._trailEnabled)
this.createTrail(event);
// [e10s] tell remote browser that mouse gesture has started
if (this._isRemote) {
this._gestureObserver.sendAsyncMessage("FireGestures:GestureStart", {
+ type: event.type,
button: event.button,
x: event.screenX - this._drawArea.mCurrentBrowser.boxObject.screenX,
y: event.screenY - this._drawArea.mCurrentBrowser.boxObject.screenY,
@@ -556,7 +553,7 @@ xdGestureHandler.prototype = {
this._isMouseDownR = false;
this._clearTimeout();
// clear trail drawing
- if (this._trailEnabled)
+ if (!this._swipeTimer && this._trailEnabled)
this.eraseTrail();
// don't call onMouseGesture after events sequence: mousedown > minimal mousemove > mouseup
if (this._directionChain) {
@@ -608,9 +605,7 @@ xdGestureHandler.prototype = {
this._gestureObserver.onExtraGesture(null, "gesture-timeout");
break;
case this._swipeTimer:
- this._gestureObserver.onMouseGesture(null, this._directionChain);
- this.sourceNode = null;
- this._directionChain = "";
+ this._stopGesture();
this._swipeTimer = null;
break;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firegestures.git
More information about the Pkg-mozext-commits
mailing list