October 15th update: In a stroke of great fortune, the highest rated app in our "Which apps should we support?" poll was Firefox (by a stroke of almost 3x), AND the Firefox development team reached out to us this week to collaborate on bringing multitouch/gesture support to Linux Firefox. We'll include more details about our collaboration with Firefox in the next update post, but it looks like the support for multitouch gestures should be improving soon in Firefox. 🚀
Original post follows:
Thank you to everyone who has contributed via our Github Sponsors program! While sponsorship of the touchpad fell to $1,100 in September (below the $1,500/month we hope to stay above), the funds that we collected earlier will help propel this project for the next couple months. And I figure a fresh update can't hurt the interest level in this most esoteric of causes.
The developer we introduced in our previous update, Povilas, has been 🔥🚒 over the past couple of months. His most recent update follows.
If you'd like to help sponsor our ongoing efforts, please visit our Github Sponsors project. More on the project's budget status at the end of this update.
The code to pass gestures from libinput to X11 apps is now finished. We have packages for testing it on Ubuntu 20.04, check out the p12/xorg-gestures personal package archive (PPA) . Full testing instructions are in the "Testing instructions" section below. If you're interested in the code that was used to build these packages, scroll to the "Development details" section below.
The current effort has not made touchpad gestures useful yet. As we wrote in the previous blog post, gestures need to be supported across the whole technology stack in order for them to work. The current situation is as follows:
Low-level input driver. Works, handled by libinput ✅
Display server. Works on Wayland/Mutter ✅ and likely other Wayland display servers, not yet released on Xorg 🟡
Widget toolkits. Works on Gtk/Wayland ✅, not yet released on Gtk/X11 🟡. No Wayland or X11 gesture support in QtWidgets ❌, wxWidgets ❌, Tck/Tk ❌, FLTK ❌, EFL ❌
Applications. Works on GNOME Image viewer ✅, most likely does not work on anything else ❌❌❌...❌
The previous blog post was not clear enough on why we've chosen to improve the X server instead of working on things related on Wayland. The X server is still being used by a large majority of users just because it's the default on Ubuntu. As a result, gesture support would likely have very low priority for the maintainers of widget toolkits and applications if the X server did not support touchpad gestures. This would have made it very hard to get their attention to this feature, both discussing overall design and then getting them to review and merge the code. We would have wasted a lot of time and money just spinning our wheels. When we have gesture support on X, we can point that whole Linux ecosystem has this feature universally.
Fortunately, all subsequent work will benefit all Linux users, regardless of whether they use Wayland or X server. 🎉
The last two remaining parts of getting touchpad gestures to "just work" on Linux: to implement support of them in applications and widget libraries. We've created a survey where you can specify the top three applications which you think could be more comfortable if they supported touchpad gestures. We will prioritize subsequent work depending on the results. If you want touchpad gestures in the desktop itself, e.g. to switch between windows, specify what compositor it uses, e.g. KWin or Mutter or Sway.
If you want touchpad gesture support in Chrome or Firefox, unfortunately we won't be able to prioritize that because it needs changes to the browser engine itself, which is a complex task best left to the dedicated browser developers. If you are a browser developer or know somebody who is, please reach out to us at [email protected] and we'd be excited to work together to get multitouch functional.
This will only work on Ubuntu 20.04. Don't try this on other distributions, as this modified X server most likely will be incompatible with the rest of components such as graphics drivers and will fail to boot into a graphical interface.
Install all upgrades on the system
Add the p12/xorg-gestures PPA to the list of enabled repositories:
sudo add-apt-repository ppa:p12/xorg-gestures sudo apt-get update
Try to install all upgrades again. Make sure that at least the following packages will be upgraded:
libgtk-3-0. This is the minimal set required for gestures to work. If it's not the case on your system which may happen if you're reading this blog post several months after it has been posted, create a bug report here. Most likely the version number of some package needs to be updated.
xserver-xorg-input-synaptics package to make sure libinput is used for your touchpad.
One of the applications that already support touchpad gestures out of the box is the "Eye of GNOME" image viewer. To try it, install the
eog package, open an image with the application and try two-finger rotation gesture to rotate the image. Note that it's sometimes hard to trigger the gesture, this is a separate issue in the libinput library itself which we'll probably fix in the future.
To see the gestures in a more controlled environment, try the
gtk3-demoapplication which comes with the
gtk-3-examples package. Open the application, double-click on the "Gestures" item on the list on the left and try touchpad gestures on the window that opens. Three finger gestures will draw a red line in the direction of the gesture and two-finger pinch gestures will show and rotate a colorful cube.
Passing touchpad gesture events from libinput to X11 apps seems like an easy task - you just read data and send it somewhere else. Unfortunately the actual code in X11 is much more complex. The major source of complexity is how all the mouse, touch and gesture events interoperate with the input grabs in the X11 protocol. In the end I had to rewrite the implementation two times until I arrived at a solution that is not overly complicated.
The code has not yet been reviewed, so I'll still need to put some time into managing the journey of the code into the X server and related projects. Other than that, the features have been completed: we have around 200 test cases and a relatively good understanding of how the X server works internally. Tests in particular will make code reviews much less painful as we can be sure that the code still works well after addressing review comments.
The following links list all the code that is the result of the past 3 months of work implementing touchpad gestures:
Changes to the X Input protocol:
https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/merge_requests/18 (+541, -10 lines)
LibXi library that acts as an interface between user code and the Xorg server
https://github.com/p12tic/xorg-libXi/pull/1 (+421, -15 lines)
Libinput Xorg server driver
https://github.com/p12tic/xorg-xf86-input-libinput/pull/1 (+102, -3 lines)
The Xorg server implementation
https://github.com/p12tic/xorg-xserver/pull/1 (+1854, -228 lines)
Test input driver for Xorg server tests
https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/527 (+1201, -0 lines)
X server changes for synchronization with the test input driver
X server test infrastructure
https://github.com/p12tic/xorg-gtest/pull/1 (+1186, -3 lines)
X server tests for gesture events:
https://github.com/p12tic/xorg-integration-tests/pull/1 (+3,390, -757 lines)
Xorg touchpad gesture support in GTK+
https://github.com/p12tic/gtk/pull/1 (+200, -6)
You may notice that some of the above links point to my own forks on GitHub and not to PRs in official repositories. This is because of dependencies between code - certain PRs need to be reviewed first and only then it starts to make sense to look into subsequent code.
The code used to build the Ubuntu packages can also be found in the repositories linked above. The debian packaging is in
*-debian branches from which the packages have been built.
The number of different projects being modified speaks to the complexity of this undertaking, and why it has been so essential to prove public support to propel Linux touchpads to work as well as their mainstream counterparts. We're making some serious progress, which is awesome to see. We will post a new blog post in a month with the survey results and the plan of what we are thinking of doing next.
We've collected about $7,500 to date, which keeps the lights on for about 5 months. We've only used three of those months so far, so there's good reason to remain optimistic about the long-term difference that our existing budget will effect. If anyone else has considered championing an open source project as a hobby, dm me! The leadership that Github Sponsors has brought to this space yields an unprecedented opportunity to tackle interesting niche projects.