New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 599497 link

Starred by 10 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug

Blocking:
issue 253697
issue 620148



Sign in to add a comment

Linux hi precision trackpad scrolling (xinput2) should send precise deltas

Project Member Reported by bokan@chromium.org, Mar 31 2016

Issue description

Version: Linux
OS: 51.0.2693.2

What steps will reproduce the problem?
(1) Do a touchpad fling to the end of the page
(2) Either during the fling or right as it hits the end of the page hold down ctrl

What is the expected output?
Nothing

What do you see instead?
The page starts to zoom in.

We should disable ctrl-based zoom on flings altogether, the behavior is impossible to controls and quite unintuitive. This is especially true once the page hits its extent but we keep sending scroll updates, holding down ctrl starts zooming the page even though it seems like nothing else is going on - very confusing.
 
Is this a recent regression?

Comment 2 by bokan@chromium.org, Mar 31 2016

Not sure, it's in stable and dev channels. I just realized that's why my pages would often change zoom levels inadvertently.

Comment 3 by bokan@chromium.org, Mar 31 2016

I suspect it may have to do with getting high precision scroll deltas on Linux, not sure if we supported fling gestures on Linux touchpads before that...
Owner: sahel@chromium.org
Status: Assigned (was: Available)
Cc: tdres...@chromium.org

Comment 6 by bokan@chromium.org, Apr 28 2016

Summary: Linux hi precision trackpad scrolling (xinput2) should send precise deltas (was: Touchpad Fling + Ctrl Key causes unexpected page zoom)
So this may actually be an "issue" with my touchpad driver since it seems that it generates a fling curve and then sends wheel deltas to whichever app is under the cursor. i.e. Flinging in one app, then switching to another, continues the fling in the second app.

Still, it seems like we should be sending precise scroll deltas for trackpads that support it so that we don't ctrl+wheel zoom in those cases.

Comment 7 by agoode@chromium.org, Jun 14 2016

Flinging at the driver level is problematic and is going away as the libinput driver replaces the synaptics driver. https://bugzilla.redhat.com/show_bug.cgi?id=1225643

There's nothing to do with these buggy drivers at this time.

But for libinput systems (recent X and Wayland systems), the toolkit will need to support flinging. I don't know if Chrome needs to do this or if its use of Gtk+ is sufficient. See See http://who-t.blogspot.com.au/2015/03/libinput-scroll-sources.html and https://wayland.freedesktop.org/libinput/doc/latest/group__event__pointer.html
Cc: ymalik@chromium.org
ymalik@ is this what you were talking about in standup?
Labels: -Pri-2 Pri-3
This is still and issue and one we should fix.
Owner: chaopeng@chromium.org

Comment 12 by sahel@chromium.org, Jan 29 2018

Blocking: 253697

Comment 13 by bokan@chromium.org, Mar 28 2018

Blocking: 620148
I am able to reproduce this issue on Thinkpad x1.

The issue for this device is the driver does not implement correctly. Base on the x11 document. The touchpad should have one report type=XITouchClass and mode= XIDependentTouch. [1] The incorrect log for the device:

```
↳ SynPS/2 Synaptics TouchPad                  id=11    [slave  pointer  (2)]
    Reporting 8 classes:
        Class originated from: 11. Type: XIButtonClass
        Buttons supported: 12
        Button labels: "Button Left" "Button Middle" "Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right" None None None None None
        Button state:
        Class originated from: 11. Type: XIValuatorClass
        Detail for Valuator 0:
          Label: Rel X
          Range: 1262.000000 - 5678.000000
          Resolution: 46000 units/m
          Mode: relative
        Class originated from: 11. Type: XIValuatorClass
        Detail for Valuator 1:
          Label: Rel Y
          Range: 1098.000000 - 4754.000000
          Resolution: 68000 units/m
          Mode: relative
        Class originated from: 11. Type: XIValuatorClass
        Detail for Valuator 2:
          Label: Rel Horiz Scroll
          Range: 0.000000 - -1.000000
          Resolution: 0 units/m
          Mode: relative
        Class originated from: 11. Type: XIValuatorClass
        Detail for Valuator 3:
          Label: Rel Vert Scroll
          Range: 0.000000 - -1.000000
          Resolution: 0 units/m
          Mode: relative
        Class originated from: 11. Type: XIValuatorClass
        Detail for Valuator 4:
          Label: Abs MT Pressure
          Range: -1.000000 - -1.000000
          Resolution: 0 units/m
          Mode: relative
        Class originated from: 11. Type: XIScrollClass
        Scroll info for Valuator 2
          type: 2 (horizontal)
          increment: -114.000000
          flags: 0x0
        Class originated from: 11. Type: XIScrollClass
        Scroll info for Valuator 3
          type: 1 (vertical)
          increment: -114.000000
          flags: 0x0
```

If driver report type=XITouchClass, we will consider the device as touch screen which maybe correct.

One thing we can do now is maybe add a flag for touchpad. like: https://chromium-review.googlesource.com/c/chromium/src/+/667719

[1] ftp://www.x.org/pub/X11R7.7/doc/man/man3/XIQueryDevice.3.xhtml


Which X11 input driver are you using? Is this the libinput one? If so, we should file a bug.
I am using the "Synaptics" driver on ubuntu 16.04. How to install libinput one?
(II) Using input driver 'synaptics' for 'SynPS/2 Synaptics TouchPad'

...

test@test-thinkpad:~$ sudo apt-get purge xserver-xorg-input-synaptics
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'xserver-xorg-input-synaptics' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Labels: -OS-Windows
Can you try a newer distribution? Debian 9 or testing will work, or more or less any recent Linux.

The synaptics driver is known to be buggy, especially with new hardware. It is also unmaintained. I wouldn't even try to work around its problems in Chrome.
I've got libinput here on a new Ubuntu 18 daily build.
This is the output of xinput list --long 12 (it has the same classes): https://pastebin.com/y9AP56XV

Btw, DeviceDataManagerX11::UpdateDeviceList does add it to touchpads_, and has_precise_scrolling_deltas is in fact always false for the touchpad scroll too. (I've been trying to identify where this goes wrong but haven't got too far.)

I'm happy to check anything else, just let me know. I've got a local build of chromium and libinput as well. (Synaptics does actually work too, but for example the palm detection doesn't.)
Thank you balazs.endresz. It seems like your the output of xinput list --long is same with mine. How do you confirm it is using libinput?
At the moment I have only the official libinput drivers installed that came with 18.04 but this is how you can check:
$ journalctl -b 0 |grep -i touch |grep driver
/usr/lib/gdm3/gdm-x-session[1284]: (II) Using input driver 'libinput' for 'SynPS/2 Synaptics TouchPad'
 

And it's a Thinkpad T480 with the default X session (not Wayland), if that matters:

$ loginctl show-session `loginctl|grep $USER|awk '{print $1}'` -p Type
Type=x11

Thank you balazs.endresz. Now I can get same driver as you are.
Cc: sadrul@chromium.org
On Thinkpad X1 with libinput driver, touchpad scroll event report as ScrollClassEvent not ScrollEvent.

I already have a patch for this issue. Feel free to try.

Because the event will come with precise_scroll_deltas, no smooth scroll animation apply to the event. You can see page jump scroll quickly. @sadrul do you know anything we can do to increase the event rate on Linux.

https://chromium-review.googlesource.com/c/chromium/src/+/988748
After I applied that patch I kept getting the following error as Chrome crashed right at the moment I started scrolling with the touchpad:[8597:8597:0331/001113.850320:FATAL:mouse_wheel_event_queue.cc(192)] Check failed: needs_update. 

I'm using edge scrolling, so I guess changing finger_count to 2 isn't quite right.

(I was about to try with two-finger scrolling but I did a git pull, and apparently now I have to rebuild everything again, so that will take a while.)

Thank you for check. My test laptop does not have the edge scrolling. finger=2 is required. But we maybe should clean this up.

https://cs.chromium.org/chromium/src/content/browser/renderer_host/render_widget_host_view_event_handler.cc?rcl=35bdafcc9cba142b9a45d91abbc71d0c34694e2a&l=432

I will discuss the dcheck fail with sahel@ Monday.
Hi balazs.endresz, I update the patch to pass the dcheck. Please try with your laptop. Thank you.
I've just tried the updated patch. Zoom is not triggered by ctrl + touchpad scroll any more (which means has_precise_scrolling_deltas is set correctly to true), so that's great. And both two-finger and edge-scrolling behave the same way (you can switch between the two under Settings -> Devices -> Mouse).

However, chromium now crashes on mousewheel scroll instead: https://pastebin.com/eNCHFebR 
I think you've added an extra `return ET_MOUSEWHEEL;` statement after the if-block. I've also removed your changes to the offsets and the finger count, as well as that bit of code mentioned in comment 25. I can't say I know what I'm doing exactly but the diff attached seems to work correctly. 
issue-599497-comment-28.diff
2.8 KB Download
The crash you saw is because still have some ScrollClassEvent device (red dot?) report as mousewheel which should not fill offset_ordinal and the finger count. Added a condition on new patch.
The latest patch is working perfectly now, thank you!

BTW, I also had a look at the trackpoint and it ends up with has_precise_scrolling_deltas=false because xinput says it's a mouse: https://pastebin.com/nB65LrZb
I wouldn't say that's a big issue though because the main reason for fixing this (for me at least) was to prevent accidental zooms with touchpads ( Issue #253697 ).
... and I suspect unintentional zooms are rarely triggered when scrolling with a trackpoint. In any case, I guess that would require changing the reported device type in xinput first, so not a chromium issue. 
I have another fix for this issue maybe feels better. https://chromium-review.googlesource.com/c/chromium/src/+/993400
This new patch 993400 alone (without the previous one) does work too (only mousewheel can trigger zoom), however with libinput has_precise_scrolling_deltas is always false, even for touchpad scroll, which I guess is not technically correct.

And I don't like that the flags/modifiers are not set at all. All the other events have them, so this doesn't feel right. Also, people won't be able to detect the ctrl key during touchpad scroll from javascript any more: window.onmousewheel = (e => console.log(e.ctrlKey))
Hi balazs, Could you please try out the latest patch in https://chromium-review.googlesource.com/c/chromium/src/+/988748

It keeps has_precise_scrolling_deltas, key state and the scroll animation.

Thank you. 
The latest patch (988748) works well for me too.

However, I really can't tell visually when the touchpad has scroll animation and when it doesn't. One thing to note is that libinput has a very noticeable delay before it sends out the first touchpad scroll event, which can be misleading.

And should touchpads really have scroll animation? That's the same as smooth scrolling, isn't it? Again, I don't mind either way, just asking.


> // Linux does not send scroll event on precision touchpad at high rate. 

I thought if I can scroll pixel by pixel that's considered a high rate. Or does that not necessarily imply that events are sent at a high rate?
Yes, scroll animation == smooth scrolling.

When I tried the patch on my Dell Precision 5520 without smooth scrolling it felt much choppier. Scrolling quickly on the touchpad makes the page jump in larger, discrete chunks which feels much worse. It probably depends on touchpad/driver but it does look like the event rate is slow enough that the deltas are much larger than 1-2 pixels per event.

IMHO, leaving smooth scrolling on for precise touchpads has no downside as far as I can tell and can make some touchpads feel better so I'd suggest leaving it on.
I see, that makes sense. I guess one could still look into why we don't actually get precise deltas on some linux machines, but with this patch (988748) it sounds like that doesn't even matter any more because this fixes the zoom issue and there aren't any apparent issues with smooth scrolling being enabled for touchpads. For one, I'm happy with this.
Hi Balazs, Please try out the latest patch at https://chromium-review.googlesource.com/c/chromium/src/+/988748/. try comment/uncomment 516, 517 in events_x_utils.cc with a quick scroll on touchpad. Thank you.
Everything works the same as before and I've tried a few times but I really can't tell the difference after commenting out those lines (on a T480 with ubuntu 18.04 and libinput). 
Project Member

Comment 40 by bugdroid1@chromium.org, Apr 27 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a71865a8aa02887e07490e3c704bd2d00c400323

commit a71865a8aa02887e07490e3c704bd2d00c400323
Author: chaopeng <chaopeng@chromium.org>
Date: Fri Apr 27 20:22:15 2018

Convert Linux touchpad event to Scroll event

On Thinkpad X1 with libinput or synaptics driver, touchpad scroll
event report as ScrollClassEvent not ScrollEvent. For touchpad
report with high precision scroll deltas, we add a event source
check when receive ScrollClassEvent.

Bug:  599497 
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I4c6b5d763275caa98c56f86ec0de0c5aeed9dca2
Reviewed-on: https://chromium-review.googlesource.com/988748
Commit-Queue: Jianpeng Chao <chaopeng@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Sadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554487}
[modify] https://crrev.com/a71865a8aa02887e07490e3c704bd2d00c400323/ui/events/x/events_x_utils.cc
[modify] https://crrev.com/a71865a8aa02887e07490e3c704bd2d00c400323/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Status: Fixed (was: Assigned)
After upgrading to Chromium 68, Ctrl + two-finger scrolling no longer zooms in/out. Reading the first message, the indent appears to have been to "disable ctrl-based zoom on flings", but it seems to be disabled on non-flings as well.

I kind of like it this way (hated accidental zooming with two-finger scroll), but it would be nice if you could confirm it is intentional and not a bug. :-)
RE evangelos@, it is intentional see #6 comment. touchpad gesture should be precise scroll and not support ctrl+wheel zoom.
In relation to my previous question, it's also worth noting that Ctrl + two-finger scrolling does perform zoom-in/out when viewing a PDF file in the browser. (Mentioning this as an inconsistency, doesn't matter much.)

Also, the CL in comment 40 appears to break smooth scrolling for touchpad users; filed issue 867821 for this.

Sign in to add a comment