mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Show window only after root view is attached
This prevents a white flicker when the page starts to load.
This commit is contained in:
@@ -76,6 +76,9 @@ bool AtomCefClient::OnProcessMessageReceived(CefRefPtr<CefBrowser> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,6 +122,7 @@ class AtomCefClient : public CefClient,
|
||||
CefRefPtr<CefListValue> CreateReplyDescriptor(int replyId, int callbackIndex);
|
||||
void Exit(int status);
|
||||
void Log(const char *message);
|
||||
void Show(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
IMPLEMENT_REFCOUNTING(AtomCefClient);
|
||||
IMPLEMENT_LOCKING(AtomCefClient);
|
||||
|
||||
@@ -95,6 +95,11 @@ void AtomCefClient::ShowDevTools(CefRefPtr<CefBrowser> browser) {
|
||||
[windowController showDevTools];
|
||||
}
|
||||
|
||||
void AtomCefClient::Show(CefRefPtr<CefBrowser> browser) {
|
||||
AtomWindowController *windowController = [[browser->GetHost()->GetWindowHandle() window] windowController];
|
||||
[windowController.webView setHidden:NO];
|
||||
}
|
||||
|
||||
void AtomCefClient::ShowSaveDialog(int replyId, CefRefPtr<CefBrowser> browser) {
|
||||
CefRefPtr<CefProcessMessage> replyMessage = CefProcessMessage::Create("reply");
|
||||
CefRefPtr<CefListValue> replyArguments = replyMessage->GetArgumentList();
|
||||
@@ -127,4 +132,4 @@ void AtomCefClient::Exit(int status) {
|
||||
|
||||
void AtomCefClient::Log(const char *message) {
|
||||
std::cout << message << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user