]> khamidou — GitHub mirrors - electron.git/commitdiff
mac: Make cmd+~ work for devtools window, fixes #508.
authorCheng Zhao <zcbenz@gmail.com>
Fri, 25 Jul 2014 03:03:25 +0000 (11:03 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 25 Jul 2014 03:03:25 +0000 (11:03 +0800)
atom/browser/native_window_mac.mm

index 330fb0869a7ba2c320e65e5256e771fd99fda70e..22ca45fab543574dc60262c754723f59379b5965 100644 (file)
@@ -538,7 +538,11 @@ void NativeWindowMac::HandleKeyboardEvent(
     // 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];
+    BOOL handled = [[NSApp mainMenu] performKeyEquivalent:event.os_event];
+    // Handle the cmd+~ shortcut.
+    if (!handled && (event.os_event.modifierFlags & NSCommandKeyMask) &&
+        (event.os_event.keyCode == 50  /* ~ key */))
+      Focus(true);
   }
 }