#54990: fix: report the new state in fullscreen events on Windows
Description of Change
On Windows, win.isFullScreen() (and win.fullScreen) returned the old value inside an enter-full-screen or leave-full-screen listener, so a listener had to defer a tick before it could read the state it was just told about.
NativeWindowViews::SetFullScreen() notified observers before it called widget()->SetFullscreen(). The comment there says the order is needed to handle the size event correctly, but what HandleSizeEvent() reads is last_window_state_, which is still set first. Only the notification moves, to after the widget is in the new state. The path for windows without a thick frame, which resizes to the display instead, notifies after its resize in the same way.
One visible consequence: on Windows resize is now emitted before enter-full-screen / leave-full-screen instead of after, which matches macOS and Linux.
I could not build or run this locally (Windows only); the new spec in the Windows Fullscreen state block reads the state from inside both listeners.
Checklist
- PR description included
- I have built and tested this change
-
npm testpasses - tests are changed or added
- PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, past tense, and no longer than 80 characters.
Release Notes
Notes: Fixed win.isFullScreen() being stale in fullscreen events on Windows.
Backports
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron