Repository: electron/electron (language: cpp)

Issue:
[Bug]: 'restore' event not emitted after minimize and maximize application
### 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

19.0.1

### What operating system are you using?

Windows

### Operating System Version

Windows 10 Pro 21H1

### What arch are you using?

x64

### Last Known Working Electron version

_No response_

### Expected Behavior

Event 'restore' should notify to application

### Actual Behavior

After clicking maximize application, the event 'restore' does not notify after minimize

`
BrowserWindow.on( 'restore', () => { // nothing happend });
`

### Testcase Gist URL

_No response_

### Additional Information

_No response_


Discussion / hints:
Thanks for reporting this and helping to make Electron better!

Because of time constraints, triaging code with third-party dependencies is usually not feasible for a small team like Electron's.

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.

I'm adding the `blocked/need-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.
@codebytere  fiddle here https://gist.github.com/75b80d682f9408b56bbf534f57b23072
take care **main.js**

`
// nothing show after click maximize

  mainWindow.on( 'restore', () => console.log('restore') )
`

Fix patch:
diff --git a/shell/browser/native_window_views_win.cc b/shell/browser/native_window_views_win.cc
index dc6f089d06bf6..e4288d047c304 100644
--- a/shell/browser/native_window_views_win.cc
+++ b/shell/browser/native_window_views_win.cc
@@ -413,6 +413,8 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
       // multiple times for one resize because of the SetWindowPlacement call.
       if (w_param == SIZE_MAXIMIZED &&
           last_window_state_ != ui::SHOW_STATE_MAXIMIZED) {
+        if (last_window_state_ == ui::SHOW_STATE_MINIMIZED)
+          NotifyWindowRestore();
         last_window_state_ = ui::SHOW_STATE_MAXIMIZED;
         NotifyWindowMaximize();
         ResetWindowControls();


Test patch: