electron/shell/browser/ui/cocoa
Keeley Hammond cb7eb6fe3d
fix: Update widget visibility in NativeWindowMac::ShowInactive (#45502)
When using `views::WebView` on macOS `NativeWidgetMacNSWindowHost`
contains a layer and compositor responsible for drawing web contents.
To trigger drawing `NativeWidgetMacNSWindowHost::OnVisibilityChanged`
needs to be called and `[NSWindow orderFrontRegardless]` does not trigger
`[NSWindow orderWindow:relativeTo:]` which can change
`NativeWidgetMacNSWindowHost` visiblity with stack:
```
views::NativeWidgetMacNSWindowHost::OnVisibilityChanged(bool)
remote_cocoa::NativeWidgetNSWindowBridge::OnVisibilityChanged()
-[ViewsNSWindowDelegate onWindowOrderChanged:]
-[NativeWidgetMacNSWindow orderWindow:relativeTo:]
```
`views::Widget` has method for showing inactive window:
`views::Widget::ShowInactive` which triggers
`NativeWidgetMacNSWindowHost::OnVisibilityChanged` with stack:
```
views::NativeWidgetMacNSWindowHost::OnVisibilityChanged(bool)
remote_cocoa::NativeWidgetNSWindowBridge::SetVisibilityState(remote_cocoa::mojom::WindowVisibilityState)
views::NativeWidgetMacNSWindowHost::SetVisibilityState(remote_cocoa::mojom::WindowVisibilityState)
views::NativeWidgetMac::Show(ui::mojom::WindowShowState, gfx::Rect const&)
views::Widget::ShowInactive() + 168
```
However this call seems to be insufficient to bring window to front,
therefore `[NSWindow orderFrontRegardless]` still needs to be called.
Calling `views::Widget::ShowInactive` ensures that all logic related to
showing Chromium widget will be properly executed, but onfortunately it
does not call `[NSWindow orderWindow:relativeTo:]` which is used to
disabling headless mode by the `ElectronNSWindow`, therefore we need to
trigger it manually through exposed `[ElectronNSWindow disableHeadlessMode]`.

Fixes: #45415

Co-authored-by: Michał Pichliński <michal.pichlinski@here.io>
2025-02-06 18:40:59 -08:00
..
electron_bundle_mover.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
electron_bundle_mover.mm chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
electron_menu_controller.h fix: recentDocuments on macOS not working (#41978) 2024-04-29 19:07:14 -04:00
electron_menu_controller.mm chore: remove unused base/ includes (#43688) 2024-09-12 16:05:37 +02:00
electron_native_widget_mac.h chore: bump chromium to 116.0.5829.0 (main) (#38726) 2023-06-13 14:45:48 -04:00
electron_native_widget_mac.mm chore: bump chromium to 117.0.5923.0 (main) (#39304) 2023-08-04 10:47:29 +02:00
electron_ns_panel.h feat: add panel support for BrowserWindow (#34388) 2022-06-14 12:24:52 -04:00
electron_ns_panel.mm chore: fix spelling errors in multiple files (#34574) 2022-06-16 16:46:11 +09:00
electron_ns_window.h fix: Update widget visibility in NativeWindowMac::ShowInactive (#45502) 2025-02-06 18:40:59 -08:00
electron_ns_window.mm fix: Update widget visibility in NativeWindowMac::ShowInactive (#45502) 2025-02-06 18:40:59 -08:00
electron_ns_window_delegate.h chore: replace absl::optional<T> with std::optional<T> (#40928) 2024-01-10 16:23:35 -06:00
electron_ns_window_delegate.mm refactor: remove InspectableWebContentsViewMac in favor of the Views version (#45238) 2025-01-23 11:54:15 +01:00
electron_preview_item.h chore: add ELECTRON_ prefix to C++ include guards (#31925) 2021-11-22 16:34:31 +09:00
electron_preview_item.mm
electron_touch_bar.h chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
electron_touch_bar.mm chore: more iwyu (#43063) 2024-07-29 12:42:57 -05:00
event_dispatching_window.h chore: bump chromium to 115.0.5760.0 (main) (#38033) 2023-05-10 10:47:48 -04:00
event_dispatching_window.mm chore: bump chromium to 104.0.5073.0 (main) (#34272) 2022-06-01 08:12:47 +02:00
NSString+ANSI.h chore: add ELECTRON_ prefix to C++ include guards (#31925) 2021-11-22 16:34:31 +09:00
NSString+ANSI.mm chore: bump chromium to 117.0.5923.0 (main) (#39304) 2023-08-04 10:47:29 +02:00
root_view_mac.h feat: replace BrowserView with WebContentsView (#35658) 2023-12-13 13:01:03 -08:00
root_view_mac.mm feat: replace BrowserView with WebContentsView (#35658) 2023-12-13 13:01:03 -08:00
views_delegate_mac.h chore: add ELECTRON_ prefix to C++ include guards (#31925) 2021-11-22 16:34:31 +09:00
views_delegate_mac.mm chore: use =default for default constructors/destructors (#29511) 2021-06-04 13:16:13 +09:00
window_buttons_proxy.h chore: replace absl::optional<T> with std::optional<T> (#40928) 2024-01-10 16:23:35 -06:00
window_buttons_proxy.mm chore: remove unused base/ includes (#43688) 2024-09-12 16:05:37 +02:00