summaryrefslogtreecommitdiff
path: root/src/wcmCommon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wcmCommon.c')
-rw-r--r--src/wcmCommon.c35
1 files changed, 6 insertions, 29 deletions
diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 44bffb5..20cfaac 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -95,38 +95,17 @@ Bool wcmDevSwitchModeCall(WacomDevicePtr priv, Bool absolute)
return TRUE;
}
-
-static int wcmButtonPerNotch(WacomDevicePtr priv, int value, int threshold, int btn_positive, int btn_negative)
-{
- int mode = is_absolute(priv);
- int notches = value / threshold;
- int button = (notches > 0) ? btn_positive : btn_negative;
- int i;
- WacomAxisData axes = {0};
-
- for (i = 0; i < abs(notches); i++) {
- wcmEmitButton(priv, mode, button, 1, &axes);
- wcmEmitButton(priv, mode, button, 0, &axes);
- }
-
- return value % threshold;
-}
-
static void wcmPanscroll(WacomDevicePtr priv, const WacomDeviceState *ds, int x, int y)
{
WacomCommonPtr common = priv->common;
int threshold = common->wcmPanscrollThreshold;
- int *accumulated_x, *accumulated_y;
int delta_x, delta_y;
if (!(priv->flags & SCROLLMODE_FLAG) || !(ds->buttons & 1))
return;
- /* Tip has gone down down; store state for dragging */
+ /* Tip has gone down down; don't send pan event yet */
if (!(priv->oldState.buttons & 1)) {
- priv->wcmPanscrollState = *ds;
- priv->wcmPanscrollState.x = 0;
- priv->wcmPanscrollState.y = 0;
return;
}
@@ -139,15 +118,13 @@ static void wcmPanscroll(WacomDevicePtr priv, const WacomDeviceState *ds, int x,
delta_y = (y - priv->oldState.y);
}
- accumulated_x = &priv->wcmPanscrollState.x;
- accumulated_y = &priv->wcmPanscrollState.y;
- *accumulated_x += delta_x;
- *accumulated_y += delta_y;
- DBG(6, priv, "pan x = %d, pan y = %d\n", *accumulated_x, *accumulated_y);
+ DBG(6, priv, "pan x = %d, pan y = %d\n", delta_x, delta_y);
- *accumulated_x = wcmButtonPerNotch(priv, *accumulated_x, threshold, 6, 7);
- *accumulated_y = wcmButtonPerNotch(priv, *accumulated_y, threshold, 4, 5);
+ WacomAxisData axes = {0};
+ wcmAxisSet(&axes, WACOM_AXIS_SCROLL_X, -delta_x * PANSCROLL_INCREMENT/threshold);
+ wcmAxisSet(&axes, WACOM_AXIS_SCROLL_Y, -delta_y * PANSCROLL_INCREMENT/threshold);
+ wcmEmitMotion(priv, FALSE, &axes);
}
void wcmResetButtonAction(WacomDevicePtr priv, int button)