Repository: electron/electron (language: cpp)

Issue:
When the window is closed/hide, the rounded corners disappear.
### Preflight Checklist

- [x] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project.
- [x] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [x] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a bug report that matches the one I want to file, without success.

### Electron Version

34.0.1

### What operating system(s) are you using?

Windows

### Operating System Version

windows 11

### What arch are you using?

x64

### Last Known Working Electron version

_No response_

### Expected Behavior

Rounded corners are normal

### Actual Behavior

 rounded corners disappear

### Testcase Gist URL

https://github.com/zoy-l/electron-issues-45643

### Additional Information

![Image](https://github.com/user-attachments/assets/e72aef1f-80bd-4d56-a3e5-fb180847c352)



Additionally, two tooltips appear when hovering over the close button.




Discussion / hints:
<!-- blocked/need-repro -->

Hello @zoy-l. Thanks for reporting this and helping to make Electron better!

Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, [Electron Fiddle](https://www.electronjs.org/fiddle) is a great tool for making small test cases and makes it easy to publish your test case to a [gist](https://gist.github.com) that Electron maintainers can use.

Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.

Now adding the https://github.com/electron/electron/labels/blocked%2Fneed-repro label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.
The test case URL has been added.
The relevant part from the linked repo:

```js
	const mainWindow = new BrowserWindow({
		titleBarStyle: 'hidden',
		titleBarOverlay:{
			color: '#666666',
			height: 30,
			symbolColor: '#999999'
		},
		show: true,
	});
```
@zoy-l how are you hiding the window? When i click the minimize button and then unminimize the rounded corners are present just as expected.
@codebytere 
I mean that the rounded corners disappear in an instant when closing, just like in the gif above, it's only for a moment.
```js 
mainWindow.addListener('close', (event) => {
	event.preventDefault();
	mainWindow.hide();
})
```
Here is the normal situation.
![Image](https://github.com/user-attachments/assets/1026c224-376a-4e09-83a1-41e2f236e90c)

```js
const mainWindow = new BrowserWindow({
	show: true,
});
```
These are process images of two different closing scenarios.
<img src="https://github.com/user-attachments/assets/bc015240-d88b-439d-942c-7440f9d539db" width="300" height="200">
<img src="https://github.com/user-attachments/assets/16f6fb14-f217-4bb6-b788-903a0391ef89" width="300" height="200">

Found a temporary solution: setting `backgroundMaterial` to a non-none value can resolve this issue, so this may not be a bug...But the maximize button animation is gone.

Fix patch:
diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc
index 62b3c07cf0e98..c3bcb4bf4dd4c 100644
--- a/shell/browser/native_window_views.cc
+++ b/shell/browser/native_window_views.cc
@@ -381,8 +381,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
 
     bool rounded_corner = true;
     options.Get(options::kRoundedCorners, &rounded_corner);
-    if (!rounded_corner)
-      SetRoundedCorners(false);
+    SetRoundedCorners(rounded_corner);
   }
 
   LONG ex_style = ::GetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE);


Test patch: