summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2019-03-25 13:19:41 +1000
committerAdam Jackson <ajax@redhat.com>2019-05-28 14:21:57 -0400
commit240868527bb11beb9a03ad0d3f24506f1b983729 (patch)
tree9a12e09884e06d4b2aec9a4c0fa44a8969199a1d
parent5bc29a67b8ab251048e0737eedcceb29bba25f5f (diff)
dix: leave last.valuators alone on slave switch
Terms: dev->last.valuator[] is the last value given to us by the driver dev->valuator.axisVal[] is the last value sent to the client dev->last.scroll[] is the abs value of the scroll axis as given by the driver, used for button emulation calculation (and the remainder) This function updates the device's last.valuator state based on the current master axis state. This way, relative motion continues fluidly when switching between devices. Before mouse 2 comes into effect, it's valuator state is updated to wherever the pointer currently is so the relative event applies on top of that. This can only work for x/y axes, all other axes aren't guaranteed to have the same meaning and/or may not be present: - xtest device: no valuator 2 - mouse: valuator 2 is horizontal scroll axis - tablet: valuator 2 is pressure Scaling the current value from the pressure range into the range for horizontal scrolling makes no sense. And it causes scroll jumps: - scroll down, last.valuator == axisVal == 20 - xdotool click 1, the XTest device doesn't have that valuator - scroll up - updateSlaveDeviceCoords reset last.valuator to 0 (axisVal == 20) - DeviceClassesChangedEvent includes value 20 for the axis - event is processed, last.value changes from 0 to -1 - axisVal is updated to -1, causing a jump of -21 The same applies when we switch from tablet to mouse wheel if the pressure value is 0 on proximity out (basically guaranteed). So let's drop this code altogether and only leave the scaling for the relative x/y motion. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit d7b1753d446ecde3ff58e3de39a634c3137473c8)
-rw-r--r--dix/getevents.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index d8955969a..f83dac709 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -331,9 +331,6 @@ rescaleValuatorAxis(double coord, AxisInfoPtr from, AxisInfoPtr to,
static void
updateSlaveDeviceCoords(DeviceIntPtr master, DeviceIntPtr pDev)
{
- int i;
- DeviceIntPtr lastSlave;
-
/* master->last.valuators[0]/[1] is in desktop-wide coords and the actual
* position of the pointer */
pDev->last.valuators[0] = master->last.valuators[0];
@@ -358,27 +355,7 @@ updateSlaveDeviceCoords(DeviceIntPtr master, DeviceIntPtr pDev)
screenInfo.height);
}
- /* calculate the other axis as well based on info from the old
- * slave-device. If the old slave had less axes than this one,
- * last.valuators is reset to 0.
- */
- if ((lastSlave = master->last.slave) && lastSlave->valuator) {
- for (i = 2; i < pDev->valuator->numAxes; i++) {
- if (i >= lastSlave->valuator->numAxes) {
- pDev->last.valuators[i] = 0;
- valuator_mask_set_double(pDev->last.scroll, i, 0);
- }
- else {
- double val = pDev->last.valuators[i];
-
- val = rescaleValuatorAxis(val, lastSlave->valuator->axes + i,
- pDev->valuator->axes + i, 0, 0);
- pDev->last.valuators[i] = val;
- valuator_mask_set_double(pDev->last.scroll, i, val);
- }
- }
- }
-
+ /* other axes are left as-is */
}
/**