package libinput

All checked builds pass
  1. Overview
  2. Docs
OCaml bindings for libinput

Install

dune-project
 Dependency

Authors

Maintainers

Sources

libinput-1.29.tbz
sha256=3de44543b3995d15d0c3ff2dbc1788403427a2c907716552cded9134681880fd
sha512=9e92438c6183d0e6e7d76c28e67133ce25d230686881a47a874a07d0e79163d3033606f69d07225d2d6eaea687a57d943429b9d5b533d344a773262e951e662e

Description

Input device management and event handling library

Added to opam-repository:

README

OCaml bindings for libinput.

This provides access to almost all of the libinput C API. The missing functions are:

  • libinput_next_event_type: the OCaml bindings combine the event type and payload, so providing this would require exporting a second large type, and it doesn't seem useful.
  • The various *_set_user_data and *_get_user_data functions. Attaching data to callbacks is easy in OCaml, and you can use ephemerons to attach extra data to things if needed.
  • Some *_get_context functions, as it's easy to pass the context explicitly in OCaml.
  • libinput_device_get_udev_device would only be useful with compatible udev bindings.

examples/simple.ml shows a simple example of using the library. For example:

$ sudo chown "$USER" /dev/input/event2
$ dune exec -- ./examples/simple.exe /dev/input/event2
Adding device "/dev/input/event2"
libinput info: event2  - Logitech USB Optical Mouse: is tagged by udev as: Mouse
libinput info: event2  - Logitech USB Optical Mouse: device is a pointer
Created libinput context
{type = `Device_added _;
 device = {sysname = "event2"; name = "Logitech USB Optical Mouse";
           bustype = 0x3; vendor = 0x46d; product = 0xc077; output = null;
           seat = {physical_name = "seat0"; logical_name = "default"}}]}
Waiting for events...
{type = `Pointer_button {time = 57416.335901;
                         button = 272;
                         state = `Pressed;
                         seat_key_count = 1};
 device = {sysname = "event2"; name = "Logitech USB Optical Mouse"; ...}]}
{type = `Pointer_button {time = 57416.383910;
                         button = 272;
                         state = `Released;
                         seat_key_count = 0};
 device = {sysname = "event2"; name = "Logitech USB Optical Mouse"; ...}]}

Dependencies (6)

  1. conf-libinput
  2. fmt >= "0.8.9"
  3. ctypes-foreign >= "0.23.0"
  4. ctypes >= "0.23.0"
  5. ocaml >= "5.3.0"
  6. dune >= "3.18" & < "3.25"

Dev Dependencies (1)

  1. odoc with-doc

Optional Dependencies

None

Used by

None

Conflicts

None

Build status

Results of building libinput with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
1.29 (this version) n/a n/a n/a good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure