mac: Fix crash when closing window, closes #504.
This commit is contained in:
parent
6c866ea909
commit
53c73c0631
1 changed files with 12 additions and 8 deletions
|
@ -52,11 +52,13 @@ static const CGFloat kAtomWindowCornerRadius = 4.0;
|
||||||
- (void)windowDidBecomeMain:(NSNotification*)notification {
|
- (void)windowDidBecomeMain:(NSNotification*)notification {
|
||||||
shell_->NotifyWindowFocus();
|
shell_->NotifyWindowFocus();
|
||||||
|
|
||||||
if (shell_->GetWebContents())
|
content::WebContents* web_contents = shell_->GetWebContents();
|
||||||
shell_->GetWebContents()->GetView()->StoreFocus();
|
if (!web_contents)
|
||||||
|
return;
|
||||||
|
|
||||||
content::RenderWidgetHostView* rwhv =
|
web_contents->GetView()->RestoreFocus();
|
||||||
shell_->GetWebContents()->GetRenderWidgetHostView();
|
|
||||||
|
content::RenderWidgetHostView* rwhv = web_contents->GetRenderWidgetHostView();
|
||||||
if (rwhv)
|
if (rwhv)
|
||||||
rwhv->SetActive(true);
|
rwhv->SetActive(true);
|
||||||
}
|
}
|
||||||
|
@ -64,11 +66,13 @@ static const CGFloat kAtomWindowCornerRadius = 4.0;
|
||||||
- (void)windowDidResignMain:(NSNotification*)notification {
|
- (void)windowDidResignMain:(NSNotification*)notification {
|
||||||
shell_->NotifyWindowBlur();
|
shell_->NotifyWindowBlur();
|
||||||
|
|
||||||
if (shell_->GetWebContents())
|
content::WebContents* web_contents = shell_->GetWebContents();
|
||||||
shell_->GetWebContents()->GetView()->StoreFocus();
|
if (!web_contents)
|
||||||
|
return;
|
||||||
|
|
||||||
content::RenderWidgetHostView* rwhv =
|
web_contents->GetView()->StoreFocus();
|
||||||
shell_->GetWebContents()->GetRenderWidgetHostView();
|
|
||||||
|
content::RenderWidgetHostView* rwhv = web_contents->GetRenderWidgetHostView();
|
||||||
if (rwhv)
|
if (rwhv)
|
||||||
rwhv->SetActive(false);
|
rwhv->SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue