host-display

Implements the winit window, wgpu renderer, and input capture for the display crate.

Updated Aug 18, 2026
One-click install
npx skills add https://github.com/doctorspider42/entangled-destop --skill host-display-doctorspider42
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: host-display
Source: https://github.com/doctorspider42/entangled-destop/tree/main/.agents/skills/host-display
Command: npx skills add https://github.com/doctorspider42/entangled-destop --skill host-display-doctorspider42

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working on the host presentation stack of the Entangled VMM requires deep knowledge of how the winit event loop, wgpu scanout rendering, window UX policy, and virtio-input capture interact, and this Skill loads that context before touching the window, renderer, or input code. ## Core Features & Use Cases - Rendering architecture guidance: Documents the scanout texture pipeline, letterbox viewport math, surface-loss recovery, and dirty-rect write_texture updates in crates/display. - Input capture rules: Explains the grab model, reserved Ctrl+Alt shortcuts, the dual held/guest_held key sets, and why Back/Forward map to keyboard codes rather than mouse buttons. - Platform pitfalls: Covers Wayland/WSLg decoration, cursor, and confinement quirks, X11 panic hazards, EDID refresh-rate ceilings, and frame-pacing measurement via virtio_gpu::pacing. - Use Case: Before adding a new window behavior or fixing a cursor bug, load this Skill so changes land in the pure display::ux policy layer with unit tests instead of the event loop. ## Quick Start Load the host-display skill before modifying the window, renderer, or input capture code in crates/display.

Frequently Asked Questions about host-display

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add new window behavior to the display crate?

Add new window behavior to the pure `display::ux` policy module, not the event loop. Functions like `viewport_for`, `cursor_visible`, and `window_title` are unit-tested policy; `host.rs` only asks the policy and tells winit.

How does input grab work in a winit VM window?

Nothing reaches the guest unless the grab is active, started by clicking the guest image and released with Ctrl+Alt. The `InputCapture` tracks two key sets: `held` for physical state and `guest_held` for what the guest was told, preventing stuck modifiers.

Why are Back and Forward sent as keyboard keys instead of mouse buttons?

Back and Forward map to `KEY_BACK`/`KEY_FORWARD` because joydev only leaves an absolute pointer alone if its key set is exactly the three primary mouse buttons. Adding buttons would make the pointer bind as a tablet and steal `/dev/input/js0` from the gamepad.

Does the wgpu renderer handle window resize and surface loss?

Yes, the renderer reconfigures the surface on `SurfaceError::Lost/Outdated` and recomputes the letterbox viewport on resize. `Renderer::resize` is idempotent and `draw()` re-asserts the current window size to avoid stretched frames during rapid resize drags.

Why does the guest frame rate cap at the EDID refresh rate?

The guest compositor phase-locks to the EDID refresh rate set by `[display] refresh_hz` (24-240, default 60) and sleeps out the remainder of each frame. Raising it only helps if the guest has slack; check the `quiet` counter in frame stats first.

What are the limitations of pointer confinement on WSLg?

WSLg advertises `zwp_pointer_constraints_v1` and accepts `confine_pointer` but never sends the `confined` event, so the pointer is never actually confined. The grab must treat confinement as best-effort and cannot rely on it.