[PATCH 06/23] Add HIST_DELTA macro for differences in history

Daniel Stone daniel at fooishbar.org
Thu Jun 23 15:12:41 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>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/synaptics.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/synaptics.c b/src/synaptics.c
index 30f17a9..c685548 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1673,6 +1673,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)
@@ -1892,7 +1893,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.4



More information about the xorg-devel mailing list