Commit graph

185 commits

Author SHA1 Message Date
Peter Hutterer
5bd7f93c16 doc/user: add a graph of how different contexts work
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1376>
2025-12-12 04:29:13 +00:00
Peter Hutterer
bde6d07d57 quirks: replace ModelPressurepad with setting INPUT_PROP_PRESSUREPAD
This is the more generic approach and doesn't require us to have any
specific implementation in libinput itself.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1374>
2025-12-09 06:07:01 +00:00
Peter Hutterer
1b4dbb9087 doc/user: minor update to the forcepad/pressurepad documentation
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1374>
2025-12-09 06:07:01 +00:00
Peter Hutterer
d5d38b2ed1 doc/user: fix two typos in ref anchors
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1374>
2025-12-09 06:07:01 +00:00
Peter Hutterer
c2f9ffe17e doc/user: drop references to the touchpad-edge-detector
We've had libinput measure touchpad-size for 5 years now, let's refer
only to that.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1368>
2025-11-24 14:29:56 +10:00
Peter Hutterer
9461d1a9a1 Revert "lua: drop compatibility to 5.1 to allow for luajit"
While luajit seems to be the most popular (and fastest) lua
implementation for higher-level implementations, at the system level
it is relatively unused. Lua 5.4 on the other hand is used by other
system-level components like wireplumber and RPM. In the latter case
this means that lua is already available on every rpm-based distro
without further dependencies.

The performance of 5.4 seems to be acceptable and while luajit may be
faster the extra dependency requires more maintenance. Let's only expose
ourselves to that if absolutely needed.

This is not a strict revert because the code has changed a bit since
with several bugfixes deployed on top.

This reverts commit 2723cadaeb.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1366>
2025-11-18 01:46:53 +00:00
Peter Hutterer
a595f0bd48 lua: export _VERSION so plugins can check the lua version
Since we only support one version this is not very informative but let's
include this now in case we ever need it in the future.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1365>
2025-11-17 16:48:35 +10:00
Marien Zwart
822e571272 doc: fix gitlab remote url
SSH to gitlab.freedesktop.org times out.
ssh.gitlab.freedesktop.org (copied from the Gitlab UI) works..

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1361>
2025-11-08 15:02:59 +11:00
Peter Hutterer
037c07d76f doc/user: fix a few issues with the Lua API documentation
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1354>
2025-11-04 00:27:13 +00:00
Peter Hutterer
f18bf988f7 lua: drop the log global in favor of libinput:log_*
The existence of the log global was in part due to early (pre-merge)
versions of the Lua plugins supporting multiple libinput plugin objects
per file. This is no longer the case and integrating the log functions
into the (single) libinput object makes the code more obvious (we're
calling libinput:log_debug() now, so it's obviously a libinput log
function) and we no longer mix dot with colon notations.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1350>
2025-10-30 13:12:50 +10:00
Peter Hutterer
6b9dbc2a25 lua: remove the inject_frame API
Injecting frame was the first implementation of adding event frames but
it has since effectively been replaced by append/prepend_frame which are
more predictable and easier to support.

In the Lua API injecting frames was only possible within the timer and
the only real use-case for this is to inject events that are then also
seen by other plugins. But that can be achieved by simply ordering the
plugin before the other plugins and using the append/prepend approach.

Until we have a real use-case for injecting events let's remove the API
so we don't lock ourselves into an API that may not do what it needs to
but needs to be supported for a long time.

Closes: #1210
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1351>
2025-10-30 02:08:13 +00:00
Peter Hutterer
2784973b4d doc/user: update the lua plugin documentation
Some clarifications, some fixes, some reshuffling, overall somewhat
better.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1349>
2025-10-30 01:46:33 +00:00
José Expósito
327db95a7c doc/user: Document ModelScrollOnMiddleClick quirk
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1343>
2025-10-23 21:51:35 +00:00
Peter Hutterer
5abe051a9c doc/user: fixes and a TOC for the Configuration Options page
A typo fix, more links and a local TOC since we now have quite a few
options.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1296>
2025-08-12 15:20:12 +00:00
Peter Hutterer
9b58177a7e doc/user: add eraser buttons to the "Configuration Options" page
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1296>
2025-08-12 15:20:12 +00:00
Peter Hutterer
347ff90871 lua: implement support for disabling of features
Because our lua hooks don't expose the device-added callback we need to
cache any calls to disable a feature and then apply it quietly when the
device is actually added. Any other call can go straight through.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1249>
2025-08-07 10:23:30 +10:00
Peter Hutterer
2723cadaeb lua: drop compatibility to 5.1 to allow for luajit
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1192>
2025-08-01 16:49:00 +10:00
Peter Hutterer
9e37bc0cfa plugins: add support for lua plugins to change evdev event streams
This patch adds support for Lua scripts to modify evdev devices and
event frames before libinput sees those events.

Plugins in Lua are sandboxed and restricted in what they can do: no IO,
no network, not much of anything else.

A plugin is notified about a new device before libinput handles it and
it can thus modify that device (changes are passed through to our libevdev
context). A plugin can then also connect an evdev frame handler which
gives it access to the evdev frames before libinput processes them. The
example plugin included shows how to swap left/right mouse buttons:

    libinput:register({1})

    function frame(device, frame)
        for _, v in ipairs(frame.events) do
            if v.usage == evdev.BTN_RIGHT then
                v.usage = evdev.BTN_LEFT
            elseif v.usage == evdev.BTN_LEFT then
                v.usage = evdev.BTN_RIGHT
            end
        end
        return frame
    end

    function device_new(plugin, device)
        local usages = device:usages()
        if usages[evdev.BTN_LEFT] and usages[evdev.BTN_RIGHT] then
            device:connect("evdev-frame", frame)
        end
    end

    libinput:connect("new-evdev-device", device_new)

A few other example plugins are included in this patch

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1192>
2025-08-01 16:04:09 +10:00
Peter Hutterer
9a8254fbb6 doc/user: update architecture docs with the plugin pipeline
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1248>
2025-06-27 04:11:40 +00:00
Peter Hutterer
4ef14e14e4 Add an API for configurable eraser button behavior
This adds the public API to configure an eraser button on a tablet tool
to emulate a normal button. In DEFAULT mode the eraser button will
simply do whatever it does by default (i.e. toggle to eraser).
In BUTTON mode the eraser button will be converted to a regular tool
button event, with libinput handling the underlying proximity event
madness.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1218>
2025-06-18 19:38:14 +10:00
Peter Hutterer
d67474645c doc/user: device quirk matches have to be 0x prefixed
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1223>
2025-06-16 06:39:25 +00:00
Sebastian Lövdahl
17a7ed54d7 Fix typos in index.rst
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1222>
2025-06-13 17:28:05 +00:00
Peter Hutterer
1d9e307e2b touchpad: implement support for three-finger drag
Exposed via new configuration option this enables 3 and 4 finger
dragging on touchpads. When enabled a 3/4 finger swipe
gesture is actually a button down + motion + button up sequence.

If tapping is disabled the drag starts immediately, if tapping is
enabled the drag starts after the tap timeout/motion so we can distinguish
between a tap and a drag.

When fingers are released:
- if two fingers remain -> keep dragging
- if one finger remains -> release drag, switch to pointer motion

When 3/4 fingers are set down immediately after releasing all fingers
the drag continues, similar to the tap drag lock feature. This drag lock
is not currently configurable.

This matches the macos behavior for the same feature.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1042>
2025-02-18 06:44:01 +00:00
Peter Hutterer
44fecb9a98 doc/user: link to the explanation why we can't change the tap default
We don't have an API for "device really should have tapping enabled" so
right now the only indicator of whether that's the case is when the
device has tapping enabled by default. This kind of prevents us from
switching the default, so let's at least link to the comment explaining
this.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1115>
2025-01-07 09:10:50 +00:00
Salvo 'LtWorf' Tomaselli
2f9c173e72 Add examples with other thresholds to the documentation
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1092>
2024-12-16 11:17:22 +10:00
Peter Hutterer
cf5b7bee01 Add tablet area configuration
This adds the configuration option to define a rectangle that serves as
an input area on external tablets such as an Intuos.

The intention behind this is to make this input area behave as if it was
the only physical input area on this tablet with libinput emulating
proximity events as required for where the tools moves in and out
of this area.

This could also be achieved with the existing calibration setting but
area configuration is not calibration and we don't want to expose other
side-effects of the matrix (e.g. scaling and rotation) for these
devices.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1013>
2024-11-05 12:10:48 +10:00
Peter Hutterer
d010c879ef doc: correct that the test suite is indeed run in the CI
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1062>
2024-10-16 18:03:03 +10:00
satrmb
910d59e836 touchpad: add sticky mode to drag-lock
Sticky mode removes the timeout from drag-lock, only a tap ends a drag.
Timeout mode remains available without changes.

Sticky mode is exposed as a new value for the existing drag-lock setting.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1037>
2024-09-05 00:47:47 +00:00
José Expósito
7d849623d5 Fix pre-commit errors
Some files had pre-commit style issues. Fix them.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1036>
2024-09-03 09:51:41 +02:00
Peter Hutterer
6f19267c1e doc/user: fix a typo
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1027>
2024-07-19 10:07:49 +10:00
José Expósito
c201be9b1b doc/user: document ModelTouchpadPhantomClicks quirk
Related https://gitlab.freedesktop.org/libinput/libinput/-/issues/1013

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1023>
2024-07-04 10:11:36 +00:00
Peter Hutterer
82322a4c57 doc/user: document the device quirk MatchFoo statements
Closes #1001

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1016>
2024-06-17 07:58:43 +00:00
Tarcísio Eduardo Moreira Crocomo
46d1fff0b0 touchpad: add clickfinger button map
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/988>
2024-04-09 19:08:17 -03:00
José Expósito
b5b825a7c3 doc/user: Document "Closes" and "Fixes" tags
Describe how the tags should be used. The guidelines for the "Fixes"
tag are taken from the Linux kernel documentation [1][2].

[1] https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes
[2] https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html#describe-changes

Closes: #974
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/978>
2024-02-28 16:59:58 +01:00
Peter Hutterer
8079a51b7f doc/user: note the requirement to apply for gitlab fork permissions 2024-02-02 09:51:31 +10:00
Peter Hutterer
4bc27543e9 tablet: add tablet tool pressure range configuration
Add a configuration option to reduce the available hardware range to a
fraction thereof. This is done by copying the absinfo struct for the
pressure value and adjusting that copy's minimum/maximum value for
scaling into the target normalized range.

The 1%/5% tip thresholds are kept but pressure offset detection is
disabled if there is a custom pressure range.

Unlike the pressure curve which is implemented in the compositor, the
pressure min/max range needs to be in libinput, primarily because the
tip threshold needs to adjust to any new minimum, allowing for
light touches with a pen without triggering tip down even at a higher
hardware pressure.
2024-01-30 14:29:25 +10:00
José Expósito
802b0e14d0 doc/user: add FAQ about scroll speed
This question showed up in my email and it has been asked in the issue
tracker a few times. Explaining why libinput is not the right place to
implement it for future reference.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-11-07 09:50:29 +01:00
Peter Hutterer
fe3ae87b09 touchpad: allow a palm pressure threshold of 0 to disable
Where a more generic match assigns a palm threshold to a device, allow
unsetting this by assigning a threshold of zero.

And remove the bug log for palm size threshold of 0 for the same reason.
2023-10-09 07:03:47 +00:00
Peter Hutterer
4b03374d50 doc/user: update the udev rule to handle bind/unbind events (part 2)
Summary: we expect add, change or remove but kernel 4.12 added bind and
unbind. These events were previously discarded by udevd. Our rules should
handle any event *but* remove, so update as suggested in the announce email
linked below.

For a longer explanation, see the system 247rc2 announcement
https://lists.freedesktop.org/archives/systemd-devel/2020-November/045570.html

See cd37dcfa66 where we did this already
for the udev rules we use ourselves and
a88d107c0d for the patch where we already
updated parts of the docs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-09-28 08:57:15 +10:00
José Expósito
12bb7547f9 meson: Use the meson setup command
Meson recommends using the `meson setup [options]` command:

    WARNING: Running the setup command as `meson [options]` instead of
    `meson setup [options]` is ambiguous and deprecated.

Update the documentation and CI to use the recommended command.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-09-03 17:01:59 +00:00
José Expósito
8d0f2f5f62 pre-commit: Fix end of files
The new pre-commit hook introduced in commit 53517dccb8 ("Add
pre-commit hooks") found 2 files ending with a double empty line:

    Fix End of Files.............................Failed
      - hook id: end-of-file-fixer
      - exit code: 1
      - files were modified by this hook

Fix this error.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-09-03 17:01:59 +00:00
Peter Hutterer
53517dccb8 Add pre-commit hooks
This ensures a few things are correct before we commit and/or push,
making life a bit easier for both our contributors and our maintainers
since some things should no longer end up in the MRs.

Activate via:
$ pre-commit install
$ pre-commit install --hook-type pre-push

The latter is required for the ci-templates hooks which are pre-push
only.
2023-09-01 09:12:54 +00:00
Bjørn Forsman
3dba00845c tablet: increase pressure offset limit from 20% to 50%
detect_pressure_offset() currently rejects offsets that are greater than
20%. My graphics tablet (Wacom Bamboo Fun) is about 30%. The pen tip is
2 mm. Wacom recommends replacing at 1 mm, which means this isn't worn
out yet and we should instead increase the limit to make these devices
usable.

Without this change a "pen down" event happens simultaneously with the
pen being detected -- about 1 cm above the surface -- and producing
libinput pressure of about 0.30. This means you start drawing "in the
air", without knowing up front where the cursor is going to be.

Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com>
2023-08-24 08:04:03 +02:00
Yinon Burgansky
f259cac9ca docs: improve custom pointer acceleration documentation.
- Explain calculation made by the driver.
- Provide detailed example with a plot for a custom function.
- Fix inaccurate explanation of unit values.

Signed-off-by: Yinon Burgansky <yinonburgansky@gmail.com>
2023-08-16 20:13:39 +03:00
Peter Hutterer
f617b414fb Drop the Signed-off-by requirement
We've had this for roughly 10y now and it's value is dubious. Most of
xorg no longer requires, mesa accepts but doesn't require it, most of GNOME
doesn't accept it and neither does systemd.

Let's drop the requirement.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-07-21 09:08:46 +10:00
Peter Hutterer
b39145e468 doc/user: quirks are available, not supported
This is a bit nitpicky but let's call the current quirks merely
"available" rather than "supported" since quirks should never be seen as
supported API.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-29 03:32:05 +00:00
Peter Hutterer
a88d107c0d doc/user: update the udev rule to handle bind/unbind events
Summary: we expect add, change or remove but kernel 4.12 added bind and
unbind. These events were previously discarded by udevd. Our rules should
handle any event *but* remove, so update as suggested in the announce email
linked below.

For a longer explanation, see the system 247rc2 announcement
https://lists.freedesktop.org/archives/systemd-devel/2020-November/045570.ht

See cd37dcfa66 where we did this already
for the udev rules we use ourselves.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-15 03:31:30 +00:00
Peter Hutterer
65c71fd6b4 doc/user: move ignoring devices to separate page
This is way too hidden to the point where i couldn't find it for quite a
while despite knowing it exists. Move it to an entry under
troubleshooting.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-12 13:50:25 +00:00
Simon Ser
57a2339779 doc/user/timestamps: document which clock is used
Document that all timestamps are given in the CLOCK_MONOTONIC
domain.

Signed-off-by: Simon Ser <contact@emersion.fr>
2023-05-09 11:18:23 +02:00
Peter Hutterer
d3481c8807 evdev: if a device's rotation is around 180 degrees, flip the wheel
For a device used upside-down, make sure the wheels correspond to the
new physical directions. There's a grace range of 20 degrees either way
since that seems like it makes sense.

For 90 degree rotation (or 270 degree) the wheel is left as-is, the
heuristics to guess what angle we want in this case is not clear enough.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-27 13:15:14 +10:00