Skip to content

Windows transparent overlay: window-space UI HUDs clipped by the SetWindowRgn silhouette #350

Closed

Description

@dfattal

Problem (seen on hardware, 2026-10-02)

In a transparent-overlay app on Windows (lenovo-avatar), the window-space UI HUDs (DisplayXRWindowSpaceUI, composited by the runtime as XrCompositionLayerWindowSpaceDXR layers) are clipped by the avatar silhouette.

The transparent overlay calls SetWindowRgn with the silhouette (displayxr_set_overlay_hit_mask / _hit_rect / _surround_rect / _surround_mask in native~/displayxr_win32.c). SetWindowRgn is a visual clip, not only a hit mask: every pixel outside the region does not exist for the window, post-weave composition layers included. So any part of a HUD outside the silhouette is cut away.

Reference designs

  • The DisplayXR model viewer hits the same problem with its toasts and unions its "chrome" rects (toast band, button bars, bubbles) into the region. See displayxr-common common/vk_clickthrough_region.h ("THE REGION IS A VISUAL CLIP, NOT ONLY A HIT MASK").
  • feat(#332): Linux click-through and right-drag move for the transparent overlay #346 (Linux click-through) unions every live window-space UI slot into the input region natively (lin_rects_add_wsui), with no app call.

Fix direction

Native knows every wsui slot's fractional rect and disparity (displayxr_window_space_ui.cpp), so displayxr_win32.c should union each live slot's client-pixel rect (widened by half the disparity on each side) into the region in every path that builds it (hit mask, AABB hit rect, surround union). Hidden or disabled HUDs (slot released, or no texture) must stay out. The HUD rects must feed the region hash, so toggling a HUD updates the region while a static HUD causes no per-frame SetWindowRgn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions