On Thu, Jul 18, 2013 at 09:23:00PM +0100, Edd Barrett wrote:
> After applying your diff:
> Touchpad: smooth lines.
> Nipple:   smooth lines.
> Pen:      jagged lines.
> 
> I wonder if it is because the pen is an absolute pointing device.  You
> probably need extra magic in the WSCONS_EVENT_MOUSE_ABSOLUTE_* cases.

The following diff fixes the jagged diagonal lines for absolute pointing
devices. I think I might be able to simplify some of the relative pointer
code here too, but that should be a separate diff.

Tested on my x230t and will continue to test. No regrssions noticed on
relative pointing devices.

OK?

Index: src/ws.c
===================================================================
RCS file: /home/edd/cvsync/cvs/xenocara/driver/xf86-input-ws/src/ws.c,v
retrieving revision 1.58
diff -u -p -u -r1.58 ws.c
--- src/ws.c    20 Jul 2013 13:24:50 -0000      1.58
+++ src/ws.c    16 Oct 2013 22:36:21 -0000
@@ -474,7 +474,7 @@ wsReadInput(InputInfoPtr pInfo)
 {
        WSDevicePtr priv = (WSDevicePtr)pInfo->private;
        static struct wscons_event eventList[NUMEVENTS];
-       int n, c, dx, dy;
+       int n, c, dx, dy, ax, ay;
        struct wscons_event *event = eventList;
        unsigned char *pBuf;
 
@@ -488,11 +488,11 @@ wsReadInput(InputInfoPtr pInfo)
        if (n == 0)
                return;
 
-       dx = dy = 0;
+       dx = dy = ax = ay = 0;
        n /= sizeof(struct wscons_event);
        while (n--) {
                int buttons = priv->lastButtons;
-               int newdx = 0, newdy = 0, dz = 0, dw = 0, ax = 0, ay = 0;
+               int newdx = 0, newdy = 0, dz = 0, dw = 0;
                int zbutton = 0, wbutton = 0;
 
                switch (event->type) {
@@ -595,25 +595,17 @@ wsReadInput(InputInfoPtr pInfo)
                        ax = ay;
                        ay = tmp;
                }
-               if (ax) {
+               if (ax && ay) {
                        int xdelta = ax - priv->old_ax;
-                       priv->old_ax = ax;
-                       if (wsWheelEmuFilterMotion(pInfo, xdelta, 0))
-                               continue;
-
-                       /* absolute position event */
-                       DBG(3, ErrorF("postMotionEvent X %d\n", ax));
-                       xf86PostMotionEvent(pInfo->dev, 1, 0, 1, ax);
-               }
-               if (ay) {
                        int ydelta = ay - priv->old_ay;
+                       priv->old_ax = ax;
                        priv->old_ay = ay;
-                       if (wsWheelEmuFilterMotion(pInfo, 0, ydelta))
+                       if (wsWheelEmuFilterMotion(pInfo, xdelta, ydelta))
                                continue;
-
                        /* absolute position event */
-                       DBG(3, ErrorF("postMotionEvent y %d\n", ay));
-                       xf86PostMotionEvent(pInfo->dev, 1, 1, 1, ay);
+                       DBG(3, ErrorF("postMotionEvent X %d Y %d\n", ax, ay));
+                       xf86PostMotionEvent(pInfo->dev, 1, 0, 2, ax, ay);
+                       ax = ay = 0; /* prevent second post below */
                }
        }
        if (dx || dy) {
@@ -624,6 +616,24 @@ wsReadInput(InputInfoPtr pInfo)
                DBG(3, ErrorF("postMotionEvent dX %d dY %d\n",
                    dx, dy));
                xf86PostMotionEvent(pInfo->dev, 0, 0, 2, dx, dy);
+       }
+       if (ax) {
+               int xdelta = ax - priv->old_ax;
+               priv->old_ax = ax;
+               if (wsWheelEmuFilterMotion(pInfo, xdelta, 0))
+                       return;
+               /* absolute position event */
+               DBG(3, ErrorF("postMotionEvent X %d\n", ax));
+               xf86PostMotionEvent(pInfo->dev, 1, 0, 1, ax);
+       }
+       if (ay) {
+               int ydelta = ay - priv->old_ay;
+               priv->old_ay = ay;
+               if (wsWheelEmuFilterMotion(pInfo, 0, ydelta))
+                       return;
+               /* absolute position event */
+               DBG(3, ErrorF("postMotionEvent Y %d\n", ay));
+               xf86PostMotionEvent(pInfo->dev, 1, 1, 1, ay);
        }
        return;
 }

-- 
Best Regards
Edd Barrett

http://www.theunixzoo.co.uk

Reply via email to