Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: chrome/browser/global_keyboard_shortcuts_mac.mm

Issue 5072003: Allow keypad 1..9 keys to be used as shortcuts to switch tabs.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 13 matching lines...) Expand all
24 static const KeyboardShortcutData keyboard_shortcuts[] = { 24 static const KeyboardShortcutData keyboard_shortcuts[] = {
25 // '{' / '}' characters should be matched earlier than virtual key code 25 // '{' / '}' characters should be matched earlier than virtual key code
26 // (therefore we can match alt-8 as '{' on german keyboards). 26 // (therefore we can match alt-8 as '{' on german keyboards).
27 {true, false, false, false, 0, '}', IDC_SELECT_NEXT_TAB}, 27 {true, false, false, false, 0, '}', IDC_SELECT_NEXT_TAB},
28 {true, false, false, false, 0, '{', IDC_SELECT_PREVIOUS_TAB}, 28 {true, false, false, false, 0, '{', IDC_SELECT_PREVIOUS_TAB},
29 {false, false, true, false, kVK_PageDown, 0, IDC_SELECT_NEXT_TAB}, 29 {false, false, true, false, kVK_PageDown, 0, IDC_SELECT_NEXT_TAB},
30 {false, false, true, false, kVK_Tab, 0, IDC_SELECT_NEXT_TAB}, 30 {false, false, true, false, kVK_Tab, 0, IDC_SELECT_NEXT_TAB},
31 {false, false, true, false, kVK_PageUp, 0, IDC_SELECT_PREVIOUS_TAB}, 31 {false, false, true, false, kVK_PageUp, 0, IDC_SELECT_PREVIOUS_TAB},
32 {false, true, true, false, kVK_Tab, 0, IDC_SELECT_PREVIOUS_TAB}, 32 {false, true, true, false, kVK_Tab, 0, IDC_SELECT_PREVIOUS_TAB},
33 // Cmd-0..8 select the Nth tab, with cmd-9 being "last tab". 33 // Cmd-0..8 select the Nth tab, with cmd-9 being "last tab".
34 {true, false, false, false, kVK_ANSI_1, 0, IDC_SELECT_TAB_0}, 34 {true, false, false, false, kVK_ANSI_1, 0, IDC_SELECT_TAB_0},
35 {true, false, false, false, kVK_ANSI_2, 0, IDC_SELECT_TAB_1}, 35 {true, false, false, false, kVK_ANSI_Keypad1, 0, IDC_SELECT_TAB_0},
36 {true, false, false, false, kVK_ANSI_3, 0, IDC_SELECT_TAB_2}, 36 {true, false, false, false, kVK_ANSI_2, 0, IDC_SELECT_TAB_1},
37 {true, false, false, false, kVK_ANSI_4, 0, IDC_SELECT_TAB_3}, 37 {true, false, false, false, kVK_ANSI_Keypad2, 0, IDC_SELECT_TAB_1},
38 {true, false, false, false, kVK_ANSI_5, 0, IDC_SELECT_TAB_4}, 38 {true, false, false, false, kVK_ANSI_3, 0, IDC_SELECT_TAB_2},
39 {true, false, false, false, kVK_ANSI_6, 0, IDC_SELECT_TAB_5}, 39 {true, false, false, false, kVK_ANSI_Keypad3, 0, IDC_SELECT_TAB_2},
40 {true, false, false, false, kVK_ANSI_7, 0, IDC_SELECT_TAB_6}, 40 {true, false, false, false, kVK_ANSI_4, 0, IDC_SELECT_TAB_3},
41 {true, false, false, false, kVK_ANSI_8, 0, IDC_SELECT_TAB_7}, 41 {true, false, false, false, kVK_ANSI_Keypad4, 0, IDC_SELECT_TAB_3},
42 {true, false, false, false, kVK_ANSI_9, 0, IDC_SELECT_LAST_TAB}, 42 {true, false, false, false, kVK_ANSI_5, 0, IDC_SELECT_TAB_4},
43 {true, false, false, false, kVK_ANSI_Keypad5, 0, IDC_SELECT_TAB_4},
44 {true, false, false, false, kVK_ANSI_6, 0, IDC_SELECT_TAB_5},
45 {true, false, false, false, kVK_ANSI_Keypad6, 0, IDC_SELECT_TAB_5},
46 {true, false, false, false, kVK_ANSI_7, 0, IDC_SELECT_TAB_6},
47 {true, false, false, false, kVK_ANSI_Keypad7, 0, IDC_SELECT_TAB_6},
48 {true, false, false, false, kVK_ANSI_8, 0, IDC_SELECT_TAB_7},
49 {true, false, false, false, kVK_ANSI_Keypad8, 0, IDC_SELECT_TAB_7},
50 {true, false, false, false, kVK_ANSI_9, 0, IDC_SELECT_LAST_TAB},
51 {true, false, false, false, kVK_ANSI_Keypad9, 0, IDC_SELECT_LAST_TAB},
43 }; 52 };
44 53
45 *num_entries = arraysize(keyboard_shortcuts); 54 *num_entries = arraysize(keyboard_shortcuts);
46 55
47 return keyboard_shortcuts; 56 return keyboard_shortcuts;
48 } 57 }
49 58
50 const KeyboardShortcutData* GetDelayedWindowKeyboardShortcutTable 59 const KeyboardShortcutData* GetDelayedWindowKeyboardShortcutTable
51 (size_t* num_entries) { 60 (size_t* num_entries) {
52 static const KeyboardShortcutData keyboard_shortcuts[] = { 61 static const KeyboardShortcutData keyboard_shortcuts[] = {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 return rawChar; 206 return rawChar;
198 } 207 }
199 208
200 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8). 209 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8).
201 if ([event modifierFlags] & NSAlternateKeyMask) 210 if ([event modifierFlags] & NSAlternateKeyMask)
202 return [characters characterAtIndex:0]; 211 return [characters characterAtIndex:0];
203 } 212 }
204 213
205 return [eventString characterAtIndex:0]; 214 return [eventString characterAtIndex:0];
206 } 215 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698