Skip to content

Conversation

@m4rch3n1ng
Copy link

@m4rch3n1ng m4rch3n1ng commented Jun 5, 2025

i have updated the libinput bindings and wrapper functions to use. i have gradually updated to libinput 1.23, then 1.26, then 1.27 and finally to 1.28.

this pr is split up into commits that generate the ffi bindings and then another commit to use them in the rust wrapper crate input, once per update to help with the review and to make it easier for me to implement the features in smaller increments and make the diffs more useful.

if you prefer i can split this pr up into multiple smaller ones.

i have kept the default version of libinput at 1.21 for now, but i can increase it if you want.

notable changes for the updates:

libinput 1.23

1.23 introduced a new AccelProfile struct, that is not ref-counted, but has to be manually destroyed after every use. this makes it also not Clone (which i think is the intent), as it would otherwise result in a double-free / use-after-free.

in the original introduction of libinput_config_accel_set_points, they didn't say that the points slice pointer was const, so bindgen generated a *mut pointer. for forward compatibility (as they changed that very recently and that will be included in the next release), i have decided to use a as _ to support both *mut and *const declarations.

libinput 1.26

1.26 was a relatively straightforward change, only adding new features (the new ClickfingerButtonMap, TabletPadDialEvent, and pressure configuration for the TabletTool)

the only somewhat interesting change is, that the docs for the libinput_event_tablet_pad_get_ring_position function was previously incorrectly claiming that the returned degrees are counterclockwise, while they are actually clockwise.

libinput 1.27

this one was the most painful. input previously returned a bool for ENABLED and DISABLED, but libinput 1.27 now returns two new values, ENABLED_TIMEOUT and ENABLED_STICKY, so i had to change the return type to an enum (DragLockState) with the three variants Disabled, EnabledTimeout and EnabledSticky, as the previous ENABLED variant is just an alias for ENABLED_TIMEOUT.

this is, as far as i can tell, the only breaking change that this update introduced.

the additional addition of config_area_set_rectangle was less annoying though.

libinput 1.28

the final upgrade to 1.28 was also pretty painless. i have decided to name the struct ThreeFingerDragState with the variants of EnabledThreeFinger and EnabledFourFinger (instead of using 3fg and 4fg), as the ScrollMethod enum also does that with TwoFinger, though i decided against doing that for the function name as that was already verbose enough.

@m4rch3n1ng m4rch3n1ng force-pushed the libinput-1-28 branch 2 times, most recently from b75ba2b to 08d141e Compare June 6, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant