fix: fire close event upon closing modal BrowserWindow in macOS (#19014)

* fix: emit close event from modal on macOS

* fix: Move fn call to correct spot

* refactor: call notify fn directly
This commit is contained in:
Erick Zhao 2019-06-30 19:57:31 -07:00 committed by Cheng Zhao
parent f62d9f1411
commit cc223d7cd2

View file

@ -492,6 +492,8 @@ void NativeWindowMac::Close() {
// When this is a sheet showing, performClose won't work. // When this is a sheet showing, performClose won't work.
if (is_modal() && parent() && IsVisible()) { if (is_modal() && parent() && IsVisible()) {
[parent()->GetNativeWindow().GetNativeNSWindow() endSheet:window_]; [parent()->GetNativeWindow().GetNativeNSWindow() endSheet:window_];
// Manually emit close event (not triggered from close fn)
NotifyWindowCloseButtonClicked();
CloseImmediately(); CloseImmediately();
return; return;
} }