From 4b8b4ef91c3e25fa336a29093a7ccb5b9bd23ef3 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 18 Sep 2012 17:15:13 -0700 Subject: [PATCH] A hack to get DevTools showing properly --- native/atom_window_controller.mm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/native/atom_window_controller.mm b/native/atom_window_controller.mm index de2e5e117..3322b2253 100644 --- a/native/atom_window_controller.mm +++ b/native/atom_window_controller.mm @@ -106,13 +106,19 @@ _devToolsView = [[NSView alloc] initWithFrame:_splitView.bounds]; [_splitView addSubview:_devToolsView]; [_splitView adjustSubviews]; - - _cefDevToolsClient = new AtomCefClient(); - std::string devtools_url = _cefClient->GetBrowser()->GetHost()->GetDevToolsURL(true); - [self addBrowserToView:_devToolsView url:devtools_url.c_str() cefHandler:_cefDevToolsClient]; + [self performSelector:@selector(attachDevTools) withObject:nil afterDelay:0]; } } +// If this is run directly after adding _devToolsView to _splitView, the +// devtools don't resize properly. +// HACK: I hate this and want to place this code directly in showDevTools +- (void)attachDevTools { + _cefDevToolsClient = new AtomCefClient(); + std::string devtools_url = _cefClient->GetBrowser()->GetHost()->GetDevToolsURL(true); + [self addBrowserToView:_devToolsView url:devtools_url.c_str() cefHandler:_cefDevToolsClient]; +} + - (void)hideDevTools { [_devToolsView removeFromSuperview]; [_splitView adjustSubviews];