Module Input.Context

Handles for accessing libinput.

Create a context using Context.Udev.create or Context.Path.create.

When done (typically when your program exits), call Context.destroy. This is not done automatically from a GC finaliser because destroying a context may trigger various actions (such as sending DBus messages) and it's good to control when these happen.

type +'a t

A handle for accessing libinput.

module Udev : sig ... end

A context that uses udev to find available devices.

module Path : sig ... end

A context that requires the caller to add and remove devices explicitly.

val dispatch : _ t -> unit

dispatch t reads events from the file descriptors and processes them internally.

Dispatching does not necessarily queue libinput events. This function should be called immediately once data is available on the file descriptor returned by get_fd. libinput has a number of timing-sensitive features (e.g. tap-to-click); any delay in calling dispatch may prevent these features from working correctly.

val get_fd : _ t -> Unix.file_descr

get_fd t is the single file descriptor that libinput uses for all events.

Call dispatch if any events become available on this fd. The returned descriptor is valid until destroy is called.

val suspend : _ t -> unit

Suspend monitoring for new devices and close existing devices.

This all but terminates libinput but does keep the context valid to be resumed with resume.

val resume : _ t -> unit

Resume a suspended libinput context.

This re-enables device monitoring and adds existing devices.

val destroy : _ t -> unit

destroy t releases the context and all associated resources.

Attempting to use devices, events, etc after this will fail.

module Log : sig ... end

Configure log levels.