Skip to content

[ZoomIt] Add DemoMirror feature - #49607

Merged
chakrik73 merged 1 commit into
microsoft:mainfrom
chakrik73:ckotamraju/zoomit-demomirror
Aug 1, 2026
Merged

chakrik73 merged 1 commit into
microsoft:mainfrom
chakrik73:ckotamraju/zoomit-demomirror

Conversation

@chakrik73

@chakrik73 chakrik73 commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Mirror the screen, a selected region (Shift), or the window under the cursor (Alt) onto a second monitor - including the mouse pointer - so a demo can be shown on a presentation display without leaving the current view. Adds the native MirrorWindow implementation, a DemoMirror options tab (Ctrl+9 default, plus Track window region), and the corresponding Settings UI (ZoomIt page group, view model, properties, and resources).

Summary of the Pull Request

Adds a DemoMirror feature to ZoomIt. It mirrors the screen, a selected region (Shift), or the window under the cursor (Alt) onto a second monitor — including the mouse pointer — so a demo can be shown on a presentation display without leaving the current view.

This introduces the native MirrorWindow implementation, a new DemoMirror options tab (default hotkey Ctrl+9, plus a Track window region option), and the corresponding Settings UI wiring (ZoomIt page group, view model, properties, and localized resources).

PR Checklist

  • Communication: I've discussed this with core contributors already.
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on [our docs repo]

Detailed Description of the Pull Request / Additional comments

DemoMirror lets a presenter keep working on their primary display while a second monitor shows a live mirror of a chosen source. Three capture modes are supported via the DemoMirror hotkey (default Ctrl+9):

  • Full screen — Ctrl+9: mirrors the entire source screen.
  • Region — Ctrl+Shift+9: mirrors a user-selected rectangular region.
  • Window — Ctrl+Alt+9: mirrors the window currently under the cursor. With the Track window region option enabled, the mirror follows the window as it moves/resizes.

The mirror includes the mouse pointer so pointer movement and clicks are visible on the presentation display.

Native (C++ / PowerToys.ZoomIt.exe)

  • New MirrorWindow.cpp / MirrorWindow.h implementing the mirror capture/render window. Mirror windows use WS_EX_NOACTIVATE | WS_EX_TRANSPARENT so they never steal focus from the source.
  • Zoomit.cpp: registers the DemoMirror hotkeys and wires the start/stop handlers; the stop path checks g_MirrorWindow.IsActive() and stops unconditionally (cursor-independent).
  • ZoomItSettings.h: new MirrorToggleKey (default Ctrl+9) and MirrorTrackWindow settings, added to the RegSettings[] table. Record default kept distinct at Ctrl+5.
  • resource.h / ZoomIt.rc: new DemoMirror options tab and controls (IDC_MIRROR_HOTKEY, IDC_MIRROR_TRACK_WINDOW).
  • CaptureFrameWait.* and SelectRectangle.* updated to support the mirror capture/selection flow.
  • ZoomItSettingsInterop/ZoomItSettings.cpp: exposes the new settings across the interop bridge.

Settings UI (WinUI 3)

  • New DemoMirror group on the ZoomIt page (ZoomItPage.xaml), backed by ZoomItViewModel.cs and ZoomItProperties.cs.
  • Localizable strings added to Resources.resw.

Conflict resolution notes (rebased on top of upstream main):

  • Control-ID collision resolved by assigning distinct IDs (IDC_MIRROR_HOTKEY, IDC_MIRROR_TRACK_WINDOW).
  • SelectRectangle border-color: kept upstream m_borderColor = borderColor;.
  • WM_USER message-ID collision resolved by using WM_USER_MIRROR_STOP = WM_USER + 113.

Validation Steps Performed

Manually validated on a real dual-display setup (Surface laptop extended to an external monitor):

  • Full screen (Ctrl+9): source screen mirrored to the second monitor, including the mouse pointer.
  • Region (Ctrl+Shift+9): selected region mirrored correctly.
  • Window (Ctrl+Alt+9): window under the cursor mirrored; with Track window region enabled, the mirror follows the window.
  • Stop/cancel: DemoMirror stops reliably regardless of cursor position; mirror windows never take focus (WS_EX_NOACTIVATE | WS_EX_TRANSPARENT).
  • Hotkey defaults: confirmed Record (Ctrl+5) and DemoMirror (Ctrl+9) defaults are distinct and read independently from their own registry/settings values (no cross-contamination).
  • Settings UI: DemoMirror hotkey and Track window region options round-trip correctly through the Settings UI and the interop bridge.
Mirror the screen, a selected region (Shift), or the window under the cursor (Alt) onto a second monitor - including the mouse pointer - so a demo can be shown on a presentation display without leaving the current view. Adds the native MirrorWindow implementation, a DemoMirror options tab (Ctrl+9 default, plus Track window region), and the corresponding Settings UI (ZoomIt page group, view model, properties, and resources).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new DemoMirror capability to the ZoomIt module, enabling mirroring of a full screen, selected region, or window-under-cursor onto a second monitor (including cursor), and wires the required settings through the WinUI Settings UI and the native ZoomIt settings/interop pipeline.

Changes:

  • Implemented native mirror rendering/capture via new MirrorWindow (Windows.Graphics.Capture + D3D11 swapchain) and integrated start/stop + hotkey registration into Zoomit.cpp.
  • Extended ZoomIt settings (native registry-backed + interop JSON + Settings UI view model/properties) with MirrorToggleKey and MirrorTrackWindow.
  • Added Settings UI XAML + localized strings for the new DemoMirror settings group, and updated native options dialog resources.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/settings-ui/Settings.UI/ViewModels/ZoomItViewModel.cs Adds DemoMirror hotkey + derived Shift/Alt variants and Track Window setting bindings.
src/settings-ui/Settings.UI/Strings/en-us/Resources.resw Adds localized strings for the new DemoMirror settings group.
src/settings-ui/Settings.UI/SettingsXAML/Views/ZoomItPage.xaml Adds a DemoMirror settings group UI (hotkey + track window checkbox + shortcut descriptions).
src/settings-ui/Settings.UI.Library/ZoomItProperties.cs Adds default mirror hotkey and new properties (MirrorToggleKey, MirrorTrackWindow).
src/modules/ZoomIt/ZoomItSettingsInterop/ZoomItSettings.cpp Adds special-semantics handling for MirrorToggleKey serialization/deserialization.
src/modules/ZoomIt/ZoomIt/ZoomItSettings.h Adds new registry-backed settings entries for mirror hotkey and track-window behavior.
src/modules/ZoomIt/ZoomIt/ZoomIt.vcxproj.filters Registers new MirrorWindow source/header in VS filters.
src/modules/ZoomIt/ZoomIt/ZoomIt.vcxproj Includes new MirrorWindow compilation units in the project.
src/modules/ZoomIt/ZoomIt/ZoomIt.rc Adds a native DemoMirror options dialog resource and layout entries.
src/modules/ZoomIt/ZoomIt/Zoomit.cpp Integrates DemoMirror hotkeys, options UI plumbing, and mirror start/stop control flow.
src/modules/ZoomIt/ZoomIt/SelectRectangle.h Adds a border-color setter and new member state for selection border behavior.
src/modules/ZoomIt/ZoomIt/SelectRectangle.cpp Adjusts selection border reset behavior on Start for mirror/panorama flows.
src/modules/ZoomIt/ZoomIt/resource.h Adds new control IDs for the DemoMirror options UI.
src/modules/ZoomIt/ZoomIt/MirrorWindow.h Declares the MirrorWindow capture/render window and related constants/messages.
src/modules/ZoomIt/ZoomIt/MirrorWindow.cpp Implements capture, cursor inclusion, window/monitor switching during annotations, and rendering/presentation loop.
src/modules/ZoomIt/ZoomIt/CaptureFrameWait.h Extends CaptureFrameWait to support suppressing system capture borders and recreating the frame pool.
src/modules/ZoomIt/ZoomIt/CaptureFrameWait.cpp Implements the new CaptureFrameWait constructor behavior (border suppression).
Suppressed comments (1)

src/modules/ZoomIt/ZoomIt/SelectRectangle.h:53

  • m_configuredBorderColor is currently unused (no reads), which adds dead state and can confuse future changes. Removing it keeps the class state minimal.
    COLORREF m_borderColor = RGB( 255, 222, 0 ); // default: yellow (matches capture API)
    COLORREF m_configuredBorderColor = RGB( 255, 222, 0 ); // color Start resets to
@chakrik73
chakrik73 merged commit d2c53bf into microsoft:main Aug 1, 2026
8 checks passed
@LegendaryBlair Boliang Zhang (LegendaryBlair) added the Product-ZoomIt Refers to the ZoomIt tool label Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Product-ZoomIt Refers to the ZoomIt tool

4 participants