Chromium Code Reviews| Index: chrome/browser/ui/cocoa/base_bubble_controller.mm |
| diff --git a/chrome/browser/ui/cocoa/base_bubble_controller.mm b/chrome/browser/ui/cocoa/base_bubble_controller.mm |
| index 6dc573696ead2092213d8890b6db9d917a2d2f5f..a1ac426bbce3b5da0406643cd1ed1c4208cf094f 100644 |
| --- a/chrome/browser/ui/cocoa/base_bubble_controller.mm |
| +++ b/chrome/browser/ui/cocoa/base_bubble_controller.mm |
| @@ -241,16 +241,18 @@ |
| // The eventTap_ catches clicks within the application that are outside the |
| // window. |
| eventTap_ = [NSEvent |
| - addLocalMonitorForEventsMatchingMask:NSLeftMouseDownMask |
| + addLocalMonitorForEventsMatchingMask:NSLeftMouseDownMask | |
| + NSRightMouseDownMask |
| handler:^NSEvent* (NSEvent* event) { |
| if (event.window != window) { |
| - // Call via the runloop because this block is called in the |
| - // middle of event dispatch. |
| - [self performSelector:@selector(windowDidResignKey:) |
| - withObject:note |
| - afterDelay:0]; |
| - } |
| - return event; |
| + // Do it right now, because if this event is right mouse event, |
| + // it may pop up a menu. windowDidResignKey: will not run until |
| + // the menu is closed. |
| + if ([self respondsToSelector:@selector(windowDidResignKey:)]) { |
| + [self windowDidResignKey:note]; |
| + } |
| + } |
|
Robert Sesek
2014/06/06 14:00:34
nit: this should line up with the |if| above on li
|
| + return event; |
| }]; |
| // The resignationObserver_ watches for when a window resigns key state, |