The following call order is possible in wcmSendEvents
xf86PostMotionEvent(..., axisvalues[])
-> sendCommonEvents()
    xf86PostButtonEvent(..., axisvalues[])

This is fine for absolute mode but in relative mode this would result in the
axis values applied twice. Hence, reset the axis values after the first
xf86PostMotion event to 0.

Signed-off-by: Peter Hutterer <[email protected]>
---
 src/wcmCommon.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 47ff188..1ec0242 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -927,8 +927,21 @@ void wcmSendEvents(LocalDevicePtr local, const 
WacomDeviceState* ds)
 
                        /* Move the cursor to where it should be before sending 
button events */
                        if(!(priv->flags & BUTTONS_ONLY_FLAG))
+                       {
                                xf86PostMotionEvent(local->dev, is_absolute,
                                        0, naxes, x, y, z, v3, v4, v5);
+                               /* For relative events, reset the axes as
+                                * we've already moved the device by the
+                                * relative amount. Otherwise, a button
+                                * event in sendCommonEvents will move the
+                                * axes again.
+                                */
+                               if (!is_absolute)
+                               {
+                                       x = y = z = 0;
+                                       v3 = v4 = v5 = 0;
+                               }
+                       }
 
                        sendCommonEvents(local, ds, x, y, z, v3, v4, v5);
                }
-- 
1.6.5.2


------------------------------------------------------------------------------

_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to