Contributing to libinput¶
So you want to contribute to libinput? Great! We’d love to help you be a part of our community. Here is some important information to help you.
As a freedesktop.org project, libinput follows the freedesktop.org Contributor Covenant.
Please conduct yourself in a respectful and civilised manner when interacting with community members on mailing lists, IRC, or bug trackers. The community represents the project as a whole, and abusive or bullying behaviour is not tolerated by the project.
Questions can be asked on
#wayland-devel on freenode or on the
For IRC, ping user
whot (Peter Hutterer, the libinput maintainer) though
note that he lives on UTC+10 and thus the rest of the world is out of sync
by default ;)
For anything that appears to be device specific and/or related to a new feature, just file an issue in our issue tracker. It’s usually the most efficient way to get answers.
If you don’t already know what you want to improve or fix with libinput,
then a good way of finding something is to search for the
tag in our issue tracker.
These are issues that have been triaged to some degree and deemed to be a
possible future feature to libinput.
Some of these issue may require specific hardware to reproduce.
Another good place to help out with is the documentation. For anything you find in these pages that isn’t clear enough please feel free to reword it and add what is missing.
The libinput build instructions have all the details but the short solution will be:
$> git clone https://gitlab.freedesktop.org/libinput/libinput $> cd libinput $> meson --prefix=/usr builddir/ $> ninja -C builddir/ $> sudo ninja -C builddir/ install
You can omit the last step if you only want to test locally.
libinput has a roughly three-parts architecture:
the front-end code which handles the
libinput_some_function()API calls in
the generic evdev interface handling which maps those API calls to the backend calls (
there are device-specific backends which do most of the actual work -
evdev-mt-touchpad.cis the one for touchpads for example.
In general, things that only affect the internal workings of a device only get implemented in the device-specific backend. You only need to touch the API when you are adding configuration options. For more details, please read the libinput’s internal architecture document. There’s also a blog post describing the building blocks that may help to understand how it all fits together.
Documentation is in
/doc/api for the doxygen-generated API documentation.
These are extracted from the libinput source code directly. The
documentation you’re reading right now is in
/doc/user and generated with
sphinx. Simply running
ninja -C builddir will rebuild it and the final
product ends up in
libinput provides a bunch of Helper tools to debug any changes - without having to install libinput.
$> sudo ./builddir/libinput-debug-events --verbose $> sudo ./builddir/libinput-debug-gui --verbose
The former provides purely textual output and is useful for verifying event
streams from buttons, etc. The latter is particularly useful when you are
trying to debug pointer movement or placement.
libinput debug-gui will
also visualize the raw data from the device so you can compare pointer
behavior with what comes from the kernel.
These tools create a new libinput context and will not affect your session’s behavior. Only once you’ve installed libinput and restarted your session will your changes affect the X server/Wayland compositor.
Once everything seems to be correct, it’s time to run the libinput test suite:
$> sudo ./builddir/libinput-test-suite
This test suite can take test names etc. as arguments, have a look at libinput test suite for more info. There are a bunch of other tests that are run by the CI on merge requests, you can run those locally with
$> sudo ninja -C builddir check
So it always pays to run that before submitting. This will also run the code through valgrind and pick up any memory leaks.
Any patches should be sent via a Merge Request (see the GitLab docs) in the libinput GitLab instance hosted by freedesktop.org.
To submit a merge request, you need to
Register an account in the freedesktop.org GitLab instance.
Fork libinput into your username’s namespace
Get libinput’s main repository:
git clone https://gitlab.freedesktop.org/libinput/libinput.git
Add the forked git repository to your remotes (replace
USERNAMEwith your username):
cd /path/to/libinput.git git remote add gitlab email@example.com:USERNAME/libinput.git git fetch gitlab
Push your changes to your fork:
git push gitlab BRANCHNAME
Submit a merge request. The URL for a merge request is:
Select your branch name to merge and
masteras target branch.
libinput strives to have a linear, ‘recipe’ style history This means that every commit should be small, digestible, stand-alone, and functional. Rather than a purely chronological commit history like this:
doc: final docs for view transforms fix tests when disabled, redo broken doc formatting better transformed-view iteration (thanks Hannah!) try to catch more cases in tests tests: add new spline test fix compilation on splines doc: notes on reticulating splines compositor: add spline reticulation for view transforms
We aim to have a clean history which only reflects the final state, broken up into functional groupings:
compositor: add spline reticulation for view transforms compositor: new iterator for view transforms tests: add view-transform correctness tests doc: fix Doxygen formatting for view transforms
This ensures that the final patch series only contains the final state, without the changes and missteps taken along the development process.
The first line of a commit message should contain a prefix indicating what part is affected by the patch followed by one sentence that describes the change. For example:
touchpad: add software button behavior fallback: disable button debouncing on device foo
If in doubt what prefix to use, look at other commits that change the same file(s) as the patch being sent.
Commit messages must contain a Signed-off-by line with your name and email address. An example is:
A description of this commit, and it's great work. Signed-off-by: Claire Someone <name@domain>
If you’re not the patch’s original author, you should also gather S-o-b’s by them (and/or whomever gave the patch to you.) The significance of this is that it certifies that you created the patch, that it was created under an appropriate open source license, or provided to you under those terms. This lets us indicate a chain of responsibility for the copyright status of the code. An example is:
A description of this commit, and it's great work. Signed-off-by: Claire Someone <name@domain> Signed-off-by: Ferris Crab <name@domain>
When you re-send patches, revised or not, it would be very good to document the changes compared to the previous revision in the commit message and/or the merge request. If you have already received Reviewed-by or Acked-by tags, you should evaluate whether they still apply and include them in the respective commit messages. Otherwise the tags may be lost, reviewers miss the credit they deserve, and the patches may cause redundant review effort.
For further reading, please see ‘on commit messages’ as a general guideline on what commit messages should contain.
Once submitted to GitLab, your patches will be reviewed by the libinput development team on GitLab. Review may be entirely positive and result in your code landing instantly, in which case, great! You’re done. However, we may ask you to make some revisions: fixing some bugs we’ve noticed, working to a slightly different design, or adding documentation and tests.
If you do get asked to revise the patches, please bear in mind the notes above.
You should use
git rebase -i to make revisions, so that your patches
follow the clear linear split documented above. Following that split makes
it easier for reviewers to understand your work, and to verify that the code
you’re submitting is correct.
A common request is to split single large patch into multiple patches. This can happen, for example, if when adding a new feature you notice a bug in libinput’s core which you need to fix to progress. Separating these changes into separate commits will allow us to verify and land the bugfix quickly, pushing part of your work for the good of everyone, whilst revision and discussion continues on the larger feature part. It also allows us to direct you towards reviewers who best understand the different areas you are working on.
When you have made any requested changes, please rebase the commits, verify that they still individually look good, then force-push your new branch to GitLab. This will update the merge request and notify everyone subscribed to your merge request, so they can review it again.
There are also many GitLab CLI clients, if you prefer to avoid the web interface. It may be difficult to follow review comments without using the web interface though, so we do recommend using this to go through the review process, even if you use other clients to track the list of available patches.