summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Osterlund <petero2@telia.com>2005-01-05 20:55:09 +0100
committerPeter Osterlund <petero2@telia.com>2006-04-09 04:03:02 +0200
commit02f6b44dbbdaa459903126028779cbc573b13842 (patch)
treef8d00f410332eaf51c31b701afd5928b102c8d59
parent50c7fdc462daa60cf8555edbb35ac6fc9a5a5d80 (diff)
Always update the move_hist[] buffer when a finger is on the
touchpad. Will be needed to implement coasting.
-rw-r--r--synaptics.c15
-rw-r--r--synaptics.h1
2 files changed, 12 insertions, 4 deletions
diff --git a/synaptics.c b/synaptics.c
index 151b890..cb10209 100644
--- a/synaptics.c
+++ b/synaptics.c
@@ -1128,7 +1128,16 @@ HandleTapProcessing(SynapticsPrivate *priv, struct SynapticsHwState *hw,
return delay;
}
-#define HIST(a) (priv->move_hist[((priv->count_packet_finger-(a))%SYNAPTICS_MOVE_HISTORY)])
+#define HIST(a) (priv->move_hist[((priv->hist_index - (a) + SYNAPTICS_MOVE_HISTORY) % SYNAPTICS_MOVE_HISTORY)])
+
+static void store_history(SynapticsPrivate *priv, int x, int y, unsigned int millis)
+{
+ int idx = (priv->hist_index + 1) % SYNAPTICS_MOVE_HISTORY;
+ priv->move_hist[idx].x = x;
+ priv->move_hist[idx].y = y;
+ priv->move_hist[idx].millis = millis;
+ priv->hist_index = idx;
+}
/*
* Estimate the slope for the data sequence [x3, x2, x1, x0] by using
@@ -1247,9 +1256,7 @@ static long ComputeDeltas(SynapticsPrivate *priv, struct SynapticsHwState *hw,
*dyP = dy;
/* generate a history of the absolute positions */
- HIST(0).x = hw->x;
- HIST(0).y = hw->y;
- HIST(0).millis = hw->millis;
+ store_history(priv, hw->x, hw->y, hw->millis);
return delay;
}
diff --git a/synaptics.h b/synaptics.h
index a104a2f..ba49671 100644
--- a/synaptics.h
+++ b/synaptics.h
@@ -160,6 +160,7 @@ typedef struct _SynapticsPrivateRec
int fifofd; /* fd for fifo */
SynapticsMoveHistRec move_hist[SYNAPTICS_MOVE_HISTORY]; /* movement history */
+ int hist_index; /* Last added entry in move_hist[] */
int largest_valid_x; /* Largest valid X coordinate seen so far */
int scroll_y; /* last y-scroll position */
int scroll_x; /* last x-scroll position */