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..29f2bedce74352de1e508b71115890e4db120b40 100644 |
--- a/chrome/browser/ui/cocoa/base_bubble_controller.mm |
+++ b/chrome/browser/ui/cocoa/base_bubble_controller.mm |
@@ -241,15 +241,17 @@ |
// 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]; |
- } |
+ // Do it right now, because if this event is right mouse event, |
+ // it may pop up a menu. windowDidResignKey will not exec untill |
Nico
2014/05/28 08:50:15
typo "until"
Robert Sesek
2014/05/28 19:47:03
nit: add a : after windowDidResignKey (it's part o
|
+ // the menu is closed. |
+ if ([self respondsToSelector:@selector(windowDidResignKey:)]) { |
+ [self windowDidResignKey:note]; |
Nico
2014/05/28 08:50:15
nit: this should be indented only 2 relative to th
|
+ } |
+ } |
return event; |
}]; |