Skip to content

Windows: window-scoped recording captures whole screen instead of the selected window #423

@yusefren

Description

@yusefren

What happens

On Windows, selecting a window as the recording source records the entire screen, including other apps and the desktop. The window selection is ignored.

Expected

Only the selected window's content should be recorded, matching the macOS behavior.

Reproduction

  1. Launch Recordly on Windows 11.
  2. In the source picker, choose a specific window (e.g. Windows Terminal, Notepad, Everything).
  3. Start a recording, move the mouse around the desktop and over other apps.
  4. Stop and review the file.

Actual: the whole monitor is in the file, including other windows and the wallpaper.
Expected: just the selected window.

Cause

The renderer correctly emits a window:HWND source id, but in electron/ipc/register/recording.ts the Windows native-capture path always falls through to resolveWindowsCaptureDisplay(...) and forwards only displayId / displayX/Y/W/H to the WGC helper. The macOS path in the same file already extracts the window id via parseWindowId(source.id) and forwards a windowId config field. The Windows branch is missing the equivalent.

The wgc-capture helper already supports per-window capture (WgcSession::initialize(HWND, fps) is wired up and reads a windowHandle config field). It is just never being given one.

Side effects discovered while fixing

Plumbing windowHandle through exposes two further bugs in wgc_session.cpp that have been dormant because window capture was effectively dead code:

  1. The frame pool is allocated at captureItem.Size(), which can be odd (DWM shadow margin, fractional DPI). The encoder rounds dimensions down to even for H.264 alignment, so CopyResource then silently fails against the staging texture and the recording comes out fully black for windows with odd sizes.
  2. Owned popups, dialogs, and tooltips do not appear in window captures because IncludeSecondaryWindows is never enabled on IGraphicsCaptureSession6.

Environment

  • OS: Windows 11
  • Recordly: latest installed build
  • Reproduces against multiple apps (Windows Terminal, Everything)

Known WGC limitation (not addressed)

Even with IncludeSecondaryWindows, classic Win32 menu popups (#32768 window class, used for File / Edit / View dropdowns and right-click menus) do not appear in window-item-level WGC captures. A display-with-crop-to-window-rect mode would be a follow-up if those need to be captured too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions