Skip to content

fix(gui): show the macOS Option glyph in toolbar tooltips, not "Alt+X" - #664

Merged
got3nks merged 3 commits into
amule-org:masterfrom
LSalami:fix-macos-tab-accel-glyph
Jul 28, 2026
Merged

fix(gui): show the macOS Option glyph in toolbar tooltips, not "Alt+X"#664
got3nks merged 3 commits into
amule-org:masterfrom
LSalami:fix-macos-tab-accel-glyph

Conversation

@LSalami

@LSalami LSalami commented Jul 28, 2026

Copy link
Copy Markdown

Follow-up to #642 per got3nks's post-merge comment: the macOS Navigate menu renders its own "\tAlt+N"-style accelerator using the platform's native glyph automatically (Cocoa substitutes Alt for Option/⌥ on a real NSMenuItem key equivalent), but the toolbar tooltips are plain text, so wx never touches them — they kept reading "(Alt+N)" even on macOS, inconsistent with the menu right above them.

What changed

Added TabAccelSuffix(), a small platform-conditional helper building " (⌥N)" on __WXMAC__ and " (Alt+N)" everywhere else, kept outside _() per the suggested approach so translated msgids are untouched.

Testing

Built and ran both amule and amuleGUI locally, full unit test suite passing (27/27). Confirmed via the po/ diff after regenerating: zero added/removed/changed msgids, purely line-number churn.

Purely cosmetic, no rush per the original comment — just closing the loop.

@got3nks got3nks left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Right approach, and I confirmed the msgid delta vs master is zero — the suffix staying outside _() did its job.

One fix before merge: the raw is a high-byte literal in a narrow string, converted to wxString via the locale-dependent wxConvLibc. That's the first such literal in src/ (every other non-ASCII in the tree is either in a comment or goes through wxString::FromUTF8), and it lands on the one platform where we already have a documented narrow-conversion quirk — macOS reports GetSystemEncodingName() as Mac OS Roman, which is why #318 had to force UTF-8 under __WXOSX__. Under a non-UTF-8 conversion those bytes render as mojibake (⌥) or collapse to empty instead of the glyph.

Safer to build it from the codepoint, which also can't be mangled by an editor or toolchain re-encoding the source file:

#ifdef __WXMAC__
	// U+2325 OPTION KEY -- built from the codepoint so it doesn't depend on
	// the narrow->wide conversion (macOS reports Mac OS Roman, see #318).
	return " (" + wxString(wxUniChar(0x2325)) + letter + ")";
#else
	return " (Alt+" + letter + ")";
#endif

Same output as yours — (⌥N), no separator, matching both the Apple convention and what the Navigate menu already renders.

Also worth confirming: did you actually hover a toolbar button on macOS and see the ⌥ render? Tooltips are hover-only, so this wouldn't show up in a build-and-run check either way.

LSalami added a commit to LSalami/amule that referenced this pull request Jul 28, 2026
…literal

got3nks's review on amule-org#664: a raw ⌥ literal in a narrow string is converted
to wxString via the locale-dependent wxConvLibc, and macOS reports
GetSystemEncodingName() as Mac OS Roman (the same narrow-conversion
quirk amule-org#318 had to work around under __WXOSX__ elsewhere in the tree).
Under a non-UTF-8 conversion those bytes would render as mojibake or
collapse to empty instead of the glyph. wxUniChar(0x2325) builds it from
the codepoint directly, sidestepping the conversion entirely.

po/ regenerated: zero msgid changes, confirming the suffix still never
touches a translated string.

Verified for real this time, not just build-and-run: launched the app
and hovered a toolbar button on macOS -- the tooltip reads "Finestra
reti (⌥N)", the glyph renders correctly.
@LSalami

LSalami commented Jul 28, 2026

Copy link
Copy Markdown
Author

Fixed in 93d9d52 — switched to `wxUniChar(0x2325)` exactly as suggested, sidestepping the narrow-conversion path entirely.

And yes, fair catch — I hadn't actually hovered a toolbar button, only confirmed build+po diff. Did it for real this time: launched the app and hovered "Networks" on macOS, tooltip reads "Finestra reti (⌥N)" — glyph renders correctly, no mojibake. (Screenshot confirmed by a human on this end, not just me — wanted a second pair of eyes given tooltip hover isn't something I can reliably automate/screenshot myself on macOS.)

po/ confirmed still zero msgid changes.

@got3nks

got3nks commented Jul 28, 2026

Copy link
Copy Markdown

Fix verified — wxString(wxUniChar(0x2325)) is exactly right, and the comment explaining why (with the #318 reference) means nobody will simplify it back later. Thanks for going back and actually hovering it; that's the check that mattered here, and confirming it in a non-English locale was a nice bonus.

Only thing left is mechanical: the po/ catalogs conflict with master again, so CI won't run while the branch is dirty. Rebase and re-run scripts/update-po.sh and I'll merge it.

LSalami added 3 commits July 28, 2026 12:12
Follow-up to amule-org#642 per got3nks's post-merge comment: the macOS Navigate
menu renders its own "\tAlt+N"-style accelerator using the platform's
native glyph automatically (Cocoa substitutes Alt for Option/⌥ on a real
NSMenuItem key equivalent), but the toolbar tooltips are plain text, so
wx never touches them -- they kept reading "(Alt+N)" even on macOS,
inconsistent with the menu right above them.

Added TabAccelSuffix(), a small platform-conditional helper building
" (⌥N)" on __WXMAC__ and " (Alt+N)" everywhere else, kept outside _()
so translated msgids are untouched -- confirmed via the po/ diff after
regenerating: zero added/removed/changed msgids, purely line-number
churn.

Verified: built and ran both amule and amuleGUI, full unit test suite
passing (27/27).
…literal

got3nks's review on amule-org#664: a raw ⌥ literal in a narrow string is converted
to wxString via the locale-dependent wxConvLibc, and macOS reports
GetSystemEncodingName() as Mac OS Roman (the same narrow-conversion
quirk amule-org#318 had to work around under __WXOSX__ elsewhere in the tree).
Under a non-UTF-8 conversion those bytes would render as mojibake or
collapse to empty instead of the glyph. wxUniChar(0x2325) builds it from
the codepoint directly, sidestepping the conversion entirely.

po/ regenerated: zero msgid changes, confirming the suffix still never
touches a translated string.

Verified for real this time, not just build-and-run: launched the app
and hovered a toolbar button on macOS -- the tooltip reads "Finestra
reti (⌥N)", the glyph renders correctly.
Mechanical rebase to resolve po/ conflicts against master's amule-org#665 --
no source changes here.
@LSalami
LSalami force-pushed the fix-macos-tab-accel-glyph branch from 93d9d52 to a868dc0 Compare July 28, 2026 10:15
@LSalami

LSalami commented Jul 28, 2026

Copy link
Copy Markdown
Author

Rebased onto current master and regenerated po/ (a868dc0) — clean now.

@got3nks got3nks left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Rebase is clean and the codepoint fix is verified — merging. Tier-1 clang-tidy was checked locally on the diff.

@got3nks
got3nks merged commit ae5c8ec into amule-org:master Jul 28, 2026
13 checks passed
@LSalami
LSalami deleted the fix-macos-tab-accel-glyph branch July 28, 2026 11:13
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