Skip to main content

Crate drmkit_input

Crate drmkit_input 

Source
Expand description

Keyboard, pointer and touch input.

Two halves that are useful apart. Keyboard compiles an xkb keymap and turns evdev keycodes into keysyms and text; the libinput side reads the devices those codes come from. A caller with its own event source – a remote protocol, a test harness, a replay – wants the first without the second, so they are separate and each is behind its own feature.

§Features

xkb (default) brings in Keyboard; libinput (default) brings in Seat. Without either, the event types, Repeat and KeyRepeater still build and test – which is what a cross target with neither library in its sysroot can do.

§Not here

SeatOptions::log_handler, the reference’s per-seat sink for libinput’s diagnostics. libinput carries one user_data slot per context and the input crate has already spent it on the device opener, so a per-context sink would need a registry keyed on the context pointer – for a hook whose stated purpose is separating libinput’s stream from the library’s own, which drmkit_log::set_log_sink can already do process-wide. SeatOptions::log_priority still gates how much libinput says.

The Pointer accumulator and EventDispatcher. The first turns relative motion into a position, which needs a screen extent to clamp against and belongs where that is known; the second is a list of callbacks, which is what a caller writes around a Vec of events anyway.

Structs§

KeyEvent
A key going down or coming up.
KeyRepeater
Auto-repeat driven by a timer the caller polls.
Keyboardxkb
A keymap and the state of the keys pressed against it.
KeymapNamesxkb
The names a keymap is compiled from: rules, model, layout, variant, options.
Leds
The lock state, as the keyboard’s lights would show it.
Modifiersxkb
Which modifiers are in effect.
PointerAbsolute
A pointer reporting where it is rather than how far it moved.
PointerAxis
A scroll.
PointerButton
A pointer button going down or coming up.
PointerMotion
A pointer moving.
Repeat
Which key is repeating, and what each event does to that.
RepeatConfig
When a held key starts repeating, and how fast.
Seatlibinput
Every input device on one seat.
SeatOptionslibinput
What to open.
SwitchEvent
A switch changing.
TouchEvent
A touch point.

Enums§

InputError
What can go wrong reading input.
InputEvent
Anything an input device produces.
LogPrioritylibinput
How much libinput should say before this is called at all.
PointerEvent
Anything a pointer does.
ScrollSource
Where a scroll came from.
Switch
Which physical switch changed.
Timer
What the timer should do about a key event.
TouchPhase
What a touch point is doing.

Traits§

LibinputInterfacelibinput
libinput does not open file descriptors to devices directly, instead open_restricted and close_restricted are called for each path that must be opened.