ltk: opt-in raw touch stream for apps that consume input themselves
CI / build + test (push) Has been cancelled
CI / cargo audit (push) Has been cancelled

Add App::claims_raw_touch(), an opt-in hook that routes the primary finger through the raw on_touch_down/move/up callbacks instead of the built-in single-slot gesture machine. Until now the primary finger was consumed entirely by the widget gesture machine (taps, swipes, presses) and never reached the app, which made it impossible to drive a self-contained input consumer like an embedded WebView or a game canvas from a touchscreen: the widget tree saw the taps, the embedded content never did. With the hook active every finger surfaces verbatim through the raw stream, widget gestures never arm, and per-finger positions are cached in SurfaceState::touch_slots for all slots so wl_touch.up (which carries no coordinates) can still report a release point.
The touch module doc and the on_touch_down docs are updated to describe the new contract; the default remains unchanged for every existing app.
Pin the transitive dependency ignore to 0.4.23: rust-i18n pulls it via globwalk, 0.4.24+ requires a rustc newer than Debian's 1.85, and its manifest does not declare that MSRV, so a fresh resolution breaks the build on stable.
This commit is contained in:
2026-07-21 09:56:05 +02:00
parent 8762ab9ce0
commit 3d7f3c53de
3 changed files with 55 additions and 1 deletions
+12
View File
@@ -602,6 +602,10 @@ pub trait App: 'static
/// built-in single-slot machine cannot model. `(x, y)` are in
/// physical pixels, matching the coordinate space of
/// [`Self::on_pointer_move`].
///
/// When [`Self::claims_raw_touch`] returns `true` the primary
/// finger arrives here as well, instead of driving the gesture
/// machine.
fn on_touch_down( &mut self, _id: i64, _x: f32, _y: f32 ) {}
/// See [`Self::on_touch_down`].
fn on_touch_move( &mut self, _id: i64, _x: f32, _y: f32 ) {}
@@ -609,6 +613,14 @@ pub trait App: 'static
/// position of the finger (`wl_touch.up` does not carry one).
fn on_touch_up( &mut self, _id: i64, _x: f32, _y: f32 ) {}
/// Return `true` to receive the *primary* finger through the raw
/// [`Self::on_touch_down`] / move / up stream as well, bypassing
/// the built-in single-slot gesture machine entirely — widget
/// presses, taps and swipes stop working on touch. For apps whose
/// surface is one self-contained input consumer (an embedded
/// WebView, a game canvas) that needs every finger verbatim.
fn claims_raw_touch( &self ) -> bool { false }
/// Pointer of a cross-application drag-and-drop entered or moved
/// inside the main surface. `(x, y)` is in logical pixels.
fn on_drop_motion( &mut self, _x: f32, _y: f32 ) {}