From 3343975488e0ca28370aedd9a74be0b45d942d21 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Thu, 3 Apr 2025 11:26:48 -0700 Subject: [PATCH] fix: ensure maximize is emitted when reduce motion is enabled on macOS (#46465) Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard --- .../ui/cocoa/electron_ns_window_delegate.mm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/shell/browser/ui/cocoa/electron_ns_window_delegate.mm b/shell/browser/ui/cocoa/electron_ns_window_delegate.mm index 3f7c689bfc8b..04fa6781dd1f 100644 --- a/shell/browser/ui/cocoa/electron_ns_window_delegate.mm +++ b/shell/browser/ui/cocoa/electron_ns_window_delegate.mm @@ -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);