Revert window key status detection method change
Moderate
Commit Hash:
c16aa8975d8235c42f1d01a306ee31098e29d3ca
Commit Time: 2025-11-14 18:27:39+00:00
Impact Level: Moderate
Generated By: webview2-upstream-sentry
Upstream Review:
View Upstream Review π
π Summary
This commit reverts a change that modified the window focus status detection logic. The original change replaced the condition check in the
windowDidResignKey: method from [NSApp keyWindow] == [self window] to [self window].isKeyWindow, aiming to fix timing issues in focus state detection when clicking notifications in multi-window scenarios. However, this modification broke π― Impact Analysis
This rollback has a moderate impact on WebView2Mac. The affected code is in the
Detailed impact analysis:
1. **Window Focus Management**: WebView2Mac relies on Remote Cocoa's window focus management mechanism to correctly handle window activation/deactivation events. This rollback changes how focus status is detected, potentially affecting WebView2Mac's behavior in:
- Focus switching in multi-window applications
- Focus state during system notification interactions
- WebContents focus state synchronization
2. **Potential Timing Issues**: The original change attempted to fix an issue where
windowDidResignKey: method in content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm, which is a core method in the Remote Cocoa framework for handling window focus loss events.Detailed impact analysis:
1. **Window Focus Management**: WebView2Mac relies on Remote Cocoa's window focus management mechanism to correctly handle window activation/deactivation events. This rollback changes how focus status is detected, potentially affecting WebView2Mac's behavior in:
- Focus switching in multi-window applications
- Focus state during system notification interactions
- WebContents focus state synchronization
2. **Potential Timing Issues**: The original change attempted to fix an issue where
[NSApp keyWindow] might still point to the old window when the windowDidResignKey notification is sent during notification clicks, causing incorrect focus stateε€ζ. After the rollback, this timing issue may resurface, but the rollback was necessary because the original fix broke Impacted Classes:
RenderWidgetHostViewCocoa
remote_cocoa::mojom::RenderWidgetHostNSViewHost