Repository: electron/electron
Pull request: fix: fullscreen fillet / recovery is incorrect

#### Description of Change

fix: #46468

I can't run the test on the company's device. It gives the error "Error: Failed to get git tag, script quit with 9009." I looked at the script file but couldn't understand what's happening...
<!--
Thank you for your Pull Request. Please provide a description above and review
the requirements below.

Contributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.md
-->

#### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] PR description included and stakeholders cc'd
- [ ] `npm test` passes
- [ ] tests are [changed or added](https://github.com/electron/electron/blob/main/docs/development/testing.md)
- [ ] relevant API documentation, tutorials, and examples are updated and follow the [documentation style guide](https://github.com/electron/electron/blob/main/docs/development/style-guide.md)
- [x] [PR release notes](https://github.com/electron/clerk/blob/main/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/main/README.md#examples).

#### Release Notes

Notes: Fixed the issue where maximizing and restoring the window does not respect the corner radius settings, and the corner radius is incorrect in fullscreen mode.


Changed files:
filename: shell/browser/native_window_views.cc
patch: @@ -375,14 +375,17 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
       frame_style |= WS_MINIMIZEBOX;
     if (maximizable_)
       frame_style |= WS_MAXIMIZEBOX;
+
     // We should not show a frame for transparent window.
-    if (!thick_frame_)
+    if (!thick_frame_) {
       frame_style &= ~(WS_THICKFRAME | WS_CAPTION);
-    ::SetWindowLong(GetAcceleratedWidget(), GWL_STYLE, frame_style);
+      rounded_corner_ = false;
+    } else {
+      options.Get(options::kRoundedCorners, &rounded_corner_);
+    }
 
-    bool rounded_corner = true;
-    options.Get(options::kRoundedCorners, &rounded_corner);
-    SetRoundedCorners(rounded_corner);
+    ::SetWindowLong(GetAcceleratedWidget(), GWL_STYLE, frame_style);
+    SetRoundedCorners(rounded_corner_);
   }
 
   LONG ex_style = ::GetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE);
@@ -648,10 +651,12 @@ void NativeWindowViews::SetEnabledInternal(bool enable) {
 void NativeWindowViews::Maximize() {
 #if BUILDFLAG(IS_WIN)
   if (IsTranslucent()) {
-    // If a window is translucent but not transparent on Windows,
-    // that means it must have a backgroundMaterial set.
-    if (!transparent())
+    // Semi-transparent windows with backgroundMaterial not set to 'none', and
+    // not fully transparent, require manual handling of rounded corners when
+    // maximized.
+    if (rounded_corner_)
       SetRoundedCorners(false);
+
     restore_bounds_ = GetBounds();
     auto display = display::Screen::GetScreen()->GetDisplayNearestWindow(
         GetNativeWindow());
@@ -680,7 +685,8 @@ void NativeWindowViews::Unmaximize() {
     NotifyWindowUnmaximize();
     if (transparent()) {
       UpdateThickFrame();
-    } else {
+    }
+    if (rounded_corner_) {
       SetRoundedCorners(true);
     }
     return;
@@ -726,7 +732,8 @@ void NativeWindowViews::Restore() {
     NotifyWindowRestore();
     if (transparent()) {
       UpdateThickFrame();
-    } else {
+    }
+    if (rounded_corner_) {
       SetRoundedCorners(true);
     }
     return;
@@ -760,6 +767,12 @@ void NativeWindowViews::SetFullScreen(bool fullscreen) {
     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().
   // This path will be used for transparent windows as well.
   if (!thick_frame_) {

filename: shell/browser/native_window_views.h
patch: @@ -287,6 +287,9 @@ class NativeWindowViews : public NativeWindow,
   HWND legacy_window_ = nullptr;
   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.
   bool behind_task_bar_ = false;