### Preflight Checklist

- [X] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/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 feature request that matches the one I want to file, without success.

### Electron Version

12.0.4

### What operating system are you using?

Other Linux

### Operating System Version

Fedora

### What arch are you using?

x64

### Last Known Working Electron version

11.4.3

### Expected Behavior

Events should fire for maximizing or unmaximizing a browserwindow.

### Actual Behavior

They don't, since the V12 release. It works fine in Electron 11 and below. See the fiddle console, it should log `max` and `unmax` when you toggle the maximization state, but it doesn't in Electron 12. One weird thing is, that when you maximize the window, and then go to fullscreen, it will emit `max`, but even when leaving fullscreen or unmaximizing the window, you will never see `unmax`. Not that fullscreen should have anything to do with the maximize event, but I noticed it does, so I thought I would mention that. You can see in the screenshot below that it only logs `max` (after going fullscreen), which shouldn't be possible if the events would fire correctly, as it should alternate `max`, `unmax`, `max` etc.
![image](https://user-images.githubusercontent.com/1696674/115083591-e75ab100-9f07-11eb-9334-5b65f80a0567.png)
And this is what happens in Electron 11.4.3:
![image](https://user-images.githubusercontent.com/1696674/115083718-1d983080-9f08-11eb-92af-ce8e6742b769.png)
When not entering fullscreen in V12, the logs remains empty, the ONLY way to make it trigger the `max` event is by maximizing and then going fullscreen, but it never triggers `unmax`.

### Testcase Gist URL

https://gist.github.com/Jelmerro/5a5a8b0cfcf69a24993b47bd7526d242
shell/browser/ui/x/window_state_watcher.cc
: window_(window),
      widget_(window->GetAcceleratedWidget()),
      net_wm_state_atom_(x11::GetAtom("_NET_WM_STATE")),
      net_wm_state_hidden_atom_(x11::GetAtom("_NET_WM_STATE_HIDDEN")),
      net_wm_state_maximized_vert_atom_(
          x11::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT")),
      net_wm_state_maximized_horz_atom_(
          x11::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")),
      net_wm_state_fullscreen_atom_(x11::GetAtom("_NET_WM_STATE_FULLSCREEN")) {
  ui::X11EventSource::GetInstance()->connection()->AddEventObserver(this);
}
WindowStateWatcher::~WindowStateWatcher() {
  ui::X11EventSource::GetInstance()->connection()->RemoveEventObserver(this);
}
void WindowStateWatcher::OnEvent(const x11::Event& x11_event) {
  if (IsWindowStateEvent(x11_event)) {
    const bool was_minimized_ = window_->IsMinimized();
    const bool was_maximized_ = window_->IsMaximized();
    std::vector<x11::Atom> wm_states;
    if (GetArrayProperty(
            static_cast<x11::Window>(window_->GetAcceleratedWidget()),
            net_wm_state_atom_, &wm_states)) {
      const auto props =
          base::flat_set<x11::Atom>(std::begin(wm_states), std::end(wm_states));
      const bool is_minimized = props.contains(net_wm_state_hidden_atom_);
      const bool is_maximized =
          props.contains(net_wm_state_maximized_vert_atom_) &&
          props.contains(net_wm_state_maximized_horz_atom_);
      const bool is_fullscreen = props.contains(net_wm_state_fullscreen_atom_);
      if (is_minimized != was_minimized_) {