← Back to Pull requests

wayland: add ui-events-wayland adapter crate #118

Closed
unknown closed this pull request without merging on Jun 19, 2026 13:39 UTC
View on GitHub
unknown unknown commented on Jun 18, 2026 10:19 UTC
Author

Add ui-events-wayland, an adapter crate that bridges Wayland input into the ui-events model, mirroring the existing winit, web, and Apple adapters.

The crate is split in two. mapping holds platform-neutral, value-based conversions from Wayland input primitives — evdev button and key codes, surface-local coordinates, scroll axes, and modifier and capability bits — into ui-events building blocks; it performs no foreign-function calls, references no wayland-client types, and is unit-tested on every target. The stateful reducers that consume wayland-client and wayland-protocols event streams build on those helpers and are gated to cfg(target_os = "linux"), so on every other target the crate compiles to an essentially empty library that pulls in no platform dependencies. It is no_std and uses alloc; only the xkb feature pulls in std. It contains no unsafe and is publish = false for now.

The reducers cover a seat's input devices: wl_pointer (motion, buttons, and frame-batched scroll), wl_touch (multi-touch with per-contact geometry and orientation), zwp_pointer_gestures_v1 touchpad pinch and rotate, zwp_tablet_tool_v2 stylus input, and wl_keyboard. A SeatReducer aggregates the pointer, keyboard, and touch reducers behind a single wl_seat, tracking its advertised capabilities. Following the recent winit change, every reducer is host-clocked — the caller supplies a monotonic nanosecond timestamp and the surface scale factor — so Wayland input shares one clock and coordinate domain with frame sampling and the rest of the host.

The keyboard reducer resolves the physical W3C key code of every key with no system dependencies. An optional, non-default xkb feature additionally links libxkbcommon and uses the compositor's keymap to resolve logical key values, typed text, the key location, and the authoritative modifier set, including the lock states and the Alt Graph modifier. The keymap is compiled through xkbcommon's safe API, so the crate stays free of unsafe. Because xkbcommon links a system library and declares no MSRV, the feature is isolated: it is target-gated to Linux and inert elsewhere, and only the commit that adds it touches CI — installing libxkbcommon on the Linux test job and excluding the feature from the Miri and MSRV jobs.

The work is split into self-contained commits — the crate skeleton and neutral mapping, then one reducer per protocol, the xkb feature, and finally the seat aggregator — each of which builds and tests green on its own.

Diff: 318 lines (+238 / -80) across 3 files Reviewer: waywardmonkeys Review duration: 1640m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 318 lines diff across 3 files
0.40
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.345
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #118"
general weight: 0.35
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 40.4% (MEDIUM) · Higher = larger blast radius
40.4%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 16.0% · Safe to merge
16.0%