Repository navigation
windows: a composition spike for the overlay's four questions - #241
Merged
Merged
Conversation
`spikes/windows-composition/`: a Windows program on fizzy's own pins of fizzyedit/SDL and zigwin32 that answers step 5 of docs/WINDOWS_LINUX_GLASS_PLAN.md, the spikes NATIVE_WINDOWS_PLAN.md's Phase 2 waits on. A transparent SDL window presents on D3D12 through the fork's topmost DirectComposition target, as fizzy's windows do. Under it, a Windows.UI.Composition target that isn't topmost holds the host backdrop, cut to a moving pill (∪ an orbiting circle) by a rounded-rect clip, a Direct2D path rebuilt each frame, or an AlphaMask effect over a swapchain the app presents. A display-sized overlay tests click-through styles. WinRT is bound by hand. Every GUID and vtable slot was read from the OS's own WinMetadata with System.Reflection.Metadata, and `IGeometrySource2D` and `IGraphicsEffect` are implemented as COM objects in Zig. Run in the Windows 11 ARM VM (WARP, 60 Hz) with real input, offsets measured from screenshots: 1. The two targets share the HWND, aligned to the pixel. 2. The path clip is antialiased. It leads SDL's VSYNC present by the present queue (2 frames, 35 ms at 60 Hz), and lands exactly (±0.5 px) with a 2-frame clip delay or with a present that doesn't wait. Frames in flight make no difference. 3. AlphaMask takes a presented swapchain as its mask. 4. Only `WS_EX_TRANSPARENT | WS_EX_LAYERED` passes clicks to other processes while the tree still shows. `HTTRANSPARENT` passes only within the thread, though `WindowFromPoint` says otherwise. A drag under the overlay keeps its capture, and `SDL_SetWindowOpacity` (layered) leaves both trees drawing. The VM draws the host backdrop black, so the blur and real-refresh timings need a hardware GPU. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
foxnne
force-pushed
the
windows/composition-spike
branch
from
October 8, 2026 18:01
6be5d0f to
ed8b892
Compare
foxnne
marked this pull request as ready for review
October 8, 2026 18:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #226 (
docs/NATIVE_WINDOWS_PLAN.md, Phase 2); step 5 ofdocs/WINDOWS_LINUX_GLASS_PLAN.md(#236).What changes
Adds
spikes/windows-composition/, a standalone Windows program answering the four questions the plan's Phase 2 (the drag's glass as an overlay over the desktop's blur) waits on. Nothing in fizzy changes. The research doc's step 5 records the answers.How it works:
src/winrt.zig.IGeometrySource2DandIGraphicsEffectare COM objects written in Zig.At about 1,700 lines this is over CONTRIBUTING's 800-line guide. It's throwaway code in
spikes/, built by nothing else.SDK impact
Verified
Windows 11 ARM VM (
fizzy-win11, build 26300, D3D12 on WARP, 60 Hz), aarch64-windows-gnu, driven bySendInput. Offsets were measured from screenshots: the clip's glass against the red box SDL presents round the pill, six samples per run, with a direction mark telling lead from lag.Two targets on one HWND: yes.
CreateDesktopWindowTarget(hwnd, FALSE)on SDL's claimed window succeeds and draws under SDL's picture. Static, the two align to the pixel.Path clip rebuilt every frame: works and is antialiased (1–2 px). Composition calls
GetGeometryonce per frame. With SDL's VSYNC present the clip leads the picture by the present queue:So fizzy either gives composition the shape from as many frames back as the present queue is deep (measured, not assumed), or has the fork present through a frame-latency waitable swapchain.
Effect-graph mask: yes. D2D's AlphaMask with a
CompositionEffectSourceParameteroverCreateCompositionSurfaceForSwapChainshows the glass exactly where the presented mask is.Overlay:
TRANSPARENT | LAYEREDTRANSPARENT | LAYERED, alpha 255TRANSPARENTaloneHTTRANSPARENTWindowFromPointsays it passes)A drag under the layered overlay keeps its capture (30/30 motion events).
SDL_SetWindowOpacity(0.6)(layered) leaves both SDL's picture and the composition tree drawing.3(path) with the backdrop on, and check the blur and the edge, at clip delay 0 and 2 (D).Follow-ups
🤖 Generated with Claude Code