mac: Make sure web view is the first responder of window, fixes #382.
This commit is contained in:
parent
4aa217970e
commit
b431566421
1 changed files with 8 additions and 0 deletions
|
@ -29,6 +29,7 @@ static const CGFloat kAtomWindowCornerRadius = 4.0;
|
||||||
@private
|
@private
|
||||||
atom::NativeWindowMac* shell_;
|
atom::NativeWindowMac* shell_;
|
||||||
BOOL acceptsFirstMouse_;
|
BOOL acceptsFirstMouse_;
|
||||||
|
BOOL hasSetInitialFocus_;
|
||||||
}
|
}
|
||||||
- (id)initWithShell:(atom::NativeWindowMac*)shell;
|
- (id)initWithShell:(atom::NativeWindowMac*)shell;
|
||||||
- (void)setAcceptsFirstMouse:(BOOL)accept;
|
- (void)setAcceptsFirstMouse:(BOOL)accept;
|
||||||
|
@ -40,6 +41,7 @@ static const CGFloat kAtomWindowCornerRadius = 4.0;
|
||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
shell_ = shell;
|
shell_ = shell;
|
||||||
acceptsFirstMouse_ = NO;
|
acceptsFirstMouse_ = NO;
|
||||||
|
hasSetInitialFocus_ = NO;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -50,6 +52,12 @@ static const CGFloat kAtomWindowCornerRadius = 4.0;
|
||||||
|
|
||||||
- (void)windowDidBecomeMain:(NSNotification*)notification {
|
- (void)windowDidBecomeMain:(NSNotification*)notification {
|
||||||
shell_->NotifyWindowFocus();
|
shell_->NotifyWindowFocus();
|
||||||
|
|
||||||
|
// Make sure the web view is the first responder of the window.
|
||||||
|
if (!hasSetInitialFocus_) {
|
||||||
|
shell_->GetWebContents()->GetView()->Focus();
|
||||||
|
hasSetInitialFocus_ = YES;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidResignMain:(NSNotification*)notification {
|
- (void)windowDidResignMain:(NSNotification*)notification {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue