summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-10-18 15:46:03 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-10-24 16:01:30 +1000
commit2603ad69b997c999404ecc441e0d64ea2cc22018 (patch)
tree38bcb0d42704cd67c850f01cf6b4c0845064e22e /src
parent4f46057a33b20df62d919e49a394ab6cb7aa6aa1 (diff)
Use the scroll distances as increment for scrolling valuator axes
XI2.1 allows an 'increment' for each scrolling variable. Use that instead of hiding it away inside the driver. For circular scrolling, the increment is the one of the respective scrolling axis. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/properties.c18
-rw-r--r--src/synaptics.c20
2 files changed, 26 insertions, 12 deletions
diff --git a/src/properties.c b/src/properties.c
index 5f11cf2..f15a6fb 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -425,8 +425,22 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
return BadMatch;
dist = (INT32*)prop->data;
- para->scroll_dist_vert = dist[0];
- para->scroll_dist_horiz = dist[1];
+ if (para->scroll_dist_vert != dist[0])
+ {
+ para->scroll_dist_vert = dist[0];
+#ifdef HAVE_SMOOTH_SCROLL
+ SetScrollValuator(dev, priv->scroll_axis_vert, SCROLL_TYPE_VERTICAL,
+ para->scroll_dist_vert, 0);
+#endif
+ }
+ if (para->scroll_dist_horiz != dist[1])
+ {
+ para->scroll_dist_horiz = dist[1];
+#ifdef HAVE_SMOOTH_SCROLL
+ SetScrollValuator(dev, priv->scroll_axis_horiz, SCROLL_TYPE_HORIZONTAL,
+ para->scroll_dist_horiz, 0);
+#endif
+ }
} else if (property == prop_scrolledge)
{
CARD8 *edge;
diff --git a/src/synaptics.c b/src/synaptics.c
index 9daa45a..1c9b6db 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1101,8 +1101,10 @@ DeviceInit(DeviceIntPtr dev)
if (!priv->scroll_events_mask)
return !Success;
- SetScrollValuator(dev, priv->scroll_axis_horiz, SCROLL_TYPE_HORIZONTAL, 1, 0);
- SetScrollValuator(dev, priv->scroll_axis_vert, SCROLL_TYPE_VERTICAL, 1, 0);
+ SetScrollValuator(dev, priv->scroll_axis_horiz, SCROLL_TYPE_HORIZONTAL,
+ priv->synpara.scroll_dist_horiz, 0);
+ SetScrollValuator(dev, priv->scroll_axis_vert, SCROLL_TYPE_VERTICAL,
+ priv->synpara.scroll_dist_vert, 0);
#endif
if (!alloc_shm_data(pInfo))
@@ -2232,17 +2234,15 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw,
if (priv->vert_scroll_edge_on || priv->vert_scroll_twofinger_on) {
/* + = down, - = up */
- double delta = para->scroll_dist_vert;
- if (delta > 0 && hw->y != priv->scroll.last_y) {
- priv->scroll.delta_y += (hw->y - priv->scroll.last_y) / delta;
+ if (para->scroll_dist_vert > 0 && hw->y != priv->scroll.last_y) {
+ priv->scroll.delta_y += (hw->y - priv->scroll.last_y);
priv->scroll.last_y = hw->y;
}
}
if (priv->horiz_scroll_edge_on || priv->horiz_scroll_twofinger_on) {
/* + = right, - = left */
- double delta = para->scroll_dist_horiz;
- if (delta > 0 && hw->x != priv->scroll.last_x) {
- priv->scroll.delta_x += (hw->x - priv->scroll.last_x) / delta;
+ if (para->scroll_dist_horiz > 0 && hw->x != priv->scroll.last_x) {
+ priv->scroll.delta_x += (hw->x - priv->scroll.last_x);
priv->scroll.last_x = hw->x;
}
}
@@ -2252,9 +2252,9 @@ HandleScrolling(SynapticsPrivate *priv, struct SynapticsHwState *hw,
double diff = diffa(priv->scroll.last_a, angle(priv, hw->x, hw->y));
if (delta >= 0.005 && diff != 0.0) {
if (priv->circ_scroll_vert)
- priv->scroll.delta_y += diff / delta;
+ priv->scroll.delta_y += diff / delta * para->scroll_dist_vert;
else
- priv->scroll.delta_x += diff / delta;
+ priv->scroll.delta_x += diff / delta * para->scroll_dist_horiz;;
priv->scroll.last_a = angle(priv, hw->x, hw->y);
}
}