Revert window key status detection method change
Moderate
提交哈希:
c16aa8975d8235c42f1d01a306ee31098e29d3ca
提交时间: 2025-11-14 18:27:39+00:00
影响等级: Moderate
生成工具: webview2-upstream-sentry
上游审核链接:
查看上游审核 🔗
📋 摘要
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 🎯 影响分析
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 受影响的类:
RenderWidgetHostViewCocoa
remote_cocoa::mojom::RenderWidgetHostNSViewHost