diff options
author | Derek Foreman <derek.foreman@collabora.co.uk> | 2011-06-03 18:28:59 +0100 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-08-25 09:50:34 +1000 |
commit | aae994cc0c08e6da270c199af429315a3a2092bf (patch) | |
tree | 053230ea3c40cca5cc5fe434d48b14ac6f6b205a | |
parent | fb7c0c5965b6843f38e9c881f4c349006ec0da32 (diff) |
Scroll: Add last_millis to track scroll event timing
Stopping a little short of having a full scroll history, adding
last_millis lets us track when the last scroll event we sent was,
for more accurate timing of coasting in particular.
Signed-off-by: Derek Foreman <derek.foreman@collabora.co.uk>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/synaptics.c | 10 | ||||
-rw-r--r-- | src/synapticsstr.h | 1 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/synaptics.c b/src/synaptics.c index 3344f56..aeaf60b 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -2246,7 +2246,7 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, } if (priv->autoscroll_yspd) { - double dtime = (hw->millis - HIST(0).millis) / 1000.0; + double dtime = (hw->millis - priv->scroll.last_millis) / 1000.0; double ddy = para->coasting_friction * dtime; priv->autoscroll_y += priv->autoscroll_yspd * dtime; delay = MIN(delay, POLL_MS); @@ -2267,7 +2267,7 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw, } if (priv->autoscroll_xspd) { - double dtime = (hw->millis - HIST(0).millis) / 1000.0; + double dtime = (hw->millis - priv->scroll.last_millis) / 1000.0; double ddx = para->coasting_friction * dtime; priv->autoscroll_x += priv->autoscroll_xspd * dtime; delay = MIN(delay, POLL_MS); @@ -2645,8 +2645,12 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now, /* Process scroll events only if coordinates are * in the Synaptics Area */ - if (inside_active_area) + if (inside_active_area && + (scroll.down != 0 || scroll.up != 0 || scroll.left != 0 || + scroll.right != 0)) { post_scroll_events(pInfo, scroll); + priv->scroll.last_millis = hw->millis; + } if (double_click) { post_button_click(pInfo, 1); diff --git a/src/synapticsstr.h b/src/synapticsstr.h index 5c878ef..85f0888 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -197,6 +197,7 @@ typedef struct _SynapticsPrivateRec int last_x; /* last x-scroll position */ int last_y; /* last y-scroll position */ double last_a; /* last angle-scroll position */ + CARD32 last_millis; /* time last scroll event posted */ } scroll; int count_packet_finger; /* packet counter with finger on the touchpad */ int button_delay_millis; /* button delay for 3rd button emulation */ |