You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RFE: Adjusting Plugins to be High DPI Display Responsive (in Windows) #942
changed the title [-]Adjusting Plugins to be High DPI Display Responsive (Windows)[/-][+]RFE: Adjusting Plugins to be High DPI Display Responsive (in Windows)[/+]on Aug 3, 2023
How do Microsoft Visual Styles and wxWidgets manifest resources wx/msw/wx.rc work with regard to DPI awareness? high_dpi_platform_msw "MSW Platform-Specific Build Issues" the High DPI guide
Short answer:
On Windows, Visual Styles (via manifest activation) and wxWidgets’ wx.rc resources are orthogonal to DPI awareness. Visual Styles only affect theming (UxTheme‑based rendering), while DPI awareness is controlled by application manifest entries and wxWidgets’ DPI‑aware build options. However, they interact in subtle ways: Windows will not scale themed controls correctly unless the process declares the correct DPI awareness level, and wxWidgets’ wx.rc embeds the manifest that determines this behavior.
Below is the complete, structured explanation, grounded in the High DPI documentation and the MSW platform notes.
🎯 Core takeaway
DPI awareness is determined by the application manifest, not by Visual Styles. wx/msw/wx.rc embeds the manifest that wxWidgets uses to declare DPI awareness (depending on wxUSE_DPI_AWARE_MANIFEST). Visual Styles only affect the appearance of common controls; they do not make an app DPI‑aware.
Windows will bitmap‑scale the entire UI.
Controls look themed but blurry.
2. Visual Styles + System DPI aware
Controls are themed and sized correctly at startup, but moving the window to a different DPI monitor will not rescale.
3. Visual Styles + Per‑monitor v2 (best)
Controls are themed and Windows sends WM_DPICHANGED to allow wxWidgets to rescale layouts.
This is the mode wxWidgets recommends for modern MSW builds.
🧩 wxWidgets High DPI behavior (MSW specifics)
From the High DPI documentation:
MSW does not automatically scale logical pixels.
wxWidgets uses logical pixels and provides FromDIP() / ToDIP() to convert.
Controls sized with hardcoded pixel values will break under DPI scaling. wxWidgets Online Manuals
This is why the wxWidgets maintainers repeatedly warn against hardcoded pixel sizes (as seen in the GitHub issue). Github
🧩 What wx/msw/wx.rc actually contributes
wx.rc embeds:
The Visual Styles activation
The DPI awareness manifest (if enabled)
Version info and icons
Thus, your DPI behavior is determined by how wxWidgets was built, not by your own plugin or application code—unless you override the manifest.
🧩 Practical implications for your MSVC + wxWidgets + OpenCPN workflow
Given your environment (MSVC, Win32, wxWidgets 3.2.x):
If you build wxWidgets with wxUSE_DPI_AWARE_MANIFEST=2
Your plugin/app becomes Per‑monitor v2 DPI aware automatically.
If you override the manifest in your own .rc file
You may accidentally disable DPI awareness or Visual Styles.
If you hardcode pixel sizes
Controls will misalign at 125–300% DPI unless you use FromDIP().
OpenCPN plugins inherit the DPI behavior of the host
If OpenCPN is built without DPI awareness, your plugin cannot fix it.
🧩 Summary table
Component
Controls Theming
DPI Scaling
Source
Visual Styles (ComCtl32 v6)
✔️ Yes
❌ No
Windows
Manifest
❌ No
✔️ Yes
Windows
wx/msw/wx.rc
✔️ Yes (Visual Styles)
✔️ Yes (if enabled)
wxWidgets
wxUSE_DPI_AWARE_MANIFEST
❌ No
✔️ Yes
wxWidgets build system
FromDIP() / ToDIP()
❌ No
✔️ Control sizing
wxWidgets API
If you want, I can also produce:
A minimal MSVC project showing correct DPI‑aware manifest embedding
A diff showing how to override wxWidgets’ manifest safely
A diagnostic checklist for OpenCPN plugin DPI issues
A step‑by‑step guide for building wxWidgets 3.2.x with Per‑monitor v2 DPI awareness
Would you like one of those?
**Short answer:**
On Windows, **Visual Styles** (via `manifest` activation) and **wxWidgets’ `wx.rc` resources** are *orthogonal* to **DPI awareness**. Visual Styles only affect **theming** (UxTheme‑based rendering), while DPI awareness is controlled by **application manifest entries** and **wxWidgets’ DPI‑aware build options**. However, they *interact* in subtle ways: Windows will not scale themed controls correctly unless the process declares the correct DPI awareness level, and wxWidgets’ `wx.rc` embeds the manifest that determines this behavior.
Below is the complete, structured explanation, grounded in the High DPI documentation and the MSW platform notes.
🎯 Core takeaway
DPI awareness is determined by the application manifest, not by Visual Styles. wx/msw/wx.rc embeds the manifest that wxWidgets uses to declare DPI awareness (depending on wxUSE_DPI_AWARE_MANIFEST). Visual Styles only affect the appearance of common controls; they do not make an app DPI‑aware.
Windows will bitmap‑scale the entire UI.
Controls look themed but blurry.
2. Visual Styles + System DPI aware
Controls are themed and sized correctly at startup, but moving the window to a different DPI monitor will not rescale.
3. Visual Styles + Per‑monitor v2 (best)
Controls are themed and Windows sends WM_DPICHANGED to allow wxWidgets to rescale layouts.
This is the mode wxWidgets recommends for modern MSW builds.
🧩 wxWidgets High DPI behavior (MSW specifics)
From the High DPI documentation:
MSW does not automatically scale logical pixels.
wxWidgets uses logical pixels and provides FromDIP() / ToDIP() to convert.
Activity
[-]Adjusting Plugins to be High DPI Display Responsive (Windows)[/-][+]RFE: Adjusting Plugins to be High DPI Display Responsive (in Windows)[/+]Rasbats commentedon Aug 3, 2023
Has this been used in any standalone plugin? i.e. Not Dashboard, WMM, Grib_pi.
rgleason commentedon Aug 3, 2023
Ocpn-draw I believe for text.
rgleason commentedon Feb 27, 2025
Adjust SVG icon sizes for scaled display on Windows
Issue Badly sized icons
rgleason commentedon May 31, 2026
How do Microsoft Visual Styles and wxWidgets manifest resources wx/msw/wx.rc work with regard to DPI awareness? high_dpi_platform_msw "MSW Platform-Specific Build Issues" the High DPI guide
https://github.com/zeodotdev/wzWidget/blob/kicad/macos-wx-3.2/docs/msw/winxp.md
AI Produced
Short answer:
On Windows, Visual Styles (via
manifestactivation) and wxWidgets’wx.rcresources are orthogonal to DPI awareness. Visual Styles only affect theming (UxTheme‑based rendering), while DPI awareness is controlled by application manifest entries and wxWidgets’ DPI‑aware build options. However, they interact in subtle ways: Windows will not scale themed controls correctly unless the process declares the correct DPI awareness level, and wxWidgets’wx.rcembeds the manifest that determines this behavior.Below is the complete, structured explanation, grounded in the High DPI documentation and the MSW platform notes.
🎯 Core takeaway
DPI awareness is determined by the application manifest, not by Visual Styles.
wx/msw/wx.rcembeds the manifest that wxWidgets uses to declare DPI awareness (depending onwxUSE_DPI_AWARE_MANIFEST). Visual Styles only affect the appearance of common controls; they do not make an app DPI‑aware.🧩 How Visual Styles work (Windows side)
Visual Styles are enabled by embedding:
This activates ComCtl32 v6, which gives themed controls (rounded buttons, modern checkboxes, etc.).
Important:
Visual Styles do not declare DPI awareness. They only change how controls are drawn.
🧩 How DPI awareness works (Windows side)
Windows uses the application manifest to determine DPI behavior:
DPI unaware→ Windows bitmap‑scales the entire app (blurry)System DPI aware→ scaled once at startupPer‑monitor DPI aware→ rescaled when moved between monitorsPer‑monitor v2→ best, modern behaviorThese are declared via:
🧩 How wxWidgets handles this (
wx.rcand build options)wxWidgets’ MSW port includes
wx/msw/wx.rc, which embeds:The key build option is:
wxUSE_DPI_AWARE_MANIFEST0→ No DPI manifest included1→ Include System DPI aware manifest2→ Include Per‑monitor v2 manifest (Windows 10+)This is documented in the High DPI guide and MSW platform notes.
wxWidgets Online Manuals
🧩 How they interact
1. Visual Styles + DPI unaware
Windows will bitmap‑scale the entire UI.
Controls look themed but blurry.
2. Visual Styles + System DPI aware
Controls are themed and sized correctly at startup, but moving the window to a different DPI monitor will not rescale.
3. Visual Styles + Per‑monitor v2 (best)
Controls are themed and Windows sends
WM_DPICHANGEDto allow wxWidgets to rescale layouts.This is the mode wxWidgets recommends for modern MSW builds.
🧩 wxWidgets High DPI behavior (MSW specifics)
From the High DPI documentation:
FromDIP()/ToDIP()to convert.wxWidgets Online Manuals
This is why the wxWidgets maintainers repeatedly warn against hardcoded pixel sizes (as seen in the GitHub issue).
Github
🧩 What
wx/msw/wx.rcactually contributeswx.rcembeds:Thus, your DPI behavior is determined by how wxWidgets was built, not by your own plugin or application code—unless you override the manifest.
🧩 Practical implications for your MSVC + wxWidgets + OpenCPN workflow
Given your environment (MSVC, Win32, wxWidgets 3.2.x):
If you build wxWidgets with
wxUSE_DPI_AWARE_MANIFEST=2Your plugin/app becomes Per‑monitor v2 DPI aware automatically.
If you override the manifest in your own
.rcfileYou may accidentally disable DPI awareness or Visual Styles.
If you hardcode pixel sizes
Controls will misalign at 125–300% DPI unless you use
FromDIP().OpenCPN plugins inherit the DPI behavior of the host
If OpenCPN is built without DPI awareness, your plugin cannot fix it.
🧩 Summary table
If you want, I can also produce:
Would you like one of those?
**Short answer:** On Windows, **Visual Styles** (via `manifest` activation) and **wxWidgets’ `wx.rc` resources** are *orthogonal* to **DPI awareness**. Visual Styles only affect **theming** (UxTheme‑based rendering), while DPI awareness is controlled by **application manifest entries** and **wxWidgets’ DPI‑aware build options**. However, they *interact* in subtle ways: Windows will not scale themed controls correctly unless the process declares the correct DPI awareness level, and wxWidgets’ `wx.rc` embeds the manifest that determines this behavior.Below is the complete, structured explanation, grounded in the High DPI documentation and the MSW platform notes.
🎯 Core takeaway
DPI awareness is determined by the application manifest, not by Visual Styles.
wx/msw/wx.rcembeds the manifest that wxWidgets uses to declare DPI awareness (depending onwxUSE_DPI_AWARE_MANIFEST). Visual Styles only affect the appearance of common controls; they do not make an app DPI‑aware.🧩 How Visual Styles work (Windows side)
Visual Styles are enabled by embedding:
This activates ComCtl32 v6, which gives themed controls (rounded buttons, modern checkboxes, etc.).
Important:
Visual Styles do not declare DPI awareness. They only change how controls are drawn.
🧩 How DPI awareness works (Windows side)
Windows uses the application manifest to determine DPI behavior:
DPI unaware→ Windows bitmap‑scales the entire app (blurry)System DPI aware→ scaled once at startupPer‑monitor DPI aware→ rescaled when moved between monitorsPer‑monitor v2→ best, modern behaviorThese are declared via:
🧩 How wxWidgets handles this (
wx.rcand build options)wxWidgets’ MSW port includes
wx/msw/wx.rc, which embeds:The key build option is:
wxUSE_DPI_AWARE_MANIFEST0→ No DPI manifest included1→ Include System DPI aware manifest2→ Include Per‑monitor v2 manifest (Windows 10+)This is documented in the High DPI guide and MSW platform notes.
[wxWidgets Online Manuals](https://docs.wxwidgets.org/latest/overview_high_dpi.html)
🧩 How they interact
1. Visual Styles + DPI unaware
Windows will bitmap‑scale the entire UI.
Controls look themed but blurry.
2. Visual Styles + System DPI aware
Controls are themed and sized correctly at startup, but moving the window to a different DPI monitor will not rescale.
3. Visual Styles + Per‑monitor v2 (best)
Controls are themed and Windows sends
WM_DPICHANGEDto allow wxWidgets to rescale layouts.This is the mode wxWidgets recommends for modern MSW builds.
🧩 wxWidgets High DPI behavior (MSW specifics)
From the High DPI documentation:
FromDIP()/ToDIP()to convert.[wxWidgets Online Manuals](https://docs.wxwidgets.org/latest/overview_high_dpi.html)
This is why the wxWidgets maintainers repeatedly warn against hardcoded pixel sizes (as seen in the GitHub issue).
[Github](wxWidgets/wxWidgets#24459)
🧩 What
wx/msw/wx.rcactually contributeswx.rcembeds:Thus, your DPI behavior is determined by how wxWidgets was built, not by your own plugin or application code—unless you override the manifest.
🧩 Practical implications for your MSVC + wxWidgets + OpenCPN workflow
Given your environment (MSVC, Win32, wxWidgets 3.2.x):
If you build wxWidgets with
wxUSE_DPI_AWARE_MANIFEST=2Your plugin/app becomes Per‑monitor v2 DPI aware automatically.
If you override the manifest in your own
.rcfileYou may accidentally disable DPI awareness or Visual Styles.
If you hardcode pixel sizes
Controls will misalign at 125–300% DPI unless you use
FromDIP().OpenCPN plugins inherit the DPI behavior of the host
If OpenCPN is built without DPI awareness, your plugin cannot fix it.
🧩 Summary table
<dpiAware>wxUSE_DPI_AWARE_MANIFESTFromDIP()/ToDIP()If you want, I can also produce:
Would you like one of those?