Rework RFC 0007 appearance model: stateful mode + dual prefs, fix persistence leak#25
Merged
Merged
Conversation
…sistence leak Review feedback (PR #24) identified three problems with the v1 stateless "switch to my companion" design: 1. Persistence bug: dasher_set_appearance called dasher_set_palette, which writes the persistent SP_COLOUR_ID, so the user's explicit palette choice was clobbered by every auto-switch and lost across restarts. 2. No System/Light/Dark mode concept — every frontend had to reinvent the mode toggle. 3. 1:1 companion pairing locked users into (Rainbow <-> Rainbow Dark) with no way to mix e.g. Rainbow light + TurboLUT Dark. This reworks the model to own appearance state at the C API layer (not in the engine Parameters system — appearance is a shell/canvas concern): - dasher_get/set_appearance_mode: SYSTEM (default) / LIGHT / DARK. - dasher_get/set_system_appearance: transient OS appearance input (SYSTEM mode). - dasher_get/set_light_palette + dasher_get/set_dark_palette: two independent persisted preferences (enables mixing). - dasher_set_user_palette: sets the current-side pref and defaults the other side to the chosen palette's companion. - Resolution (mode + system + prefs -> SP_COLOUR_ID) lives in DasherCore and runs at create + on every change, so dasher_get_current_palette always reflects the resolved palette. - State persists to <userDir>/appearance_settings.xml (pugixml sidecar); the preferences — not the transient active palette — are the source of truth, so auto-switching can never overwrite the user's choice (bug #1 fixed). - dasher_set_palette now routes through dasher_set_user_palette so existing pickers stay correct within the model. dasher_set_appearance is removed. Kept (not redundant): the palette appearance/companion XML metadata and dasher_get_palette_appearance / dasher_find_companion_palette — still needed for defaulting the dark preference and grouping the picker. Tests: mode-system, forced-mode, independent-prefs, and a persistence regression that asserts the user's light choice survives a dark auto-switch across a restart. Full suite green (21/21); clang-format clean. RFC text in dasher-project/governance#9 revised to match. Signed-off-by: will wade <willwade@gmail.com>
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.
No description provided.