fix: enable system maximization for frameless windows except if transparent (#28207)

* fix: move widget maximization check

* fix linting error

* change workaround to only effect transparent windows

* disable menu maximize and restore for transparent windows

* disable double clicking title bar max/unmax for transparent windows

* add docs change and address review
This commit is contained in:
Michaela Laurencin 2021-04-05 16:53:59 -07:00 committed by GitHub
parent 82ea8ea68c
commit 19d7a6b761
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 17 deletions

View file

@ -530,7 +530,7 @@ void NativeWindowViews::Maximize() {
void NativeWindowViews::Unmaximize() {
#if defined(OS_WIN)
if (!(::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME)) {
if (transparent()) {
SetBounds(restore_bounds_, false);
return;
}
@ -540,21 +540,22 @@ void NativeWindowViews::Unmaximize() {
}
bool NativeWindowViews::IsMaximized() {
// For window without WS_THICKFRAME style, we can not call IsMaximized().
// This path will be used for transparent windows as well.
if (widget()->IsMaximized()) {
return true;
} else {
#if defined(OS_WIN)
if (!(::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME)) {
// Compare the size of the window with the size of the display
auto display = display::Screen::GetScreen()->GetDisplayNearestWindow(
GetNativeWindow());
// Maximized if the window is the same dimensions and placement as the
// display
return GetBounds() == display.work_area();
}
if (transparent()) {
// Compare the size of the window with the size of the display
auto display = display::Screen::GetScreen()->GetDisplayNearestWindow(
GetNativeWindow());
// Maximized if the window is the same dimensions and placement as the
// display
return GetBounds() == display.work_area();
}
#endif
return widget()->IsMaximized();
return false;
}
}
void NativeWindowViews::Minimize() {