]> khamidou — GitHub mirrors - electron.git/commitdiff
Call WasShown when showing window
authorCheng Zhao <zcbenz@gmail.com>
Thu, 24 Sep 2015 10:15:57 +0000 (18:15 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 24 Sep 2015 10:16:41 +0000 (18:16 +0800)
Otherwise WebContents would be invisible when window is hidden at first
and then show later.

Refs #2879.

atom/browser/native_window_mac.mm
atom/browser/native_window_views.cc

index 9555914c899d82a806b77f7113758e081e79b9ef..6a99f1cf42271c5630ed2c6566dcb4163029d022 100644 (file)
@@ -467,6 +467,8 @@ bool NativeWindowMac::IsFocused() {
 }
 
 void NativeWindowMac::Show() {
+  web_contents()->WasShown();
+
   // This method is supposed to put focus on window, however if the app does not
   // have focus then "makeKeyAndOrderFront" will only show the window.
   [NSApp activateIgnoringOtherApps:YES];
@@ -475,11 +477,13 @@ void NativeWindowMac::Show() {
 }
 
 void NativeWindowMac::ShowInactive() {
+  web_contents()->WasShown();
   [window_ orderFrontRegardless];
 }
 
 void NativeWindowMac::Hide() {
   [window_ orderOut:nil];
+  web_contents()->WasHidden();
 }
 
 bool NativeWindowMac::IsVisible() {
index 45697c96683c402ddbdfbe432e9e68e9563438d2..70707219f3f236e2a76c8fb98f6a58aa0dcbeb22 100644 (file)
@@ -338,15 +338,18 @@ bool NativeWindowViews::IsFocused() {
 }
 
 void NativeWindowViews::Show() {
+  web_contents()->WasShown();
   window_->native_widget_private()->ShowWithWindowState(GetRestoredState());
 }
 
 void NativeWindowViews::ShowInactive() {
+  web_contents()->WasShown();
   window_->ShowInactive();
 }
 
 void NativeWindowViews::Hide() {
   window_->Hide();
+  web_contents()->WasHidden();
 }
 
 bool NativeWindowViews::IsVisible() {