[v3] Fix SetBackgroundColour on Windows (#4492)

* Fix SetBackgroundColour on Windows

Update Chromium window color on calls to SetBackgroundColour.

* update changelog

* v3.0.0-alpha.23

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Aldrich Asuncion 2025-08-12 18:45:24 +08:00 committed by GitHub
commit b7414a4303
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 20 additions and 28 deletions

View file

@ -25,6 +25,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## v3.0.0-alpha.23 - 2025-08-11
## Fixed
- Fix SetBackgroundColour on Windows by @PPTGamer in [PR](https://github.com/wailsapp/wails/pull/4492)
## v3.0.0-alpha.22 - 2025-08-10
## Added

View file

@ -1 +1 @@
v3.0.0-alpha.22
v3.0.0-alpha.23

View file

@ -283,7 +283,13 @@ func (w *windowsWebviewWindow) execJS(js string) {
}
func (w *windowsWebviewWindow) setBackgroundColour(color RGBA) {
w32.SetBackgroundColour(w.hwnd, color.Red, color.Green, color.Blue)
switch w.parent.options.BackgroundType {
case BackgroundTypeSolid:
w32.SetBackgroundColour(w.hwnd, color.Red, color.Green, color.Blue)
w.chromium.SetBackgroundColour(color.Red, color.Green, color.Blue, color.Alpha)
case BackgroundTypeTransparent, BackgroundTypeTranslucent:
w.chromium.SetBackgroundColour(0, 0, 0, 0)
}
}
func (w *windowsWebviewWindow) framelessWithDecorations() bool {
@ -474,16 +480,9 @@ func (w *windowsWebviewWindow) run() {
// The updateTheme call above will handle custom themes
}
switch options.BackgroundType {
case BackgroundTypeSolid:
var col = options.BackgroundColour
w.setBackgroundColour(col)
w.chromium.SetBackgroundColour(col.Red, col.Green, col.Blue, col.Alpha)
case BackgroundTypeTransparent:
w.chromium.SetBackgroundColour(0, 0, 0, 0)
case BackgroundTypeTranslucent:
w.chromium.SetBackgroundColour(0, 0, 0, 0)
w.setBackdropType(options.Windows.BackdropType)
w.setBackgroundColour(options.BackgroundColour)
if options.BackgroundType == BackgroundTypeTranslucent {
w.setBackdropType(w.parent.options.Windows.BackdropType)
}
// Process StartState

View file

@ -1,8 +1,2 @@
## Added
- Add Content Protection on Windows/Mac by [@leaanthony](https://github.com/leaanthony) based on the original work of [@Taiterbase](https://github.com/Taiterbase) in this [PR](https://github.com/wailsapp/wails/pull/4241)
- Add support for passing CLI variables to Task commands through `wails3 build` and `wails3 package` aliases (#4422) by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/4488)
## Changed
- `window.NativeWindowHandle()` -> `window.NativeWindow()` by @leaanthony in [#4471](https://github.com/wailsapp/wails/pull/4471)
- Refactor internal window handling by @leaanthony in [#4471](https://github.com/wailsapp/wails/pull/4471)
+ Fix extra-broad Linux package dependencies, fix outdated RPM dependencies.
## Fixed
- Fix SetBackgroundColour on Windows by @PPTGamer in [PR](https://github.com/wailsapp/wails/pull/4492)

View file

@ -1,8 +1,2 @@
## Added
- Add Content Protection on Windows/Mac by [@leaanthony](https://github.com/leaanthony) based on the original work of [@Taiterbase](https://github.com/Taiterbase) in this [PR](https://github.com/wailsapp/wails/pull/4241)
- Add support for passing CLI variables to Task commands through `wails3 build` and `wails3 package` aliases (#4422) by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/4488)
## Changed
- `window.NativeWindowHandle()` -> `window.NativeWindow()` by @leaanthony in [#4471](https://github.com/wailsapp/wails/pull/4471)
- Refactor internal window handling by @leaanthony in [#4471](https://github.com/wailsapp/wails/pull/4471)
+ Fix extra-broad Linux package dependencies, fix outdated RPM dependencies.
## Fixed
- Fix SetBackgroundColour on Windows by @PPTGamer in [PR](https://github.com/wailsapp/wails/pull/4492)