[PATCH synaptics 06/21] Add HIST_DELTA macro for differences in history
Daniel Stone
daniel at fooishbar.org
Tue Jun 14 10:05:54 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 2f6a8b9..f670b5f 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1691,6 +1691,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 long millis)
@@ -1910,7 +1911,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