If a touchscreen is rotated (Option "Rotate" "CW" in ws(4)), then
when a finger slides purely horizontally or purely vertically across
the screen, the cursor jumps to a *diagonal* line starting at the
corner, as if x and y were equal.

The problem manifests here, in wsReadInput():

        if (priv->swap_axes) {
                int tmp;

                tmp = hw.ax;
                hw.ax = hw.ay;
                hw.ay = tmp;
        }
        if ((hw.ax != priv->old_ax) || (hw.ay != priv->old_ay)) {
        ...

When the first block is entered, the second block is entered more often
than it should, because the old values that ax and ay are being checked
against have not been swapped.

With the diff below, cursor motion from my Steam Deck touch screen is
smooth and unbroken as expected, whether rotated or unrotated.

ok?

Index: ws.c
===================================================================
RCS file: /cvs/xenocara/driver/xf86-input-ws/src/ws.c,v
retrieving revision 1.68
diff -u -p -r1.68 ws.c
--- ws.c        25 Apr 2023 20:18:48 -0000      1.68
+++ ws.c        27 Apr 2023 11:13:04 -0000
@@ -563,8 +563,13 @@ wsReadHwState(InputInfoPtr pInfo, wsHwSt
 
        bzero(hw, sizeof(wsHwState));
        hw->buttons = priv->lastButtons;
-       hw->ax = priv->old_ax;
-       hw->ay = priv->old_ay;
+       if (!priv->swap_axes) {
+               hw->ax = priv->old_ax;
+               hw->ay = priv->old_ay;
+       } else {
+               hw->ax = priv->old_ay;
+               hw->ay = priv->old_ax;
+       }
 
        while ((event = wsGetEvent(pInfo)) != NULL) {
                switch (event->type) {

Reply via email to