| Index: chrome/browser/cocoa/chrome_event_processing_window.mm
|
| diff --git a/chrome/browser/cocoa/chrome_event_processing_window.mm b/chrome/browser/cocoa/chrome_event_processing_window.mm
|
| index 8633c1c2f81bf319863d6838685e02d4bd0d938d..c1b270f68280483923d5223f32265ffaf60d1eb0 100644
|
| --- a/chrome/browser/cocoa/chrome_event_processing_window.mm
|
| +++ b/chrome/browser/cocoa/chrome_event_processing_window.mm
|
| @@ -50,10 +50,30 @@ typedef int (*KeyToCommandMapper)(bool, bool, bool, int);
|
| fromTable:CommandForBrowserKeyboardShortcut];
|
| }
|
|
|
| +- (BOOL)shortcircuitEvent:(NSEvent*)event {
|
| + if (!redispatchingEvent_ &&
|
| + ([event type] == NSKeyDown || [event type] == NSKeyUp)) {
|
| + if ([[self firstResponder]
|
| + isKindOfClass:[RenderWidgetHostViewCocoa class]]) {
|
| + // No other mac browser sends keyup() for keyboard equivalents, so let's
|
| + // suppress this.
|
| + if (([event modifierFlags] & NSCommandKeyMask) && [event type] == NSKeyUp)
|
| + return YES;
|
| +
|
| + RenderWidgetHostViewCocoa* rwhv = static_cast<RenderWidgetHostViewCocoa*>(
|
| + [self firstResponder]);
|
| + [rwhv keyEvent:event];
|
| + return YES;
|
| + }
|
| + }
|
| + return NO;
|
| +}
|
| +
|
| - (BOOL)performKeyEquivalent:(NSEvent*)event {
|
| - // We have some magic in |CrApplication sendEvent:| that always sends key
|
| - // events to |RWHVCocoa keyEvent:| so that cocoa doesn't have a chance to
|
| - // intercept it.
|
| + if (redispatchingEvent_)
|
| + return NO;
|
| +
|
| + // |shortcircuitEvent:| should handle all events directed to the RWHV.
|
| DCHECK(![[self firstResponder]
|
| isKindOfClass:[RenderWidgetHostViewCocoa class]]);
|
|
|
| @@ -66,5 +86,17 @@ typedef int (*KeyToCommandMapper)(bool, bool, bool, int);
|
| return [super performKeyEquivalent:event];
|
| }
|
|
|
| +- (void)redispatchEvent:(NSEvent*)event {
|
| + DCHECK([event window] == self);
|
| + redispatchingEvent_ = YES;
|
| + [NSApp sendEvent:event];
|
| + redispatchingEvent_ = NO;
|
| +}
|
| +
|
| +- (void)sendEvent:(NSEvent*)event {
|
| + if (!redispatchingEvent_)
|
| + [super sendEvent:event];
|
| +}
|
| +
|
| @end // ChromeEventProcessingWindow
|
|
|
|
|