mirror of
https://github.com/X11Libre/xf86-input-synaptics.git
synced 2026-04-14 11:54:16 +00:00
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>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user