fix: titlebar incorrectly displayed on frameless windows (#40749)

* fix: titlebar incorrectly displayed on frameless windows

* fix: enable transparency for Mica windows

* Refactor ShouldWindowContentsBeTransparent

---------

Co-authored-by: clavin <clavin@electronjs.org>
This commit is contained in:
Bruno Henrique da Silva 2024-01-02 15:59:47 -03:00 committed by GitHub
parent 7995c56fb0
commit a208d45aca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 7 deletions

View file

@ -135,12 +135,12 @@ void ElectronDesktopWindowTreeHostWin::OnNativeThemeUpdated(
bool ElectronDesktopWindowTreeHostWin::ShouldWindowContentsBeTransparent()
const {
// Window should be marked as opaque if no transparency setting has been set,
// otherwise videos rendered in the window will trigger a DirectComposition
// redraw for every frame.
// Window should be marked as opaque if no transparency setting has been
// set, otherwise animations or videos rendered in the window will trigger a
// DirectComposition redraw for every frame.
// https://github.com/electron/electron/pull/39895
return native_window_view_->GetOpacity() < 1.0 ||
native_window_view_->transparent();
native_window_view_->IsTranslucent();
}
} // namespace electron