Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 6 commits into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
change workaround to only effect transparent windows
  • Loading branch information
mlaurencin committed Mar 31, 2021
commit 7a87fdb01e0b58c7085ef8871f663ddd93e8f147
7 changes: 2 additions & 5 deletions shell/browser/native_window_views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -543,11 +543,8 @@ bool NativeWindowViews::IsMaximized() {
if (widget()->IsMaximized()) {
return true;
} else {
// For window without WS_THICKFRAME style, IsMaximized() will not correctly
// check the window state. This path will be used for transparent windows as
// well.
#if defined(OS_WIN)
if (!(::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME)) {
if (transparent()) {
// Compare the size of the window with the size of the display
auto display = display::Screen::GetScreen()->GetDisplayNearestWindow(
GetNativeWindow());
Expand Down
8 changes: 7 additions & 1 deletion shell/browser/native_window_views_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ HHOOK NativeWindowViews::mouse_hook_ = NULL;

void NativeWindowViews::Maximize() {
// Only use Maximize() when window has WS_THICKFRAME style
if (::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME) {
if (!transparent()) {
if (IsVisible())
widget()->Maximize();
else
Expand Down Expand Up @@ -324,6 +324,12 @@ bool NativeWindowViews::PreHandleMSG(UINT message,
GET_Y_LPARAM(l_param), &prevent_default);
return prevent_default;
}
case WM_SYSCOMMAND: {
if (transparent() && w_param == SC_MAXIMIZE) {
return true;
}
return false;
}
default:
return false;
}
Expand Down