OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <AppKit/NSEvent.h> | 5 #include <AppKit/NSEvent.h> |
6 #include <Carbon/Carbon.h> | 6 #include <Carbon/Carbon.h> |
7 | 7 |
8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "chrome/app/chrome_dll_resource.h" | 12 #include "chrome/app/chrome_command_ids.h" |
13 | 13 |
14 // Basically, there are two kinds of keyboard shortcuts: Ones that should work | 14 // Basically, there are two kinds of keyboard shortcuts: Ones that should work |
15 // only if the tab contents is focused (BrowserKeyboardShortcut), and ones that | 15 // only if the tab contents is focused (BrowserKeyboardShortcut), and ones that |
16 // should work in all other cases (WindowKeyboardShortcut). In the latter case, | 16 // should work in all other cases (WindowKeyboardShortcut). In the latter case, |
17 // we differentiate between shortcuts that are checked before any other view | 17 // we differentiate between shortcuts that are checked before any other view |
18 // gets the chance to handle them (WindowKeyboardShortcut) or after all views | 18 // gets the chance to handle them (WindowKeyboardShortcut) or after all views |
19 // had a chance but did not handle the keypress event | 19 // had a chance but did not handle the keypress event |
20 // (DelayedWindowKeyboardShortcut) | 20 // (DelayedWindowKeyboardShortcut) |
21 | 21 |
22 const KeyboardShortcutData* GetWindowKeyboardShortcutTable | 22 const KeyboardShortcutData* GetWindowKeyboardShortcutTable |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // |characters| is an alphabet (mainly for dvorak-qwerty layout), or | 168 // |characters| is an alphabet (mainly for dvorak-qwerty layout), or |
169 if (isalpha([characters characterAtIndex:0])) | 169 if (isalpha([characters characterAtIndex:0])) |
170 return [characters characterAtIndex:0]; | 170 return [characters characterAtIndex:0]; |
171 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8). | 171 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8). |
172 if ([event modifierFlags] & NSAlternateKeyMask) | 172 if ([event modifierFlags] & NSAlternateKeyMask) |
173 return [characters characterAtIndex:0]; | 173 return [characters characterAtIndex:0]; |
174 } | 174 } |
175 | 175 |
176 return [eventString characterAtIndex:0]; | 176 return [eventString characterAtIndex:0]; |
177 } | 177 } |
OLD | NEW |