Skip to content

Replace ILocaleService with IPlatformSettings, adding the system theme and change events - #666

Merged
botoddly merged 1 commit into
mainfrom
worktree-system-theme
Oct 25, 2026
Merged

botoddly merged 1 commit into
mainfrom
worktree-system-theme

Conversation

@botoddly

Copy link
Copy Markdown
Collaborator

Replaces ILocaleService from #665 with IPlatformSettings, one service for the user's OS or browser settings that apply to the whole app and can change while it runs.

API

  • SystemTheme Theme (Light, Dark or Unknown) and ThemeChanged, from SDL_GetSystemTheme and SDL_EVENT_SYSTEM_THEME_CHANGED.
  • GetPreferredLocales() and PreferredLocalesChanged, from SDL_GetPreferredLocales and SDL_EVENT_LOCALE_CHANGED. The locale code is unchanged from Expose the user's preferred locales through ILocaleService #665.
  • Each event carries the new value and SDL's timestamp. Both are raised from EventService on the main thread, before the frame's updates.

Behavior

  • Both members throw PixelyException off the main thread. SDL documents SDL_GetSystemTheme as main-thread only and SDL_GetPreferredLocales as not thread safe.
  • Headless mode reports the Unknown theme and never raises ThemeChanged, so a scenario does not depend on the host's theme. Locales stay readable there, since SDL_HINT_PREFERRED_LOCALES lets a scenario pin them.
  • SDL sends the locale event only on macOS, Android, Haiku and OpenHarmony. It does not send it on Windows, Linux, in the browser, or when the hint changes. The docs say so.

Breaking change

ILocaleService, LocaleService and docs/locales.md are removed. Use IPlatformSettings.GetPreferredLocales() instead. The content of docs/locales.md moved to docs/platform-settings.md.

Testing

  • Pixely.Tests: 598 passed, including new PlatformSettingsTests that push SDL's theme and locale events.
  • src/Pixely builds for net11.0-browser.
  • Not tried on a real desktop by switching the theme while an app runs.

…theme and change events for the theme and the preferred locales
@botoddly
botoddly merged commit 2d58892 into main Oct 25, 2026
3 checks passed
@botoddly
botoddly deleted the worktree-system-theme branch October 25, 2026 15:31
@github-actions

Copy link
Copy Markdown

📦 Development package Pixely 0.0.143 is available.

Workflow run (attempt 1)

@github-actions

Copy link
Copy Markdown

✅ Development package validation passed on all platforms.

Workflow run (attempt 1)

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.

1 participant