[v3 windows] Support isDarkMode. Add common application event mapping

This commit is contained in:
Lea Anthony
2023-08-18 19:50:57 +10:00
parent c367ef461e
commit 841289f1d1
2 changed files with 18 additions and 0 deletions
@@ -178,6 +178,7 @@ func (m *windowsApp) setApplicationMenu(menu *Menu) {
}
func (m *windowsApp) run() error {
m.setupCommonEvents()
for eventID := range m.parent.applicationEventListeners {
m.on(eventID)
}
@@ -0,0 +1,17 @@
//go:build windows
package application
import "github.com/wailsapp/wails/v3/pkg/events"
var commonApplicationEventMap = map[events.ApplicationEventType]events.ApplicationEventType{
events.Windows.SystemThemeChanged: events.Common.ThemeChanged,
}
func (m *windowsApp) setupCommonEvents() {
for sourceEvent, targetEvent := range commonApplicationEventMap {
m.parent.On(sourceEvent, func(event *Event) {
applicationEvents <- uint(targetEvent)
})
}
}