diff options
author | Daniel Stone <daniel@fooishbar.org> | 2011-06-09 20:02:52 +0100 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-08-25 09:50:32 +1000 |
commit | 0f171af28410f939a915064af9fb9af38118455d (patch) | |
tree | b4e135fbb826dc6ce13117a9d5fa3f881fd2267b | |
parent | a24c44375025576dd600ccf370ba365e5d94dc22 (diff) |
Add HIST_DELTA macro for differences in history
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@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/synaptics.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/synaptics.c b/src/synaptics.c index 3aff1e2..9b3f190 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -1662,6 +1662,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) @@ -1881,7 +1882,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; |