Read Wine settings live at poll and spawn

Phase 2 of the Wine/Proton stage (decisions 3, 4, 16, 17, 19 in docs/testing/wine-proton.md): replace the Wine manager's startup snapshot with a live settings source read once per poll, so accepted global settings take effect with no reader restart. The source publishes only the active/global profile's Wine values; per-application profile switching never changes the governing list. A newly listed running program restarts its helper once in the same mode; removals and clearing the global switch never downgrade a running helper.
This commit is contained in:
hjozwiak committed 2026-11-02 01:15:33 -05:00
1 parent a60a251472
commit 9a10a15b68
13 files changed
+327 -51

No files matched your search

+22
View File
@@ -15,6 +15,7 @@ import (
type liveSettings struct {
editFieldFocused func() bool // Installed before workers start; reads cached focus only.
current atomic.Pointer[config.Settings]
globalWine atomic.Pointer[config.WineSettings]
preferencesPID atomic.Int64 // Owned by the preferences window lifetime; zero when closed.
application atomic.Pointer[string]
requestedApplication atomic.Pointer[string]
@@ -35,3 +36,24 @@ func (live *liveSettings) notify_clipboard() {
}
}
func (live *liveSettings) Load() config.Settings { return *live.current.Load() }
// Wine values are global-only: one list governs every prefix regardless of
// which application has focus. The preferences worker publishes them here
// only when the active/global profile changes, never when it publishes a
// per-application profile through Store, so application switching cannot
// change the governing Wine list. The Wine manager reads them at each poll
// and helper spawn.
func (live *liveSettings) StoreGlobalWine(settings config.WineSettings) {
settings.ExcludedPrograms = append([]string(nil), settings.ExcludedPrograms...)
live.globalWine.Store(&settings)
}
func (live *liveSettings) LoadGlobalWine() config.WineSettings {
current := live.globalWine.Load()
if current == nil {
return config.WineSettings{}
}
settings := *current
settings.ExcludedPrograms = append([]string(nil), settings.ExcludedPrograms...)
return settings
}