From 19dff626fd5d2af640924c8ada3cb2ee4b167a4d Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Thu, 30 Jan 2025 18:03:19 -0300 Subject: [PATCH] update mobile driver too --- internal/driver/mobile/driver.go | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/internal/driver/mobile/driver.go b/internal/driver/mobile/driver.go index ee1d44db88..f1decd0401 100644 --- a/internal/driver/mobile/driver.go +++ b/internal/driver/mobile/driver.go @@ -169,10 +169,19 @@ func (d *driver) Run() { app.Main(func(a app.App) { d.app = a d.queuedFuncs = async.NewUnboundedChan[func()]() - var pendingSettings fyne.Settings + fyne.CurrentApp().Settings().AddListener(func(s fyne.Settings) { - pendingSettings = s + painter.ClearFontCache() + cache.ResetThemeCaches() + intapp.ApplySettingsWithCallback(s, fyne.CurrentApp(), func(w fyne.Window) { + c, ok := w.Canvas().(*canvas) + if !ok { + return + } + c.applyThemeOutOfTreeObjects() + }) }) + draw := time.NewTicker(time.Second / 60) defer func() { l := fyne.CurrentApp().Lifecycle().(*intapp.Lifecycle) @@ -250,19 +259,6 @@ func (d *driver) Run() { d.typeUpCanvas(c, e.Rune, e.Code, e.Modifiers) } } - - if pendingSettings != nil { - painter.ClearFontCache() - cache.ResetThemeCaches() - intapp.ApplySettingsWithCallback(pendingSettings, fyne.CurrentApp(), func(w fyne.Window) { - c, ok := w.Canvas().(*canvas) - if !ok { - return - } - c.applyThemeOutOfTreeObjects() - }) - pendingSettings = nil - } } } })