| 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 "chrome/browser/gtk/browser_window_gtk.h" | 5 #include "chrome/browser/gtk/browser_window_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 | 8 |
| 9 #include "base/base_paths_linux.h" | 9 #include "base/base_paths_linux.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 } kAcceleratorMap[] = { | 104 } kAcceleratorMap[] = { |
| 105 { GDK_k, IDC_FOCUS_SEARCH }, | 105 { GDK_k, IDC_FOCUS_SEARCH }, |
| 106 { GDK_l, IDC_FOCUS_LOCATION }, | 106 { GDK_l, IDC_FOCUS_LOCATION }, |
| 107 { GDK_o, IDC_OPEN_FILE }, | 107 { GDK_o, IDC_OPEN_FILE }, |
| 108 { GDK_Page_Down, IDC_SELECT_NEXT_TAB }, | 108 { GDK_Page_Down, IDC_SELECT_NEXT_TAB }, |
| 109 { GDK_Page_Up, IDC_SELECT_PREVIOUS_TAB }, | 109 { GDK_Page_Up, IDC_SELECT_PREVIOUS_TAB }, |
| 110 { GDK_w, IDC_CLOSE_TAB }, | 110 { GDK_w, IDC_CLOSE_TAB }, |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 int GetCommandFromKeyval(guint accel_key) { | 113 int GetCommandFromKeyval(guint accel_key) { |
| 114 // Bug 9806: If capslock is on, we will get a capital letter as accel_key. |
| 115 accel_key = gdk_keyval_to_lower(accel_key); |
| 114 for (size_t i = 0; i < arraysize(kAcceleratorMap); ++i) { | 116 for (size_t i = 0; i < arraysize(kAcceleratorMap); ++i) { |
| 115 if (kAcceleratorMap[i].keyval == accel_key) | 117 if (kAcceleratorMap[i].keyval == accel_key) |
| 116 return kAcceleratorMap[i].command_id; | 118 return kAcceleratorMap[i].command_id; |
| 117 } | 119 } |
| 118 NOTREACHED(); | 120 NOTREACHED(); |
| 119 return 0; | 121 return 0; |
| 120 } | 122 } |
| 121 | 123 |
| 122 // Usually accelerators are checked before propagating the key event, but if the | 124 // Usually accelerators are checked before propagating the key event, but if the |
| 123 // focus is on the render area we want to reverse the order of things to allow | 125 // focus is on the render area we want to reverse the order of things to allow |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 } else { | 670 } else { |
| 669 browser_window->ExecuteBrowserCommand(command_id); | 671 browser_window->ExecuteBrowserCommand(command_id); |
| 670 } | 672 } |
| 671 | 673 |
| 672 return TRUE; | 674 return TRUE; |
| 673 } | 675 } |
| 674 | 676 |
| 675 void BrowserWindowGtk::ExecuteBrowserCommand(int id) { | 677 void BrowserWindowGtk::ExecuteBrowserCommand(int id) { |
| 676 browser_->ExecuteCommand(id); | 678 browser_->ExecuteCommand(id); |
| 677 } | 679 } |
| OLD | NEW |