Two finger touchpad horizontal swipe gesture for forward and back should work in GTK (Linux)
Categories
(Core :: Widget: Gtk, enhancement, P5)
Tracking
()
People
(Reporter: yoasif, Assigned: jwatt)
References
Details
Attachments
(1 file)
STR:
Use two fingers on touchpad and swipe horizontally to the left or right.
What happens:
Nothing.
Expected result:
Page should move back or forward.
This is now enabled in Webkit https://trac.webkit.org/changeset/241224/webkit and GNOME Web: https://blogs.gnome.org/mcatanzaro/2019/03/27/epiphany-3-32-and-webkitgtk-2-24/
Updated•6 years ago
|
Reporter | ||
Updated•6 years ago
|
Updated•6 years ago
|
Comment 2•5 years ago
|
||
Any roadmap for this?
Can we please get an update on this? Now that pinch zoom if is finally landed on Linux, this would be amazing to complete the trackpad support on Linux.
Comment 5•4 years ago
|
||
Swipe-to-navigate is one of the APZ features under consideration for the Firefox Proton release.
Based on the most recent discussions, overscroll is likely to have higher priority, and we may not have time to do both for Proton, but even in that case swipe-to-navigate will be a high-priority follow-up to Proton.
Support for this feature does require some platform-specific work. As with desktop zooming, we will likely implement for Windows first, and then Linux (Mac already supports it). You can follow the Windows progress in bug 1564022.
![]() |
Assignee | |
Updated•3 years ago
|
![]() |
Assignee | |
Comment 7•3 years ago
|
||
It looks like the frontend code will do the right thing (go back/forward) if the widget code sends the correct eSwipeGesture* events:
https://searchfox.org/mozilla-central/search?q=eSwipeGesture&path=widget%2FEventMessageList.h
Currently only the cocoa code does that:
https://searchfox.org/mozilla-central/search?q=SwipeGesture&path=widget
In GTK land we handle GDK_TOUCHPAD_PINCH:
https://searchfox.org/mozilla-central/search?q=GDK_TOUCHPAD_PINCH
But there's no code to handle GDK_TOUCHPAD_SWIPE.
https://docs.gtk.org/gdk3/struct.EventTouchpadSwipe.html
https://docs.gtk.org/gdk3/enum.TouchpadGesturePhase.html
![]() |
Assignee | |
Updated•3 years ago
|
Updated•3 years ago
|
Comment hidden (advocacy) |
Updated•3 years ago
|
Comment 9•3 years ago
|
||
(In reply to Jonathan Watt [:jwatt] from comment #7)
It looks like the frontend code will do the right thing (go back/forward) if the widget code sends the correct eSwipeGesture* events:
https://searchfox.org/mozilla-central/search?q=eSwipeGesture&path=widget%2FEventMessageList.hCurrently only the cocoa code does that:
https://searchfox.org/mozilla-central/search?q=SwipeGesture&path=widgetIn GTK land we handle GDK_TOUCHPAD_PINCH:
https://searchfox.org/mozilla-central/search?q=GDK_TOUCHPAD_PINCHBut there's no code to handle GDK_TOUCHPAD_SWIPE.
https://docs.gtk.org/gdk3/struct.EventTouchpadSwipe.html
https://docs.gtk.org/gdk3/enum.TouchpadGesturePhase.html
Unfortunately, it's not that easy. 2 finger swipes are usually recognized as "scrolls" so the wayland compositor, most likely, won't send the corresponding swipe gesture event.
Comment 10•3 years ago
|
||
(In reply to Vlad Zahorodnii [:zzag] from comment #9)
Unfortunately, it's not that easy. 2 finger swipes are usually recognized as "scrolls" so the wayland compositor, most likely, won't send the corresponding swipe gesture event.
Have you ever used an epiphany browser?
Horizontal scrolling takes precedence, and gesture animation occurs when the end is reached.
![]() |
Assignee | |
Comment 11•3 years ago
|
||
Ideally we'd use GDK_TOUCHPAD_SWIPE/GdkEventTouchpadSwipe (GTK's native events)
for this for the best compatibility with the the platform/other apps.
Unfortunately that seems complicated, so for now we use our SwipeTracker code
and make our own determination of what counts as a swipe.
Note that the pref widget.swipe.whole-page-pixel-size can be used to tweak
the swipe sensitivity.
Comment 12•3 years ago
|
||
Just so that i understand whats blocking GDK impl, does it require targeting a newer version or is it simply that it will take a lot more work to wire up the events to the back action in a way that allows detecting gestures early and triggering 1:! animations?
![]() |
Assignee | |
Comment 13•3 years ago
|
||
I'm hoping the current patch is sufficient (for Wayland - it doesn't work for X.org).
I pushed the patch to CI, and the resulting build can be found at:
I'd appreciate any testing that anyone can do. I tested on GNOME on a laptop using both the built-in trackpad and an external Apple trackpad.
Specifically, I'd be interested to know:
a) does it work for you?
b) what are the max/min values for the pref widget.swipe.whole-page-pixel-size
that work for you, and is the default (80) acceptable?
![]() |
Assignee | |
Comment 14•3 years ago
|
||
(In reply to Rohan from comment #12)
Just so that i understand whats blocking GDK impl
Various things. I'll write a longer comment after I get the current patch landed since I want to focus on getting that landed for Firefox 103, and soft freeze is in a couple of days. Offhand, some of the issues for the GDK swipe event approach are that I wasn't getting events is some circumstances, GNOME with certain configurations appears to have both the app and desktop respond to swipes simultaneously, and libinput itself doesn't dispatch swipes for two finger swipes.
Comment 15•3 years ago
|
||
(In reply to Jonathan Watt [:jwatt] from comment #14)
libinput itself doesn't dispatch swipes for two finger swipes.
AFAIK what we want here is indeed tracking two finger scrolling - that's what other GTK apps use. Swipe gestures, i.e. three or more fingers on touchpads, may be used for e.g. the Gnome Shell. So the approach here looks like the optimal one to me, IIUC.
Comment 16•3 years ago
|
||
Thank you for implementing this!
Just tested this on a Thinkpad t480 with the built-in touchpad under Gnome 42/Wayland. Works flawlessly with the default settings!
In regards to the values for widget.swipe.whole-page-pixel-size
, I was able to go as low as 30 without triggering the gestures accidentally. I think 80 is okay, I would suggest anything higher as it makes usage a bit cumbersome.
Comment 17•3 years ago
|
||
I guess we can expect this to be present in the next nightly, right?
Comment 18•3 years ago
|
||
Also, for me on a laptop with a pretty big trackpad (Asus Zephyrus M16), the default value of widget.swipe.whole-page-pixel-size
is way too big, and I found a value of 20 as the sweet spot for me. But my input might also be different as I use libinput-config with scroll-factor set to .25 (not sure if this affects this gesture too)
Comment 19•3 years ago
|
||
Comment 20•3 years ago
|
||
bugherder |
![]() |
Assignee | |
Comment 21•3 years ago
|
||
Thanks for the feedback, everyone. I expect this will be in Nightly later today and in Beta 103.
I reduced the sensitivity to 40 after your feedback and based on my own feeling for what works. There's every chance we may end up tweaking the default, but we'll see how it goes.
Comment 22•3 years ago
|
||
This is exciting, thanks Jonathan!
(In reply to Jonathan Watt [:jwatt] from comment #21)
I expect this will be in Nightly later today and in Beta 103.
Do we want it to be in beta 103? I wonder if a cycle of nightly-only baking time would make sense to gather additional feedback.
Updated•3 years ago
|
Comment 23•3 years ago
|
||
For clarity, it's only enabled for early beta (same as Windows).
Comment 24•3 years ago
|
||
The patch also works on X11, you just have to set the MOZ_USE_XINPUT2=1
environment variable (and run an up to date X server)
Updated•3 years ago
|
Comment 25•3 years ago
|
||
(In reply to benpicco from comment #24)
The patch also works on X11, you just have to set the
MOZ_USE_XINPUT2=1
environment variable (and run an up to date X server)
Could you please suggest how to test the feature. I have a recent Manjaro on Lenovo Ideapad with a recent enough X11/KDE, Firefox 103.
Two-fingers scroll works in Firefox as well as zoom pinch. I have exported MOZ_USE_XINPUT2=1
variable, as you suggested. However history forth/back is still missing.
Thank you in advance.
Comment 26•3 years ago
|
||
(In reply to AlexM from comment #25)
On release you need to set widget.disable-swipe-tracker=false
on about:config
.
Comment 27•3 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #26)
(In reply to AlexM from comment #25)
On release you need to setwidget.disable-swipe-tracker=false
onabout:config
.
Thank you a lot! Now it works like a charm.
Description
•