Mac: Avoid re-entering OnSetFocus in becomeFirstResponder (issue #508).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@692 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
15c579aa77
commit
315414ec26
|
@ -26,6 +26,7 @@
|
|||
@interface CefBrowserHostView : NSView {
|
||||
@private
|
||||
CefBrowserHostImpl* browser_; // weak
|
||||
bool is_in_onsetfocus_;
|
||||
}
|
||||
|
||||
@property (nonatomic, assign) CefBrowserHostImpl* browser;
|
||||
|
@ -50,8 +51,14 @@
|
|||
}
|
||||
|
||||
- (BOOL)becomeFirstResponder {
|
||||
if (browser_ && browser_->GetWebContents())
|
||||
browser_->OnSetFocus(FOCUS_SOURCE_SYSTEM);
|
||||
if (browser_ && browser_->GetWebContents()) {
|
||||
// Avoid re-entering OnSetFocus.
|
||||
if (!is_in_onsetfocus_) {
|
||||
is_in_onsetfocus_ = true;
|
||||
browser_->OnSetFocus(FOCUS_SOURCE_SYSTEM);
|
||||
is_in_onsetfocus_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue