Skip to content

fix(gui): scale preferences page icons on hi-DPI displays - #295

Merged
got3nks merged 1 commit into
amule-org:masterfrom
Zeyckler:fix/prefs-hidpi-icons
Jul 5, 2026
Merged

fix(gui): scale preferences page icons on hi-DPI displays#295
got3nks merged 1 commit into
amule-org:masterfrom
Zeyckler:fix/prefs-hidpi-icons

Conversation

@Zeyckler

@Zeyckler Zeyckler commented Jul 4, 2026

Copy link
Copy Markdown

Summary

Follow-up to #294: the preferences dialog's page selector (General, Connection, Directories, Servers, ...) has the same HiDPI problem the main toolbar had — its 16x16 icons go into a fixed-size wxImageList, so on DPI-aware builds they render at 16 physical pixels: tiny and blurry on 4K/scaled displays.

Same treatment as #294:

  • The icons are handed to the list control as wxBitmapBundles via wxListCtrl::SetSmallImages() (available since wx 3.2, the project minimum; verified present in the v3.2.0 headers) instead of AssignImageList.
  • Each bundle is built from the 16px art (the amuleSpecial XPMs, plus the CamuleArtProvider PNG for the IP2Country tab — its source is also 16x16) plus a wxIMAGE_QUALITY_HIGH 2x upscale, converting the transparency mask to an alpha channel first.
  • The macOS-only right/bottom icon padding (padIcon, added for the NSTableView alignment quirks) is folded into the bundle builder and applied per resolution — the 1x canvas gets the original pads, the 2x canvas doubled pads — so the padded proportions are preserved at every scale. Off Mac the padding remains a no-op.

Icon indexes passed to InsertItem are unchanged (bundle vector order = page order, same as the old imagelist order).

Test plan

  • clang-format 18 passes on the touched file (matches the CI gate).
  • wxListCtrl::SetSmallImages(const wxVector<wxBitmapBundle>&) verified present in wx 3.2.0 (include/wx/listbase.h).
  • No local wxWidgets toolchain; relying on CI for compile verification. Visual check appreciated: open Preferences on a hi-DPI display — page icons should be correctly sized and smooth; on macOS the icon/text spacing in the page list should be unchanged.

🤖 Generated with Claude Code

The preferences dialog's page list (General, Connection, Directories,
etc.) fed 16x16 bitmaps into a fixed-size wxImageList, so on
DPI-aware builds the icons render at 16 physical pixels — tiny and
blurry on hi-DPI screens, same problem as the main toolbar (amule-org#294).

Hand the icons to the list control as wxBitmapBundles instead
(wxListCtrl::SetSmallImages, wx >= 3.2), each built from the 16px art
plus a wxIMAGE_QUALITY_HIGH 2x upscale with the mask converted to an
alpha channel first. The macOS-only right/bottom padding is applied
per resolution so the padded canvas keeps its proportions at 2x.

Co-Authored-By: Claude Fable 5 <[email protected]>
@got3nks

got3nks commented Jul 5, 2026

Copy link
Copy Markdown

Thanks for the follow-up, @Zeyckler.

Verified locally on all three platforms:

  • Windows 11 ARM64 at 150% / 200% display scaling: Preferences page icons now scale with the rest of the UI as expected.
  • Ubuntu 26.04 ARM64 (wxGTK 3.2): built clean, page selector renders normally.
  • macOS 15 ARM64 (wxOSX Cocoa 3.3.2): built clean, page icons scale correctly. Small visual regression on this platform though: the #ifdef __WXOSX__ right/bottom pads that were compensating for AssignImageList + NSTableView alignment produce visible extra whitespace under SetSmallImages, which already inserts native icon/text spacing. I'll follow up with a separate PR from my fork dropping the Mac pads now that they're no longer needed.

Merging this one as-is on CI green.

@got3nks
got3nks merged commit 5f9b48f into amule-org:master Jul 5, 2026
13 checks passed
got3nks added a commit that referenced this pull request Jul 5, 2026
Follow-up to #295: the old `#ifdef __WXOSX__` right/bottom pads (14/9)
compensated for `AssignImageList`'s NSTableView render path — zero
native icon/text gap plus vertical-centre-of-the-full-bitmap, which
made a bare 16x16 icon sit flush against the label and drift toward
the row baseline. `SetSmallImages` uses a different wxOSX path that
already inserts native icon/text spacing, so the pads now render as
visible extra whitespace between icon and label. Drop them (and the
now-dead `img.Size()` pass) so wxOSX matches Windows/Linux layout.

Verified locally: rebuilt on macOS 15 ARM64 (wxOSX Cocoa 3.3.2), page
icons now sit at the natural offset the wx-native path picks. No
change on wxGTK or wxMSW paths (both pads were already 0 there).
Cflsft pushed a commit to Cflsft/amule that referenced this pull request Jul 6, 2026
)

The preferences dialog's page list (General, Connection, Directories,
etc.) fed 16x16 bitmaps into a fixed-size wxImageList, so on
DPI-aware builds the icons render at 16 physical pixels — tiny and
blurry on hi-DPI screens, same problem as the main toolbar (amule-org#294).

Hand the icons to the list control as wxBitmapBundles instead
(wxListCtrl::SetSmallImages, wx >= 3.2), each built from the 16px art
plus a wxIMAGE_QUALITY_HIGH 2x upscale with the mask converted to an
alpha channel first. The macOS-only right/bottom padding is applied
per resolution so the padded canvas keeps its proportions at 2x.

Co-authored-by: Carlos Barrero <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
Cflsft pushed a commit to Cflsft/amule that referenced this pull request Jul 6, 2026
Follow-up to amule-org#295: the old `#ifdef __WXOSX__` right/bottom pads (14/9)
compensated for `AssignImageList`'s NSTableView render path — zero
native icon/text gap plus vertical-centre-of-the-full-bitmap, which
made a bare 16x16 icon sit flush against the label and drift toward
the row baseline. `SetSmallImages` uses a different wxOSX path that
already inserts native icon/text spacing, so the pads now render as
visible extra whitespace between icon and label. Drop them (and the
now-dead `img.Size()` pass) so wxOSX matches Windows/Linux layout.

Verified locally: rebuilt on macOS 15 ARM64 (wxOSX Cocoa 3.3.2), page
icons now sit at the natural offset the wx-native path picks. No
change on wxGTK or wxMSW paths (both pads were already 0 there).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants