[PATCH 03/15] Add HIST_DELTA macro for differences in history

Daniel Stone daniel at fooishbar.org
Thu Jun 9 12:57:24 PDT 2011


HIST_DELTA(a, b, e) is equivalent to HIST(a).e - HIST(b).e.  Replace the
one user of this pattern with a HIST_DELTA call.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 src/synaptics.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/synaptics.c b/src/synaptics.c
index 68129fe..caf0528 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1680,6 +1680,7 @@ HandleTapProcessing(SynapticsPrivate *priv, struct SynapticsHwState *hw,
 }
 
 #define HIST(a) (priv->move_hist[((priv->hist_index - (a) + SYNAPTICS_MOVE_HISTORY) % SYNAPTICS_MOVE_HISTORY)])
+#define HIST_DELTA(a, b, e) ((HIST((a)).e) - (HIST((b)).e))
 
 static void
 store_history(SynapticsPrivate *priv, int x, int y, unsigned int millis)
@@ -1899,7 +1900,7 @@ start_coasting(SynapticsPrivate *priv, struct SynapticsHwState *hw,
     priv->autoscroll_x = 0.0;
 
     if ((priv->scroll_packet_count > 3) && (para->coasting_speed > 0.0)) {
-	double pkt_time = (HIST(0).millis - HIST(3).millis) / 1000.0;
+	double pkt_time = HIST_DELTA(0, 3, millis) / 1000.0;
 	if (vert && !circ) {
 	    double dy = estimate_delta(HIST(0).y, HIST(1).y, HIST(2).y, HIST(3).y);
 	    int sdelta = para->scroll_dist_vert;
-- 
1.7.5.3



More information about the xorg-devel mailing list