microsoft / microsoft/terminal
OpenConsole not DpiAware, causes GetSystemMetrics to indicate poor icon sizes
- Dominant language
- C++
- Stars
- 105k
- Forks
- 9.6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
Description
### Windows Terminal version
1.21.3231.0
### Windows build number
10.0.22631
### Other Software
(I was using Yori but I don't think you need to)
### Steps to reproduce
1. Set the display DPI to 125%
2. Have a program that supports 20x20 and 40x40 icon sizes
3. Run the program, and ConHost/OpenConsole will load the 16x16 icon and scale it up rather than load the 20x20 size that is native for this DPI
### Expected Behavior
The optimal icon size for the DPI configuration.
### Actual Behavior
`ConExtractIconInBothSizesW` calls `GetSystemMetrics`, and the debugger indicated that `GetSystemMetrics` returns the wrong size. Looking at the OpenConsole manifest showed no indication of DPI awareness, which explains its behavior. `ConExtractIcons` seems to have quite sophisticated logic to probe for these icon sizes and use them if present before falling back to more common sizes, but this is effectively disabled if `GetSystemMetrics` won't return the exotic sizes. Patching the return values from `GetSystemMetrics` was sufficient for the rest of OpenConsole to load and use the 20x20 icon.

Contributor guide
Assessment
This issue has not been assessed yet.