Skip to content

Commit

Permalink
update mobile driver too
Browse files Browse the repository at this point in the history
  • Loading branch information
dweymouth committed Jan 30, 2025
1 parent ac4e63a commit 19dff62
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions internal/driver/mobile/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
}
}
})
Expand Down

0 comments on commit 19dff62

Please sign in to comment.