Skip to content

[bug/windows]: specific-window screenshots fail for WebView2-hosted apps #2046

Description

@oshtz

Description

On Windows 11, taking a screenshot of a WebView2-hosted desktop app as a specific window does not create a screenshot or open the screenshot editor. Capturing the containing display succeeds and creates the expected screenshot project.

This appears specific to Cap's Windows window-target selection rather than display capture.

Expected behavior: WebView2-hosted apps can be selected and captured like other windows.

Actual behavior: the window capture produces no screenshot project, while display capture works.

Reproduction

  1. Open a WebView2-hosted desktop app on Windows.
  2. Open Cap's screenshot target picker and choose Window, or use the Screenshot current window hotkey with the cursor over that app.
  3. Select the app and attempt the screenshot.
  4. Observe that no window screenshot is saved or opened.
  5. Capture the full display and observe that it succeeds.

Investigation

Both picker and hotkey selection route through scap_targets::Window::get_topmost_at_cursor.

On Windows, that path starts from WindowFromPoint and rejects executable names containing webview2 or msedgewebview2. A WebView2 child or top-level HWND can therefore be rejected before a capture target is produced. The fix should preserve Cap's self-window exclusion while allowing unrelated WebView2-hosted apps.

The screenshot store contains the successful display capture but no corresponding window project. No Windows Cap log directory was present for additional error output.

Additional Context

  • Cap version: current main at d0491b1e59d6ffe4386524ba67047d039e46d58e
  • Operating system, version: Windows 11
  • Reproducible target: WebView2-hosted desktop application

Acceptance criteria

  • WebView2-hosted apps can be selected and captured through the picker.
  • The Screenshot current window hotkey works with the cursor over a WebView2-hosted app.
  • Cap's own windows and overlays remain excluded.
  • Ordinary Win32 window capture and full-display capture remain unchanged.

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