Touchpad drifting when 2nd monitor connected

Hardware: ThinkPad T14s Gen 3 AMD
Software: EndeavourOS, KDE 5.27.7, Linux 6.4.9-zen1-1-zen (64-bit)
http://ix.io/4D3b
I faced a problem with the touchpad drifting when the second monitor connected to a laptop. The problem is as follows: when I move my finger on the touchpad and then stop mowing without removing the finger, the cursor continues to move in the same direction for about a second. The problem occurs only when second monitor is connected. This problem exists both in Wayland and X11. On the other hand, there is no problem with the connected mouse. The problem exists for a long time - I had my laptop since April 23 and it was already there.
If any additional information needed, please don’t hesitate to ask.

Are you by any chance using the synaptics driver?

This behavior is called “coasting.” And if i’m not mistaken, only synaptics driver support it.

Anyway. If you are using the synaptics driver (xf86-input-synaptics), you can turn off coasting by setting it to 0. Create this file /etc/X11/xorg.conf.d/70-synaptics.conf and add the following contents:

Section "InputClass"
    Identifier "touchpad"
    Driver "synaptics"
    MatchIsTouchpad "on"
        Option "CoastingSpeed" "0"
EndSection

Thank you for the suggestion, but no, I don’t have this package installed. I don’t even have Synaptics devices at my laptop, they’re all ELAN-made (e.g. ELAN 0678:00 04F3:3195 Touchpad).
Also, I don’t think that this kind of function may activate because of connecting 2nd screen.

What does cat /var/log/Xorg.0.log | grep "input driver" return? Change /var/log/Xorg.0.log to ~/.local/share/xorg/Xorg.0.log if you didn’t run Xorg as root.

10.054] (II) Using input driver 'libinput' for 'Power Button'

[ 10.064] (II) Using input driver ‘libinput’ for ‘Video Bus’
[ 10.086] (II) Using input driver ‘libinput’ for ‘Power Button’
[ 10.090] (II) Using input driver ‘libinput’ for ‘Lid Switch’
[ 10.095] (II) Using input driver ‘libinput’ for ‘Sleep Button’
[ 10.104] (II) Using input driver ‘libinput’ for ‘HD-Audio Generic HDMI/DP,pcm=3’
[ 10.119] (II) Using input driver ‘libinput’ for ‘HD-Audio Generic HDMI/DP,pcm=7’
[ 10.136] (II) Using input driver ‘libinput’ for ‘HD-Audio Generic HDMI/DP,pcm=8’
[ 10.156] (II) Using input driver ‘libinput’ for ‘HD-Audio Generic Mic’
[ 10.168] (II) Using input driver ‘libinput’ for ‘HD-Audio Generic Headphone’
[ 10.354] (II) Using input driver ‘libinput’ for ‘ELAN0678:00 04F3:3195 Mouse’
[ 10.369] (II) Using input driver ‘libinput’ for ‘ELAN0678:00 04F3:3195 Mouse’
[ 10.402] (II) Using input driver ‘libinput’ for ‘ELAN0678:00 04F3:3195 Touchpad’
[ 10.433] (II) Using input driver ‘libinput’ for ‘ELAN0678:00 04F3:3195 Touchpad’
[ 10.464] (II) Using input driver ‘libinput’ for ‘AT Translated Set 2 keyboard’
[ 10.470] (II) Using input driver ‘libinput’ for ‘TPPS/2 Elan TrackPoint’
[ 10.498] (II) Using input driver ‘libinput’ for ‘TPPS/2 Elan TrackPoint’
[ 10.528] (II) Using input driver ‘libinput’ for ‘PC Speaker’
[ 10.554] (II) Using input driver ‘libinput’ for ‘ThinkPad Extra Buttons’

Is the drifting behavior reproducible every time an external display is connected and every time you tried to use the touchpad? Does it occur only when the cursor is on the 2nd display, primary display, or both?

Further questions:

Does touch pressure, duration, location, movement direction (vertical, horizontal) have any effect on the behavior?

To figure out what’s going on, you can perform the following test. On X11, run:

xinput test <device_id>

Replace <device_id> with the device ID of your touchpad (can be obtained with xinput list). That command will detect any input events from your touchpad. So if you move your finger across the touch pad, it will print out a bunch of event messages that look like this:

motion a[0]=953 a[1]=538
motion a[0]=946 a[1]=556
motion a[0]=939 a[1]=571
motion a[0]=935 a[1]=587
motion a[0]=928 a[1]=605
motion a[0]=926 a[1]=618
motion a[0]=922 a[1]=632
motion a[0]=919 a[1]=645
motion a[0]=917 a[1]=654

On my system, a[0] means horizontal movement, a[1] means vertical movement, a[3] means two-finger scrolling.

Try to reproduce the drifting behavior while xinput test is running. Pay attention to the terminal outputs when the cursor is drifting. The point of the experiment is to determine whether xinput is still detecting input events even though your finger has already stopped moving.

I’ve investigated this issue and understand that this might be a hardware\driver problem, cuz I reproduced this issue at fresh installation of Fedora 38 and also on a Windows.
p.s. The quality of Lenovo laptops is shitty, I’ll never buy them again.

https://wiki.archlinux.org/title/Touchpad_Synaptics#Cursor_jump

Edit: Even though it’s an Elantech have you tried installing

xf86-input-synaptics