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];