ltk/input/mod.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
// SPDX-License-Identifier: LGPL-2.1-only
// Copyright (C) 2026 Liberux Labs, S. L. <info@liberux.net>
//! Input-event layer.
//!
//! Three Wayland input sources — `wl_keyboard`, `wl_pointer`,
//! `wl_touch` — land in their respective submodules and translate
//! into ltk-level actions. Keyboard is standalone (it drives focus
//! and text insertion, no gesture lifecycle); pointer and touch share
//! the [`gesture::GestureState`] state machine so press → move →
//! release logic (long-press, slider drag, scroll, swipe commit, tap,
//! drop) is written once and fed by both sources.
//!
//! The [`dispatch`] submodule turns gesture outcomes into concrete
//! side-effects on [`AppData`](crate::event_loop::AppData): pending
//! messages, app callbacks, surface redraws, cache invalidation. It
//! is `pub( super )`-scoped so pointer.rs and touch.rs can call it
//! without exposing the helpers at the crate root.
//!
//! With [`GestureState`] owning the press / move / release lifecycle
//! and [`dispatch`] owning the side-effects, the Wayland-facing
//! handlers stay small and a hypothetical new input source (stylus,
//! gamepad) can plug in by feeding the state machine the same way.
pub( crate ) mod gesture;
pub( crate ) mod keyboard;
pub( crate ) mod pointer;
pub( crate ) mod touch;
pub( crate ) mod dispatch;
pub( crate ) mod repeat;
// `GestureState` is the only type consumers outside `input/` need —
// `AppData` stores one per `SurfaceState` and the long-press deadline
// poller reaches through it. The rest (`MoveOutcome`, `PressOutcome`,
// `ReleaseEvent`, `SwipeConfig`) stay at `super::gesture::*` because
// only the sibling modules in `input/` touch them.
pub use gesture::GestureState;