Skip to content

Instantly share code, notes, and snippets.

@mblsha
Created November 11, 2016 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mblsha/44bd5f0609c2f0b6c73077ccf310befc to your computer and use it in GitHub Desktop.
Save mblsha/44bd5f0609c2f0b6c73077ccf310befc to your computer and use it in GitHub Desktop.
diff --git a/chrome/browser/ui/cocoa/chrome_command_dispatcher_delegate.mm b/chrome/browser/ui/cocoa/chrome_command_dispatcher_delegate.mm
index 6d3cd88..88ad53c 100644
--- a/chrome/browser/ui/cocoa/chrome_command_dispatcher_delegate.mm
+++ b/chrome/browser/ui/cocoa/chrome_command_dispatcher_delegate.mm
@@ -4,6 +4,10 @@
#import "chrome/browser/ui/cocoa/chrome_command_dispatcher_delegate.h"
+#include "ui/views/widget/widget.h"
+#include "ui/events/event.h"
+#include "ui/views/focus/focus_manager.h"
+
#include "base/logging.h"
#include "chrome/browser/global_keyboard_shortcuts_mac.h"
#include "chrome/browser/ui/browser_commands.h"
@@ -103,7 +107,14 @@ bool HandleExtraBrowserKeyboardShortcut(NSEvent* event, NSWindow* window) {
- (BOOL)postPerformKeyEquivalent:(NSEvent*)event window:(NSWindow*)window {
// Handle per-window shortcuts like Esc after giving everybody else a chance
// to handle them
- return HandleDelayedWindowKeyboardShortcut(event, window);
+ if (HandleDelayedWindowKeyboardShortcut(event, window))
+ return true;
+
+ ui::KeyEvent key_event(event);
+ ui::Accelerator accelerator(key_event);
+ return views::Widget::GetWidgetForNativeWindow(window)
+ ->GetFocusManager()
+ ->ProcessAccelerator(accelerator);
}
@end // ChromeCommandDispatchDelegate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment