diff --git a/docs/src/content/docs/changelog.mdx b/docs/src/content/docs/changelog.mdx index e4ca6fa24a7..44537067d03 100644 --- a/docs/src/content/docs/changelog.mdx +++ b/docs/src/content/docs/changelog.mdx @@ -52,8 +52,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix event handling by [@leaanthony](https://github.com/leaanthony) - Fixed window shutdown logic by [@leaanthony](https://github.com/leaanthony) - Common taskfile now defaults to generating Typescript bindings for Typescript templates by [@leaanthony](https://github.com/leaanthony) +- Fix Close application on WM_CLOSE message when no windows are open/systray only by [@mmalcek](https://github.com/mmalcek) in [#3990](https://github.com/wailsapp/wails/pull/3990) - Fixed garble build by @5aaee9 in [#3192](https://github.com/wailsapp/wails/pull/3192) + ### Changed - Moved build assets to platform specific directories by [@leaanthony](https://github.com/leaanthony) diff --git a/v3/pkg/application/application_windows.go b/v3/pkg/application/application_windows.go index 526814b8f5f..4622ee8d352 100644 --- a/v3/pkg/application/application_windows.go +++ b/v3/pkg/application/application_windows.go @@ -205,8 +205,13 @@ func (m *windowsApp) wndProc(hwnd w32.HWND, msg uint32, wParam, lParam uintptr) } } + // Handle the main thread window + // Quit the application if requested // Reprocess and cache screens when display settings change if hwnd == m.mainThreadWindowHWND { + if msg == w32.WM_ENDSESSION || msg == w32.WM_DESTROY || msg == w32.WM_CLOSE { + globalApplication.Quit() + } if msg == w32.WM_DISPLAYCHANGE || (msg == w32.WM_SETTINGCHANGE && wParam == w32.SPI_SETWORKAREA) { err := m.processAndCacheScreens() if err != nil {