fix(gui): re-theme Scintilla log views on system appearance change - #570
Merged
Merged
Conversation
The log views migrated to wxStyledTextCtrl (Scintilla) in amule-project#548 paint their colours from the system theme once, in the constructor. The native wxTextCtrl they replaced followed the platform appearance automatically; Scintilla does not, so a live light/dark switch left the three log panes (aMule Log, aMuleGUI Log, Server Info) stuck in the previous theme's colours while the rest of the UI re-themed. Re-apply the styles on wxEVT_SYS_COLOUR_CHANGED so the panes track the appearance. Also guard against a foreground/background that resolve with too little contrast to read: on macOS the window/text system colours are appearance-aware and, on some wx builds, come back near-identical, which paints the whole log invisible (amule-project#569). When the pair is unreadable, keep the theme's background and force a legible foreground from its brightness. Windows/GTK return static, well-contrasted colours and are unaffected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The log views were migrated to
wxStyledTextCtrl(Scintilla) in #548. Scintilla paints its colours from the system theme once, in the constructor, and — unlike the nativewxTextCtrlit replaced — does not follow the platform appearance on its own. A live light↔dark switch therefore left the three log panes (aMule Log, aMuleGUI Log, Server Info) stuck in the previous theme's colours while the rest of the UI re-themed. This re-applies the styles onwxEVT_SYS_COLOUR_CHANGEDso the panes track the appearance. Verified on macOS — the panes now re-theme live.It also adds a contrast guard: on macOS the window/text system colours are appearance-aware and resolved to RGB at call time, and on some wx builds they resolve with too little contrast to read, painting the log invisible (reported in #569 with a self-built wxWidgets 3.3.3). When the two come back near-identical the fix keeps the theme's background and forces a legible foreground chosen from its brightness. Windows/GTK return static, well-contrasted colours, so that branch never triggers there and their rendering is unchanged.