]> khamidou — GitHub mirrors - electron.git/commitdiff
mac: Fix handling event from other windows.
authorCheng Zhao <zcbenz@gmail.com>
Tue, 17 Jun 2014 08:33:52 +0000 (16:33 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 17 Jun 2014 08:35:19 +0000 (16:35 +0800)
atom/browser/native_window_mac.mm

index f1c9c9fec8b15e7731ec2ecf2ff087dbd2def674..e3e54513f900057b736647dbb63957b6e385d277 100644 (file)
@@ -504,10 +504,17 @@ void NativeWindowMac::HandleKeyboardEvent(
       event.type == content::NativeWebKeyboardEvent::Char)
     return;
 
-  EventProcessingWindow* event_window =
-      static_cast<EventProcessingWindow*>(window_);
-  DCHECK([event_window isKindOfClass:[EventProcessingWindow class]]);
-  [event_window redispatchKeyEvent:event.os_event];
+  if (event.os_event.window == window_) {
+    EventProcessingWindow* event_window =
+        static_cast<EventProcessingWindow*>(window_);
+    DCHECK([event_window isKindOfClass:[EventProcessingWindow class]]);
+    [event_window redispatchKeyEvent:event.os_event];
+  } else {
+    // The event comes from detached devtools view, and it has already been
+    // handled by the devtools itself, we now send it to application menu to
+    // make menu acclerators work.
+    [[NSApp mainMenu] performKeyEquivalent:event.os_event];
+  }
 }
 
 void NativeWindowMac::InstallView() {