forked from unom/punktfunk
The goal this serves: a session that never engages desktop mode should get the LOSSLESS cursor — composited by Windows itself, for free, with true XOR — and the host should only pay for compositing when the user actually asks for the desktop mouse model. That is already what happens on a clean adapter. The problem is that adapters do not stay clean. A hardware-cursor declare is irrevocable and ADAPTER-WIDE (pf-driver-proto v6): once any desktop-mode session declares, DWM stops compositing the pointer into every later frame on that adapter, so every capture-latched session afterwards has to self-composite — a full-frame copy per visible-pointer frame, and our straight-alpha approximation of an XOR cursor instead of the real thing — for the rest of the adapter's life. "Until the next reboot" turned out to be far longer than it sounds. With Fast Startup on (the Windows default) a shutdown plus power-on is a HIBERBOOT: it restores session 0 and its drivers, so the declare survives what the operator calls a reboot. Measured on .173 — Kernel-Boot event id 27 reporting `0x1` where a cold boot reports `0x0`, with lsass/services/wininit keeping their pre-"reboot" start times, while `LastBootUpTime` reports the older cold boot and makes uptime checks lie. On such a box the lossless path can be gone for weeks. So clear it explicitly at host start, where no session holds a display yet. `pnputil /restart-device` recycles the WUDFHost process the driver's `DECLARED_TARGETS` lives in, which is all it takes. Measured at **0.07 s** against ~6 s of sleeps for the existing Disable+Enable cycle, and unlike that cycle it is designed for a device in use, so it does not hit the refusal `reload_vdisplay_adapter` documents as "the expected case here". In the same call it also repaired an adapter found in CM_PROB_FAILED_POST_START (Code 43). Best-effort throughout: a failure just leaves the adapter as it was and sessions self-composite exactly as before. `PUNKTFUNK_CURSOR_CLEAN_START=0` opts out. Verified: `scripts/xcheck.sh windows` green; `cargo fmt --all` clean; full `cargo build -p punktfunk-host --release --features nvenc` on .173 (xcheck cannot reach punktfunk-host — it needs ffmpeg).