Fix a Qt scrolling bug, don't reset the valuator on slave switch
This commit is contained in:
parent
d3c0c12b95
commit
324f637f1e
89
0001-dix-leave-last.valuators-alone-on-slave-switch.patch
Normal file
89
0001-dix-leave-last.valuators-alone-on-slave-switch.patch
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
From 13f9b07039484927532d913dbccc664679235bf6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Hutterer <peter.hutterer@who-t.net>
|
||||||
|
Date: Mon, 25 Mar 2019 13:19:41 +1000
|
||||||
|
Subject: [PATCH xserver] 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>
|
||||||
|
---
|
||||||
|
dix/getevents.c | 25 +------------------------
|
||||||
|
1 file changed, 1 insertion(+), 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 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
@ -46,7 +46,7 @@
|
|||||||
Summary: X.Org X11 X server
|
Summary: X.Org X11 X server
|
||||||
Name: xorg-x11-server
|
Name: xorg-x11-server
|
||||||
Version: 1.20.4
|
Version: 1.20.4
|
||||||
Release: 2%{?gitdate:.%{gitdate}}%{?dist}
|
Release: 3%{?gitdate:.%{gitdate}}%{?dist}
|
||||||
URL: http://www.x.org
|
URL: http://www.x.org
|
||||||
License: MIT
|
License: MIT
|
||||||
|
|
||||||
@ -96,6 +96,9 @@ Patch6: 0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch
|
|||||||
|
|
||||||
Patch10: 0001-xwayland-present-Destroy-sync_callback-in-xwl_presen.patch
|
Patch10: 0001-xwayland-present-Destroy-sync_callback-in-xwl_presen.patch
|
||||||
|
|
||||||
|
# https://gitlab.freedesktop.org/xorg/xserver/merge_requests/152
|
||||||
|
Patch11: 0001-dix-leave-last.valuators-alone-on-slave-switch.patch
|
||||||
|
|
||||||
BuildRequires: systemtap-sdt-devel
|
BuildRequires: systemtap-sdt-devel
|
||||||
BuildRequires: git
|
BuildRequires: git
|
||||||
BuildRequires: automake autoconf libtool pkgconfig
|
BuildRequires: automake autoconf libtool pkgconfig
|
||||||
@ -520,6 +523,9 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Mar 27 2019 Peter Hutterer <peter.hutterer@redhat.com> 1.20.4-3
|
||||||
|
- Fix a Qt scrolling bug, don't reset the valuator on slave switch
|
||||||
|
|
||||||
* Thu Mar 21 2019 Adam Jackson <ajax@redhat.com> - 1.20.4-2
|
* Thu Mar 21 2019 Adam Jackson <ajax@redhat.com> - 1.20.4-2
|
||||||
- Backport an Xwayland crash fix in the Present code
|
- Backport an Xwayland crash fix in the Present code
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user