Bug 99415

Summary: RFE: Need way to report start of finger scroll
Product: Wayland Reporter: Adam Goode <adam>
Component: libinputAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: medium CC: carlosg, nate, peter.hutterer
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 99165    

Description Adam Goode 2017-01-15 03:59:41 UTC
It would be good to be able to have kinetic scrolling stop if fingers go back down on a touchpad in a scrolling gesture (two fingers, edge, etc). This lets you fling with two fingers, then stop the scrolling by putting fingers back down.

To do this, we need to get some event that represents scroll-finger down, but not yet moved.

I think emitting a zero event would work for this, the same as finger up and button down.
Comment 1 Peter Hutterer 2017-01-15 23:18:29 UTC
Carlos, any comments?

fwiw, it's not always clear whether two fingers down mean scrolling, so there's quite a few details we'd have to work out. but I'd like to hear Carlos' comments first on whether this would be interesting for the client side.
Comment 2 Adam Goode 2017-01-15 23:29:56 UTC
My motivation is to make sure we can get touchpad scrolling that works as well as touchscreen scrolling. In this case, with a touchscreen on common platforms (Android, iOS), you can fling a page and watch it scroll by, then put your finger down to halt the fling.

On Chrome OS, it works this way with 2-finger scrolling flings, and it is a very nice way to seek through long documents.

When I was using evince, I noticed that I got the fling, but it wouldn't stop without scrolling a bit (which wasn't very easy, and made me miss the target). I looked into what Gtk+ and libinput were doing and realized that I wasn't getting the finger down events at all.

Thanks for thinking about this. It doesn't need to be a scroll event actually, but could be a new or existing touch event (proximity)?
Comment 3 Peter Hutterer 2017-01-16 00:21:57 UTC
Just thinking aloud: I'm half-tempted to make this an extra event together with introducing a new AXIS_CANCEL event. Right now scrolling cannot easily be cancelled and that's hurting us for gesture responsiveness.
Comment 4 Adam Goode 2017-01-16 01:38:19 UTC
I like the idea of a new event. The "zero-terminated" scroll always seemed a bit magical.
Comment 5 Carlos Garnacho Parro 2017-01-16 11:35:05 UTC
FWIW, I think this is a worthwhile addition. I guess the event can be reasonably sent on the same scroll sources that currently trigger the 0-movement events on scroll end.

And I do think too it's a good idea to split into a separate event type, it will probably make sense to emit these events even if a 2fg operation on the touchpad turns into a rotate/pinch gesture, and it seems more tractable to make this a different event type than POINTER_AXIS.

Also +1 to making scroll start/end distinctive. On scroll end we do want to keep the momentum, but on scroll start we do want to stop it. I guess both cases might be put together as "apply the current velocity" trusting that it will be 0 on scroll start, however this seems too high level knowledge, so IMO would be great to have some kind of explicit hint from libinput.
Comment 6 Peter Hutterer 2017-01-17 05:39:56 UTC
I guess the main issue I have with this is that we can't drop the "scroll is 0 on stop" without breaking backwards compatibility, so if we send a scroll stop event, we'd be sending the same information twice and guarantee that it always gets ignored. Leaving it out would result in perceived asymmetrical event stream. That's a bit unfortunate.

But otherwise, it'd be a LIBINPUT_EVENT_POINTER_AXIS_START and LIBINPUT_EVENT_POINTER_AXIS_CANCEL, sent only for some pointer sources. The former is relatively trivial, the latter is the one that needs the detailed work to avoid breaking backwards compatibility.
Comment 7 Carlos Garnacho Parro 2017-01-17 15:59:58 UTC
(In reply to Peter Hutterer from comment #6)
> I guess the main issue I have with this is that we can't drop the "scroll is
> 0 on stop" without breaking backwards compatibility, so if we send a scroll
> stop event, we'd be sending the same information twice and guarantee that it
> always gets ignored. Leaving it out would result in perceived asymmetrical
> event stream. That's a bit unfortunate.

Absolutely, but it's just unfortunate :), once a compositor moves to the newer event to trigger kinetic scroll, a 0-distance axis event would be transparently ignored.

> 
> But otherwise, it'd be a LIBINPUT_EVENT_POINTER_AXIS_START and
> LIBINPUT_EVENT_POINTER_AXIS_CANCEL, sent only for some pointer sources. The
> former is relatively trivial, the latter is the one that needs the detailed
> work to avoid breaking backwards compatibility.

I find those names a bit confusing... Not sure if I'm getting the equivalences right, but on AXIS_START the client is supposed to stop kinetic scrolling, while on AXIS_CANCEL it does start it?

I guess it's the word "cancel" what troubles me, as it implies something that can be easily mistaken for its counterpart. I think AXIS_START/AXIS_END are more symmetric and have less connotations about the effect they're meant to produce. It still doesn't sound entirely alright for the times they're emitted unpaired (eg. before 2fg gestures), the oddity might be solved though if we ensure to emit both start+end before handling it as a gesture.
Comment 8 Peter Hutterer 2017-01-19 05:16:16 UTC
first rfc on the list, mostly so we have a bit of a wider audience

https://lists.freedesktop.org/archives/wayland-devel/2017-January/032732.html
Comment 9 Peter Hutterer 2017-08-17 23:21:13 UTC
just rebased this locally to clean it up and found a potential issue: what happens when you 2fg-scroll and then put a single finger down - the scroll motion *should* stop. So now what we're looking at is less a scroll sequence tracking as potential finger down tracking. That's a lot more complicated, because it may need to be per-finger (what about palms, thumbs, etc?). Not 100% sure about this yet, need to re-think this.
Comment 10 Peter Hutterer 2018-05-25 05:50:19 UTC
It's been almost a year since I worked on this and I haven't come up with anything working. No feedback from anyone, so it's probably not that important.
Comment 11 Nate Graham 2018-05-25 14:41:09 UTC
FWIW, I'd like this. Unfortunately I don't have the time to help write code, but maybe this could be a good job for my GSoC student Furkan?
Comment 12 Peter Hutterer 2018-05-29 04:05:44 UTC
I don't think it's a good GSoC project tbh, mostly because GSoC somewhat requires success and there's no guarantee that this will work or that we can find any solution for it. So it could be a lot of effort for no result which isn't particularly motivating.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.