fix: fullscreen fillet / recovery is incorrect (#46847)
* fix: fullscreen fillet / recovery is incorrect Signed-off-by: ZOY\zoy-l <zoy-l@outlook.com> Co-authored-by: ZOY\zoy-l <zoy-l@outlook.com> * fix: maintain frameless consistency on windows 11 Co-authored-by: ZOY\zoy-l <zoy-l@outlook.com> * fix: maintain frameless consistency on windows 11 Co-authored-by: ZOY\zoy-l <zoy-l@outlook.com> * chore: modify the comments Co-authored-by: ZOY\zoy-l <zoy-l@outlook.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: ZOY\zoy-l <zoy-l@outlook.com>
This commit is contained in:
parent
d224d03e31
commit
713165e406
2 changed files with 28 additions and 12 deletions
|
@ -374,14 +374,17 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
|
||||||
frame_style |= WS_MINIMIZEBOX;
|
frame_style |= WS_MINIMIZEBOX;
|
||||||
if (maximizable_)
|
if (maximizable_)
|
||||||
frame_style |= WS_MAXIMIZEBOX;
|
frame_style |= WS_MAXIMIZEBOX;
|
||||||
// We should not show a frame for transparent window.
|
|
||||||
if (!thick_frame_)
|
|
||||||
frame_style &= ~(WS_THICKFRAME | WS_CAPTION);
|
|
||||||
::SetWindowLong(GetAcceleratedWidget(), GWL_STYLE, frame_style);
|
|
||||||
|
|
||||||
bool rounded_corner = true;
|
// We should not show a frame for transparent window.
|
||||||
options.Get(options::kRoundedCorners, &rounded_corner);
|
if (!thick_frame_) {
|
||||||
SetRoundedCorners(rounded_corner);
|
frame_style &= ~(WS_THICKFRAME | WS_CAPTION);
|
||||||
|
rounded_corner_ = false;
|
||||||
|
} else {
|
||||||
|
options.Get(options::kRoundedCorners, &rounded_corner_);
|
||||||
|
}
|
||||||
|
|
||||||
|
::SetWindowLong(GetAcceleratedWidget(), GWL_STYLE, frame_style);
|
||||||
|
SetRoundedCorners(rounded_corner_);
|
||||||
}
|
}
|
||||||
|
|
||||||
LONG ex_style = ::GetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE);
|
LONG ex_style = ::GetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE);
|
||||||
|
@ -646,10 +649,12 @@ void NativeWindowViews::SetEnabledInternal(bool enable) {
|
||||||
void NativeWindowViews::Maximize() {
|
void NativeWindowViews::Maximize() {
|
||||||
#if BUILDFLAG(IS_WIN)
|
#if BUILDFLAG(IS_WIN)
|
||||||
if (IsTranslucent()) {
|
if (IsTranslucent()) {
|
||||||
// If a window is translucent but not transparent on Windows,
|
// Semi-transparent windows with backgroundMaterial not set to 'none', and
|
||||||
// that means it must have a backgroundMaterial set.
|
// not fully transparent, require manual handling of rounded corners when
|
||||||
if (!transparent())
|
// maximized.
|
||||||
|
if (rounded_corner_)
|
||||||
SetRoundedCorners(false);
|
SetRoundedCorners(false);
|
||||||
|
|
||||||
restore_bounds_ = GetBounds();
|
restore_bounds_ = GetBounds();
|
||||||
auto display = display::Screen::GetScreen()->GetDisplayNearestWindow(
|
auto display = display::Screen::GetScreen()->GetDisplayNearestWindow(
|
||||||
GetNativeWindow());
|
GetNativeWindow());
|
||||||
|
@ -678,7 +683,8 @@ void NativeWindowViews::Unmaximize() {
|
||||||
NotifyWindowUnmaximize();
|
NotifyWindowUnmaximize();
|
||||||
if (transparent()) {
|
if (transparent()) {
|
||||||
UpdateThickFrame();
|
UpdateThickFrame();
|
||||||
} else {
|
}
|
||||||
|
if (rounded_corner_) {
|
||||||
SetRoundedCorners(true);
|
SetRoundedCorners(true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -724,7 +730,8 @@ void NativeWindowViews::Restore() {
|
||||||
NotifyWindowRestore();
|
NotifyWindowRestore();
|
||||||
if (transparent()) {
|
if (transparent()) {
|
||||||
UpdateThickFrame();
|
UpdateThickFrame();
|
||||||
} else {
|
}
|
||||||
|
if (rounded_corner_) {
|
||||||
SetRoundedCorners(true);
|
SetRoundedCorners(true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -758,6 +765,12 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
|
||||||
NotifyWindowLeaveFullScreen();
|
NotifyWindowLeaveFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If round corners are enabled,
|
||||||
|
// they need to be set based on whether the window is fullscreen.
|
||||||
|
if (rounded_corner_) {
|
||||||
|
SetRoundedCorners(!fullscreen);
|
||||||
|
}
|
||||||
|
|
||||||
// For window without WS_THICKFRAME style, we can not call SetFullscreen().
|
// For window without WS_THICKFRAME style, we can not call SetFullscreen().
|
||||||
// This path will be used for transparent windows as well.
|
// This path will be used for transparent windows as well.
|
||||||
if (!thick_frame_) {
|
if (!thick_frame_) {
|
||||||
|
|
|
@ -286,6 +286,9 @@ class NativeWindowViews : public NativeWindow,
|
||||||
HWND legacy_window_ = nullptr;
|
HWND legacy_window_ = nullptr;
|
||||||
bool layered_ = false;
|
bool layered_ = false;
|
||||||
|
|
||||||
|
// This value is determined when the window is created.
|
||||||
|
bool rounded_corner_ = true;
|
||||||
|
|
||||||
// Set to true if the window is always on top and behind the task bar.
|
// Set to true if the window is always on top and behind the task bar.
|
||||||
bool behind_task_bar_ = false;
|
bool behind_task_bar_ = false;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue