diff --git a/native/atom_cef_client.cpp b/native/atom_cef_client.cpp index e36215144..41a0c2383 100644 --- a/native/atom_cef_client.cpp +++ b/native/atom_cef_client.cpp @@ -76,6 +76,9 @@ bool AtomCefClient::OnProcessMessageReceived(CefRefPtr browser, else if (name == "endTracing") { EndTracing(); } + else if (name == "show") { + Show(browser); + } else { return false; } @@ -235,4 +238,4 @@ bool AtomCefClient::Save(const std::string& path, const std::string& data) { fwrite(data.c_str(), data.size(), 1, f); fclose(f); return true; -} \ No newline at end of file +} diff --git a/native/atom_cef_client.h b/native/atom_cef_client.h index 92c3784bb..75b787138 100644 --- a/native/atom_cef_client.h +++ b/native/atom_cef_client.h @@ -122,6 +122,7 @@ class AtomCefClient : public CefClient, CefRefPtr CreateReplyDescriptor(int replyId, int callbackIndex); void Exit(int status); void Log(const char *message); + void Show(CefRefPtr browser); IMPLEMENT_REFCOUNTING(AtomCefClient); IMPLEMENT_LOCKING(AtomCefClient); diff --git a/native/atom_cef_client_mac.mm b/native/atom_cef_client_mac.mm index 628017009..c20bd5fbe 100644 --- a/native/atom_cef_client_mac.mm +++ b/native/atom_cef_client_mac.mm @@ -95,6 +95,11 @@ void AtomCefClient::ShowDevTools(CefRefPtr browser) { [windowController showDevTools]; } +void AtomCefClient::Show(CefRefPtr browser) { + AtomWindowController *windowController = [[browser->GetHost()->GetWindowHandle() window] windowController]; + [windowController.webView setHidden:NO]; +} + void AtomCefClient::ShowSaveDialog(int replyId, CefRefPtr browser) { CefRefPtr replyMessage = CefProcessMessage::Create("reply"); CefRefPtr replyArguments = replyMessage->GetArgumentList(); @@ -127,4 +132,4 @@ void AtomCefClient::Exit(int status) { void AtomCefClient::Log(const char *message) { std::cout << message << "\n"; -} \ No newline at end of file +} diff --git a/native/atom_window_controller.mm b/native/atom_window_controller.mm index 60d54d4d8..785d85071 100644 --- a/native/atom_window_controller.mm +++ b/native/atom_window_controller.mm @@ -41,6 +41,8 @@ if (!background) { [self setShouldCascadeWindows:NO]; [self setWindowFrameAutosaveName:@"AtomWindow"]; + NSColor *background = [NSColor colorWithCalibratedRed:(51.0/255.0) green:(51.0/255.0f) blue:(51.0/255.0f) alpha:1.0]; + [self.window setBackgroundColor:background]; [self showWindow:self]; } @@ -116,6 +118,7 @@ [urlString appendFormat:@"&pathToOpen=%@", [self encodeUrlParam:_pathToOpen]]; _cefClient = new AtomCefClient(); + [self.webView setHidden:YES]; [self addBrowserToView:self.webView url:[urlString UTF8String] cefHandler:_cefClient]; } diff --git a/src/app/atom.coffee b/src/app/atom.coffee index 8f02a3db0..ee5c8a442 100644 --- a/src/app/atom.coffee +++ b/src/app/atom.coffee @@ -75,6 +75,9 @@ _.extend atom, focus: -> @sendMessageToBrowserProcess('focus') + show: -> + @sendMessageToBrowserProcess('show') + exit: (status) -> @sendMessageToBrowserProcess('exit', [status]) diff --git a/src/window-bootstrap.coffee b/src/window-bootstrap.coffee index 5720d9af9..fa815e832 100644 --- a/src/window-bootstrap.coffee +++ b/src/window-bootstrap.coffee @@ -4,3 +4,4 @@ require 'window' pathToOpen = atom.getWindowState('pathToOpen') ? window.location.params.pathToOpen window.attachRootView(pathToOpen) +atom.show()