fix: ensure maximize is emitted when reduce motion is enabled on macOS (#46466)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
This commit is contained in:
trop[bot] 2025-04-03 11:26:32 -07:00 committed by GitHub
parent 3acd5774da
commit 30ccda8ba0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -221,6 +221,12 @@ using FullScreenTransitionState =
[super windowDidResize:notification];
shell_->NotifyWindowResize();
shell_->RedrawTrafficLights();
// When reduce motion is enabled windowDidResize is only called once after
// a resize and windowDidEndLiveResize is not called. So we need to call
// handleZoomEnd here as well.
if (NSWorkspace.sharedWorkspace.accessibilityDisplayShouldReduceMotion) {
[self handleZoomEnd];
}
}
- (void)windowWillMove:(NSNotification*)notification {
@ -276,9 +282,7 @@ using FullScreenTransitionState =
return YES;
}
- (void)windowDidEndLiveResize:(NSNotification*)notification {
resizingHorizontally_.reset();
shell_->NotifyWindowResized();
- (void)handleZoomEnd {
if (is_zooming_) {
if (shell_->IsMaximized())
shell_->NotifyWindowMaximize();
@ -288,6 +292,12 @@ using FullScreenTransitionState =
}
}
- (void)windowDidEndLiveResize:(NSNotification*)notification {
resizingHorizontally_.reset();
shell_->NotifyWindowResized();
[self handleZoomEnd];
}
- (void)windowWillEnterFullScreen:(NSNotification*)notification {
// Store resizable mask so it can be restored after exiting fullscreen.
is_resizable_ = shell_->HasStyleMask(NSWindowStyleMaskResizable);