Files
PowerToys/doc
Niels Laute 05ba63beba [Screen Ruler] Add DIP as an extra measurement unit (#49588)
## Summary of the Pull Request

Adds display-independent pixels (DIP) to Screen Ruler's existing **Extra
units of measurement** setting. Physical pixels remain the primary
overlay value; selecting DIP adds a second, parenthesized measurement
that adjusts for Windows display scaling.

DIP values use the DPI of the monitor containing the measurement. This
also corrects the millimeter fallback conversion when physical monitor
dimensions are unavailable.


<img width="1079" height="81" alt="image"
src="https://github.com/user-attachments/assets/a34fe0a8-1dc1-4f1d-97c6-1a0dc37bf2e3"
/>

Before vs after:

<img width="921" height="617" alt="image"
src="https://github.com/user-attachments/assets/7b0ed0ce-7058-4f4f-b8ae-1fc3709e0ace"
/>


## PR Checklist

- [x] Closes #20304
- [x] Closes #46945
- [x] **Communication:** The scope was agreed before implementation
- [x] **Tests:** Added/updated and all focused tests pass
- [x] **Localization:** All end-user-facing strings can be localized
- [x] **Dev docs:** Added/updated
- [x] **New binaries:** Not applicable; no production binaries were
added
- [ ] **Documentation updated:** A public documentation PR has not been
filed

## Detailed Description of the Pull Request / Additional comments

- Preserves the existing persisted values for pixels, inches,
centimeters, and millimeters; DIP is appended as value `4`.
- Preserves the existing overlay behavior: pixels are always displayed,
with one optional extra unit on a second line.
- Preserves the existing clipboard behavior: pixel-only output has no
suffix, while a selected extra unit is copied by itself.
- Converts physical pixels to DIP using each overlay window's monitor
DPI.
- Corrects the 96-DPI millimeter fallback so 96 px equals 25.4 mm.
- Adds focused native conversion tests, settings compatibility tests,
and DIP clipboard UI coverage.
- Keeps guides, calibration, browser-relative units, and other
measurement modes out of scope.

## Validation Steps Performed

- Built `MeasureToolCore` for ARM64 Debug.
- Built `MeasureToolUI` for ARM64 Debug.
- Built PowerToys Settings for ARM64 Debug.
- Built and ran `MeasureToolCore.UnitTests`: 5 passed.
- Built and ran the Screen Ruler settings tests: 6 passed.
- Built `ScreenRuler.UITests`; local execution was not run because
WinAppDriver is not installed.
- Ran XAML Styler on the changed Settings page.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1a6361cf-d701-4a9b-b8e8-d5700c5ba140
2026-08-31 13:31:57 +02:00
..