Live skin switching: no restart when changing skins #200
Labels
No labels
amd
avatars
bug
builder
cannot-reproduce
crash
epic
feature
from-viewer
gl-removal
known-limitation
monitoring
parity
perf
platform
priority
critical
priority
high
priority
low
priority
medium
provenance
rendering
rt
status
in-progress
status
testing
status
up-next
triage
ui
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sky_line/Slipstream#200
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Changing the skin (Preferences > Skins) currently pops the
ChangeSkinnotification and only applies after a restart (LLFloaterPreference::onApplySkin/callbackApplySkin). Goal: apply a skin change completely and immediately. No restart, and no "some windows update later".What a skin changes, and why it needs a restart today
Each part is read once, when the UI is built at startup:
skins/<skin>/colors.xml): loaded intoLLUIColorTableat startup (llappviewer.cpp~2789,loadFromSettings).skins/<skin>/textures, 9-21 overrides per skin: buttons, frames, icons):LLUIImageListcaches them by name; widgets holdLLUIImagePtr.xui/en/widgets/*.xml, e.g. hereticfloater.xml/tool_tip.xml/location_input.xml, alchemyline_editor.xml/chat_editor.xml): applied only when a widget is constructed.panel_toolbar_view,panel_chiclet_bar,panel_login,panel_progress,panel_instant_message,floater_about,floater_region_restarting; alchemypanel_toolbar_view; ionicpanel_progress): every floater, panel, menu and toolbar is built from XUI once. Code keepsgetChildpointers, and there's no rebuild path.skin_settings.xmlper-skin settings (e.g.LegacyProfile,LegacyNotificationWell) andgDirUtilp->setSkinFolder(search paths for everything above).Plan
1. Switch the skin search path at runtime
gDirUtilp->setSkinFolder(new, language), reloadskin_settings.xml, then fire oneLLUI"skin changed" signal that the steps below hang off.2. Colours: in place, instant
LLUIColorholds a pointer into the table (mColorPtr), not a copy. ReloadLLUIColorTablefrom the new skin into the existing entries: no erase/reinsert, so pointers stay valid, and keys the new skin lacks fall back to the default skin's value. Everything recolours on the next frame.3. Textures: in place, instant
For every cached
LLUIImage, point its image at the new skin's texture of the same name, falling back to the default skin's file. Same pattern as the live font switch (3a2b25e021): keep the objects widgets point to and swap what's inside. Release the old images through the VK texture path (destruction is already deferred past in-flight frames). Also check scale-9 margins /LLUIImageparams fromtextures.xml, which can differ per skin.4. Widget defaults + layouts: rebuild the UI tree
A full UI rebuild, not "reopen later":
LLFloaterReginstances and rebuild them from the new XUI + widget defaults, then restore their state. Floaters with transient content (IM sessions, inventory views, profiles, edit tools) need their instance keys re-applied. Audit the ones that can't simply reconstruct and give them a save/restore hook.LLToolBarView+ button commands), chat bar / nearby chat, status bar, navigation/location bar, menus (init_menus/cleanup_menus, incl. the pie menus), notification well/chiclets and the login panel. Rebuild them in dependency order.getChildpointers orLLHandles across the rebuild must re-fetch. Grep for cached widget pointers in singletons, e.g.gMenuHolderchildren,LLNavigationBar,LLStatusBar, the chiclet bar and IM containers.5. Preferences UI
Apply switches immediately, like fonts do now. Remove the
ChangeSkinrestart notification, and also remove the "restart required" tool tip on the skin list.6. Verify
Switch through default → alchemy → heretic → ionic → user skins with many floaters open (IMs, inventory, build tools, profiles, prefs itself). There should be no crashes or leaks (ASan build), state should be restored, and the result should look identical to a fresh start with that skin.
Related: live fonts (#193,
3a2b25e021). The font switch should share the same "UI changed" relayout path.