summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-06 01:19:23 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-06 01:19:23 +0000
commit4204da0d51e160954a8edacd56345449a898a170 (patch)
treefce8e5071055416fe5092e9333d7e60c5756eb68
parentc601cd327760f385f03d228967d8aa7445712dd6 (diff)
downloadchromium_src-4204da0d51e160954a8edacd56345449a898a170.zip
chromium_src-4204da0d51e160954a8edacd56345449a898a170.tar.gz
chromium_src-4204da0d51e160954a8edacd56345449a898a170.tar.bz2
Add a lot of hotkeys to linux.
BUG=11476 Review URL: http://codereview.chromium.org/108037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15368 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/gtk/browser_toolbar_gtk.cc4
-rw-r--r--chrome/browser/gtk/browser_toolbar_gtk.h2
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc34
3 files changed, 38 insertions, 2 deletions
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.cc b/chrome/browser/gtk/browser_toolbar_gtk.cc
index b8d956d..fbedb38 100644
--- a/chrome/browser/gtk/browser_toolbar_gtk.cc
+++ b/chrome/browser/gtk/browser_toolbar_gtk.cc
@@ -112,10 +112,14 @@ void BrowserToolbarGtk::Init(Profile* profile,
IDR_BACK_D,
l10n_util::GetStringUTF8(IDS_TOOLTIP_BACK)));
AddAcceleratorToButton(back_, GDK_Left, GDK_MOD1_MASK);
+ // TODO(estade): I ran into some problems with backspace in the find bar when
+ // I enabled this accelerator. Figure it out and re-enable the shortcut.
+ // AddAcceleratorToButton(back_, GDK_BackSpace, 0);
forward_.reset(BuildBackForwardButton(IDR_FORWARD, IDR_FORWARD_P,
IDR_FORWARD_H, IDR_FORWARD_D,
l10n_util::GetStringUTF8(IDS_TOOLTIP_FORWARD)));
AddAcceleratorToButton(forward_, GDK_Right, GDK_MOD1_MASK);
+ AddAcceleratorToButton(forward_, GDK_BackSpace, GDK_SHIFT_MASK);
// TODO(estade): These blank labels are kind of ghetto. Padding should be
// handled differently (via spacing parameters or padding widgets that use
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.h b/chrome/browser/gtk/browser_toolbar_gtk.h
index bfb039b..654fa6a 100644
--- a/chrome/browser/gtk/browser_toolbar_gtk.h
+++ b/chrome/browser/gtk/browser_toolbar_gtk.h
@@ -90,7 +90,7 @@ class BrowserToolbarGtk : public CommandUpdater::CommandObserver,
const std::string& localized_tooltip,
OwnedWidgetGtk* owner);
- // Adds a keyboard accelerator which trigers a button. (i.e., Ctrl+R is now
+ // Adds a keyboard accelerator which triggers a button (e.g., ctrl+r is now
// equivalent to a reload click).
void AddAcceleratorToButton(
const scoped_ptr<CustomDrawButton>& button,
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index 631c8ba..dcc8c98 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -106,13 +106,32 @@ const struct AcceleratorMapping {
int command_id;
GdkModifierType modifier_type;
} kAcceleratorMap[] = {
+ // Focus.
{ GDK_k, IDC_FOCUS_SEARCH, GDK_CONTROL_MASK },
{ GDK_l, IDC_FOCUS_LOCATION, GDK_CONTROL_MASK },
{ GDK_d, IDC_FOCUS_LOCATION, GDK_MOD1_MASK },
- { GDK_o, IDC_OPEN_FILE, GDK_CONTROL_MASK },
+ { GDK_F6, IDC_FOCUS_LOCATION, GdkModifierType(0) },
+
+ // Tab/window controls.
{ GDK_Page_Down, IDC_SELECT_NEXT_TAB, GDK_CONTROL_MASK },
{ GDK_Page_Up, IDC_SELECT_PREVIOUS_TAB, GDK_CONTROL_MASK },
{ GDK_w, IDC_CLOSE_TAB, GDK_CONTROL_MASK },
+ { GDK_t, IDC_RESTORE_TAB,
+ GdkModifierType(GDK_CONTROL_MASK | GDK_SHIFT_MASK) },
+ { GDK_1, IDC_SELECT_TAB_0, GDK_CONTROL_MASK },
+ { GDK_2, IDC_SELECT_TAB_1, GDK_CONTROL_MASK },
+ { GDK_3, IDC_SELECT_TAB_2, GDK_CONTROL_MASK },
+ { GDK_4, IDC_SELECT_TAB_3, GDK_CONTROL_MASK },
+ { GDK_5, IDC_SELECT_TAB_4, GDK_CONTROL_MASK },
+ { GDK_6, IDC_SELECT_TAB_5, GDK_CONTROL_MASK },
+ { GDK_7, IDC_SELECT_TAB_6, GDK_CONTROL_MASK },
+ { GDK_8, IDC_SELECT_TAB_7, GDK_CONTROL_MASK },
+ { GDK_9, IDC_SELECT_LAST_TAB, GDK_CONTROL_MASK },
+ { GDK_w, IDC_CLOSE_TAB, GDK_CONTROL_MASK },
+ { GDK_F4, IDC_CLOSE_TAB, GDK_CONTROL_MASK },
+ { GDK_F4, IDC_CLOSE_WINDOW, GDK_MOD1_MASK },
+
+ // Zoom level.
{ GDK_plus, IDC_ZOOM_PLUS,
GdkModifierType(GDK_CONTROL_MASK | GDK_SHIFT_MASK) },
{ GDK_equal, IDC_ZOOM_PLUS, GDK_CONTROL_MASK },
@@ -120,12 +139,25 @@ const struct AcceleratorMapping {
{ GDK_minus, IDC_ZOOM_MINUS, GDK_CONTROL_MASK },
{ GDK_underscore, IDC_ZOOM_MINUS,
GdkModifierType(GDK_CONTROL_MASK | GDK_SHIFT_MASK) },
+
+ // Find in page.
{ GDK_g, IDC_FIND_NEXT, GDK_CONTROL_MASK },
{ GDK_F3, IDC_FIND_NEXT, GdkModifierType(0) },
{ GDK_g, IDC_FIND_PREVIOUS,
GdkModifierType(GDK_CONTROL_MASK | GDK_SHIFT_MASK) },
{ GDK_F3, IDC_FIND_PREVIOUS, GDK_SHIFT_MASK },
+
+ // Navigation.
+ { GDK_Home, IDC_HOME, GDK_MOD1_MASK },
+ { GDK_Escape, IDC_STOP, GdkModifierType(0) },
+
+ // Miscellany.
+ { GDK_d, IDC_STAR, GDK_CONTROL_MASK },
+ { GDK_o, IDC_OPEN_FILE, GDK_CONTROL_MASK },
{ GDK_F11, IDC_FULLSCREEN, GdkModifierType(0) },
+ { GDK_u, IDC_VIEW_SOURCE, GDK_CONTROL_MASK },
+ { GDK_p, IDC_PRINT, GDK_CONTROL_MASK },
+ { GDK_Escape, IDC_TASK_MANAGER, GDK_SHIFT_MASK },
};
int GetCommandId(guint accel_key, GdkModifierType modifier) {