WEFT_OS/docs/architecture/winit-wayland-audit.md
Marco Allegretti fc5ada2079 feat(servo-shell): add servo-shell skeleton, system UI, service unit, and Wayland input audit
Includes winit Wayland input audit for servo-shell integration planning.

New files:
- crates/weft-servo-shell/: new workspace member
 - Cargo.toml: anyhow + tracing deps; no servo dep yet (requires git
 dependency on github.com/servo/servo with multi-minute build; deferred
 until embedder contract is confirmed)
 - src/main.rs: reads WAYLAND_DISPLAY and WEFT_SYSTEM_UI_HTML, locates
 system-ui.html from packaged path, calls embed_servo() stub that
 returns a descriptive error explaining the integration work remaining
- infra/shell/system-ui.html: system UI document per blueprint Section 5
 DOM structure (weft-desktop, weft-wallpaper, weft-taskbar, weft-launcher,
 weft-notification-center, weft-window); includes clock and launcher toggle
- infra/systemd/servo-shell.service: Requires+After weft-compositor.service,
 Type=simple, Restart=on-failure
- docs/architecture/winit-wayland-audit.md: audit of winit 0.30.x Wayland
 backend against WEFT input requirements; identifies keyboard shortcut
 inhibit gap, touch gesture gap, IME incomplete (zwp_text_input_v3),
 frame pacing absent (wp_presentation_time), DMA-BUF unverified;
 none block initial integration; all tracked as pre-GA work items

Modified:
- Cargo.toml: add weft-servo-shell to workspace members
- scripts/wsl-check.sh: switch to --workspace for all three gates
2026-03-11 00:34:26 +01:00

125 lines
4.6 KiB
Markdown

# winit Wayland Input Audit
Audit of winit's Wayland backend against WEFT OS system shell input requirements.
Required by Wave 4 gate: Servo Wayland input audit result assessed.
Source: blueprint Section 11, GAP 1. Servo version audited: main branch (2025).
winit version audited: 0.30.x (smithay-client-toolkit backend).
---
## Audit Scope
WEFT requires correct and reliable keyboard, mouse, touch, and IME input for
the system shell. Input regressions are system-level failures because there is
no fallback input path.
Servo delegates all windowing and input to winit. winit's Wayland backend uses
smithay-client-toolkit (sctk) as the protocol implementation layer.
---
## Findings
### Keyboard input
**Status: FUNCTIONAL with known limitation**
Basic key events, modifiers, and repeat work correctly via xkb.
The `xdg_keyboard_shortcuts_inhibit` protocol is not implemented in winit's
Wayland backend, so system keyboard shortcuts (e.g. Alt+F4) cannot be
inhibited by client surfaces. This affects the system shell if it needs to
handle those key combinations before the compositor does.
Relevant winit issue: https://github.com/rust-windowing/winit/issues/2787 (open).
### Pointer input
**Status: FUNCTIONAL**
Button, scroll, and motion events work correctly. `zwp_relative_pointer_v1`
(relative motion for pointer locking) is implemented. `zwp_pointer_constraints_v1`
(locked/confined pointer) is implemented in winit 0.30+.
Frame-accurate pointer position via `wl_pointer.frame` is handled.
### Touch input
**Status: PARTIAL**
Single-touch is functional. Multi-touch slots are tracked via `wl_touch` protocol.
Gesture recognition is not implemented in winit — gestures from the compositor
(`zwp_pointer_gestures_v1`) are not consumed. This affects swipe/pinch gesture
handling in the system shell.
Relevant winit issue: not filed as of audit date.
### IME (Input Method Editor)
**Status: INCOMPLETE**
`zwp_text_input_v3` is implemented in sctk 0.18+ but winit's integration is
incomplete. Specifically:
- Pre-edit text display is not forwarded to the application's IME event stream
in all cases.
- `done` events with surrounding text are not always handled correctly.
This means CJK and other IME-dependent input in the system shell HTML will not
work correctly.
Relevant sctk issue: https://github.com/Smithay/client-toolkit/issues/605 (open).
### Frame pacing (vsync alignment)
**Status: NOT IMPLEMENTED**
winit does not implement `wp_presentation_time` (the Wayland presentation
feedback protocol). Frame timing is based on `wl_callback` only. This means
Servo cannot align rendering to compositor vsync, causing frame pacing issues
on variable-refresh-rate displays and tearing on fixed-refresh displays.
This must be fixed before the system shell is suitable for production use.
Relevant Servo issue: not filed as of audit date.
### DMA-BUF surface sharing
**Status: UNVERIFIED**
The Servo → WebRender → wgpu → wl_surface pipeline on Wayland may or may not
use `zwp_linux_dmabuf_v1` for zero-copy buffer sharing. This audit did not
test it under the WEFT compositor (requires QEMU or real hardware).
Must be verified when DRM backend testing is available.
---
## Assessment
| Input area | Status | Blocks Wave 4 skeleton? |
|---------------------|-------------|-------------------------|
| Keyboard (basic) | Functional | No |
| Keyboard shortcuts | Gap | No (deferred) |
| Pointer | Functional | No |
| Touch (single) | Functional | No |
| Touch (gestures) | Gap | No (deferred) |
| IME | Incomplete | No (system shell uses minimal JS) |
| Frame pacing | Not impl. | No (deferred, required before GA) |
| DMA-BUF | Unverified | No (requires hardware test) |
None of the identified gaps block the Wave 4 skeleton or initial integration.
They block production readiness, as documented in the blueprint.
**Gate decision**: Wave 4 may proceed. The gaps above are tracked as known
work items, not blocking conditions for skeleton implementation.
---
## Required Follow-up
Before WEFT OS reaches GA:
1. Contribute `wp_presentation_time` support to winit (or contribute to Servo
to work around it via the compositor's presentation feedback).
2. Contribute `zwp_text_input_v3` fix to sctk and winit for correct IME.
3. File and track a winit issue for `zwp_pointer_gestures_v1`.
4. Verify DMA-BUF path under the WEFT DRM compositor (requires hardware).
5. File issues for all confirmed gaps in the Servo and winit issue trackers
per the blueprint contribution workflow.