diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-25 23:15:41 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-25 23:15:41 +0000 |
commit | c566c610480e0d8e915193c058f415a7660d48b5 (patch) | |
tree | f36460711defe77bb82f060ab1aa005a24de5475 /chrome | |
parent | e098ce874e942a11083116f848310d026e8c37c8 (diff) | |
download | chromium_src-c566c610480e0d8e915193c058f415a7660d48b5.zip chromium_src-c566c610480e0d8e915193c058f415a7660d48b5.tar.gz chromium_src-c566c610480e0d8e915193c058f415a7660d48b5.tar.bz2 |
[Relanding erg's change with fix for toolkit_views shortcuts and
interactive ui tests. Note that this was originally reviewed in
http://codereview.chromium.org/217022/show I originally Elliot
suggestion of replacing the usage of int for keycode with the
bae::Keycode type, but that led to the CL getting out of hands
(as this is used in many different places). So this is only the
patch set 1 of that CL, I'll replace the type in another CL]
Use windows keycodes under linux (and all non-windows platforms).
This fixes any place where we use a VKEY_* (RenderWidgetHost, for example)
under Linux, but breaks accelerators in TOOLKIT_VIEWS which relied on this
wrong behaviour.
Previously, keyboard_codes_linux defined all the VKEY_* constants as their
GDK_* counterparts, which is wrong since the VKEY_* are supposed to resolve
to windows key codes.
BUG=22551
TEST=Make sure accelerators still work as expected on Chrome Linux and
Chrome Linux with toolkit views. Test when the the accelerators with
the focus in the location bar and also with the focus on the page.
Review URL: http://codereview.chromium.org/235025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27284 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/automation/ui_controls.h | 1 | ||||
-rw-r--r-- | chrome/browser/automation/ui_controls_linux.cc | 7 | ||||
-rw-r--r-- | chrome/browser/views/accelerator_table_gtk.cc | 208 | ||||
-rw-r--r-- | chrome/browser/views/accelerator_table_gtk.h | 12 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 15 | ||||
-rw-r--r-- | chrome/browser/views/tab_contents/tab_contents_view_gtk.cc | 2 |
6 files changed, 111 insertions, 134 deletions
diff --git a/chrome/browser/automation/ui_controls.h b/chrome/browser/automation/ui_controls.h index 113e012..7a7a6d6 100644 --- a/chrome/browser/automation/ui_controls.h +++ b/chrome/browser/automation/ui_controls.h @@ -42,6 +42,7 @@ namespace ui_controls { // these functions, so passing NULL is ok. // Send a key press with/without modifier keys. +// |key| should be a VKEY code as defined in base/keyboard_codes.h bool SendKeyPress(gfx::NativeWindow window, wchar_t key, bool control, bool shift, bool alt); bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, wchar_t key, diff --git a/chrome/browser/automation/ui_controls_linux.cc b/chrome/browser/automation/ui_controls_linux.cc index 16e6483..738f566 100644 --- a/chrome/browser/automation/ui_controls_linux.cc +++ b/chrome/browser/automation/ui_controls_linux.cc @@ -8,6 +8,7 @@ #include <gdk/gdkkeysyms.h> #include "base/gfx/rect.h" +#include "base/keyboard_code_conversion_gtk.h" #include "base/logging.h" #include "base/message_loop.h" #include "chrome/common/gtk_util.h" @@ -87,7 +88,7 @@ class ClickTask : public Task { Task* followup_; }; -bool SendKeyEvent(GdkWindow* window, bool press, guint key, guint state) { +bool SendKeyEvent(GdkWindow* window, bool press, guint gdk_key, guint state) { GdkEvent* event = gdk_event_new(press ? GDK_KEY_PRESS : GDK_KEY_RELEASE); event->key.type = press ? GDK_KEY_PRESS : GDK_KEY_RELEASE; @@ -97,7 +98,7 @@ bool SendKeyEvent(GdkWindow* window, bool press, guint key, guint state) { event->key.time = EventTimeNow(); event->key.state = state; - event->key.keyval = key; + event->key.keyval = gdk_key; GdkKeymapKey* keys; gint n_keys; @@ -195,6 +196,8 @@ bool SendKeyPress(gfx::NativeWindow window, guint state = (control ? GDK_CONTROL_MASK : 0) | (shift ? GDK_SHIFT_MASK : 0) | (alt ? GDK_MOD1_MASK : 0); + + key = base::GdkKeyCodeForWindowsKeyCode(key); rv = rv && SendKeyEvent(event_window, true, key, state); rv = rv && SendKeyEvent(event_window, false, key, state); diff --git a/chrome/browser/views/accelerator_table_gtk.cc b/chrome/browser/views/accelerator_table_gtk.cc index 7579769..4a24493 100644 --- a/chrome/browser/views/accelerator_table_gtk.cc +++ b/chrome/browser/views/accelerator_table_gtk.cc @@ -2,140 +2,118 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <gdk/gdkkeysyms.h> -#include <X11/XF86keysym.h> - #include "chrome/browser/views/accelerator_table_gtk.h" #include "base/basictypes.h" +#include "base/keyboard_codes.h" #include "chrome/app/chrome_dll_resource.h" namespace browser { const AcceleratorMapping kAcceleratorMap[] = { // Focus. - { GDK_k, IDC_FOCUS_SEARCH, GDK_CONTROL_MASK }, - { GDK_e, IDC_FOCUS_SEARCH, GDK_CONTROL_MASK }, - { XF86XK_Search, IDC_FOCUS_SEARCH, GdkModifierType(0) }, - { GDK_l, IDC_FOCUS_LOCATION, GDK_CONTROL_MASK }, - { GDK_d, IDC_FOCUS_LOCATION, GDK_MOD1_MASK }, - { GDK_F6, IDC_FOCUS_LOCATION, GdkModifierType(0) }, - { XF86XK_OpenURL, IDC_FOCUS_LOCATION, GdkModifierType(0) }, - { XF86XK_Go, IDC_FOCUS_LOCATION, GdkModifierType(0) }, + { base::VKEY_K, false, true, false, IDC_FOCUS_SEARCH }, + { base::VKEY_E, false, true, false, IDC_FOCUS_SEARCH }, + { base::VKEY_BROWSER_SEARCH, false, false, false, IDC_FOCUS_SEARCH }, + { base::VKEY_L, false, true, false, IDC_FOCUS_LOCATION }, + { base::VKEY_D, false, false, true, IDC_FOCUS_LOCATION }, + { base::VKEY_F6, false, false, false, IDC_FOCUS_LOCATION }, // Tab/window controls. - { GDK_t, IDC_NEW_TAB, GDK_CONTROL_MASK }, - { GDK_n, IDC_NEW_WINDOW, GDK_CONTROL_MASK }, - { GDK_n, IDC_NEW_INCOGNITO_WINDOW, - GdkModifierType(GDK_CONTROL_MASK | GDK_SHIFT_MASK) }, - { 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_1, IDC_SELECT_TAB_0, GDK_MOD1_MASK }, - { GDK_2, IDC_SELECT_TAB_1, GDK_MOD1_MASK }, - { GDK_3, IDC_SELECT_TAB_2, GDK_MOD1_MASK }, - { GDK_4, IDC_SELECT_TAB_3, GDK_MOD1_MASK }, - { GDK_5, IDC_SELECT_TAB_4, GDK_MOD1_MASK }, - { GDK_6, IDC_SELECT_TAB_5, GDK_MOD1_MASK }, - { GDK_7, IDC_SELECT_TAB_6, GDK_MOD1_MASK }, - { GDK_8, IDC_SELECT_TAB_7, GDK_MOD1_MASK }, - { GDK_9, IDC_SELECT_LAST_TAB, GDK_MOD1_MASK }, - - { GDK_KP_1, IDC_SELECT_TAB_0, GDK_CONTROL_MASK }, - { GDK_KP_2, IDC_SELECT_TAB_1, GDK_CONTROL_MASK }, - { GDK_KP_3, IDC_SELECT_TAB_2, GDK_CONTROL_MASK }, - { GDK_KP_4, IDC_SELECT_TAB_3, GDK_CONTROL_MASK }, - { GDK_KP_5, IDC_SELECT_TAB_4, GDK_CONTROL_MASK }, - { GDK_KP_6, IDC_SELECT_TAB_5, GDK_CONTROL_MASK }, - { GDK_KP_7, IDC_SELECT_TAB_6, GDK_CONTROL_MASK }, - { GDK_KP_8, IDC_SELECT_TAB_7, GDK_CONTROL_MASK }, - { GDK_KP_9, IDC_SELECT_LAST_TAB, GDK_CONTROL_MASK }, - - { GDK_KP_1, IDC_SELECT_TAB_0, GDK_MOD1_MASK }, - { GDK_KP_2, IDC_SELECT_TAB_1, GDK_MOD1_MASK }, - { GDK_KP_3, IDC_SELECT_TAB_2, GDK_MOD1_MASK }, - { GDK_KP_4, IDC_SELECT_TAB_3, GDK_MOD1_MASK }, - { GDK_KP_5, IDC_SELECT_TAB_4, GDK_MOD1_MASK }, - { GDK_KP_6, IDC_SELECT_TAB_5, GDK_MOD1_MASK }, - { GDK_KP_7, IDC_SELECT_TAB_6, GDK_MOD1_MASK }, - { GDK_KP_8, IDC_SELECT_TAB_7, GDK_MOD1_MASK }, - { GDK_KP_9, IDC_SELECT_LAST_TAB, GDK_MOD1_MASK }, - - { GDK_F4, IDC_CLOSE_TAB, GDK_CONTROL_MASK }, - { GDK_F4, IDC_CLOSE_WINDOW, GDK_MOD1_MASK }, + { base::VKEY_T, false, true, false, IDC_NEW_TAB }, + { base::VKEY_N, false, true, false, IDC_NEW_WINDOW }, + { base::VKEY_N, true, true, false, IDC_NEW_INCOGNITO_WINDOW }, + { base::VKEY_DOWN, false, true, false, IDC_SELECT_NEXT_TAB }, + { base::VKEY_UP, false, true, false, IDC_SELECT_PREVIOUS_TAB }, + { base::VKEY_W, false, true, false, IDC_CLOSE_TAB }, + { base::VKEY_T, true, true, false, IDC_RESTORE_TAB }, + + { base::VKEY_1, false, true, false, IDC_SELECT_TAB_0 }, + { base::VKEY_2, false, true, false, IDC_SELECT_TAB_1 }, + { base::VKEY_3, false, true, false, IDC_SELECT_TAB_2 }, + { base::VKEY_4, false, true, false, IDC_SELECT_TAB_3 }, + { base::VKEY_5, false, true, false, IDC_SELECT_TAB_4 }, + { base::VKEY_6, false, true, false, IDC_SELECT_TAB_5 }, + { base::VKEY_7, false, true, false, IDC_SELECT_TAB_6 }, + { base::VKEY_8, false, true, false, IDC_SELECT_TAB_7 }, + { base::VKEY_9, false, true, false, IDC_SELECT_LAST_TAB }, + + { base::VKEY_1, false, false, true, IDC_SELECT_TAB_0 }, + { base::VKEY_2, false, false, true, IDC_SELECT_TAB_1 }, + { base::VKEY_3, false, false, true, IDC_SELECT_TAB_2 }, + { base::VKEY_4, false, false, true, IDC_SELECT_TAB_3 }, + { base::VKEY_5, false, false, true, IDC_SELECT_TAB_4 }, + { base::VKEY_6, false, false, true, IDC_SELECT_TAB_5 }, + { base::VKEY_7, false, false, true, IDC_SELECT_TAB_6 }, + { base::VKEY_8, false, false, true, IDC_SELECT_TAB_7 }, + { base::VKEY_9, false, false, true, IDC_SELECT_LAST_TAB }, + + { base::VKEY_NUMPAD1, false, true, false, IDC_SELECT_TAB_0 }, + { base::VKEY_NUMPAD2, false, true, false, IDC_SELECT_TAB_1 }, + { base::VKEY_NUMPAD3, false, true, false, IDC_SELECT_TAB_2 }, + { base::VKEY_NUMPAD4, false, true, false, IDC_SELECT_TAB_3 }, + { base::VKEY_NUMPAD5, false, true, false, IDC_SELECT_TAB_4 }, + { base::VKEY_NUMPAD6, false, true, false, IDC_SELECT_TAB_5 }, + { base::VKEY_NUMPAD7, false, true, false, IDC_SELECT_TAB_6 }, + { base::VKEY_NUMPAD8, false, true, false, IDC_SELECT_TAB_7 }, + { base::VKEY_NUMPAD9, false, true, false, IDC_SELECT_LAST_TAB }, + + { base::VKEY_NUMPAD1, false, false, true, IDC_SELECT_TAB_0 }, + { base::VKEY_NUMPAD2, false, false, true, IDC_SELECT_TAB_1 }, + { base::VKEY_NUMPAD3, false, false, true, IDC_SELECT_TAB_2 }, + { base::VKEY_NUMPAD4, false, false, true, IDC_SELECT_TAB_3 }, + { base::VKEY_NUMPAD5, false, false, true, IDC_SELECT_TAB_4 }, + { base::VKEY_NUMPAD6, false, false, true, IDC_SELECT_TAB_5 }, + { base::VKEY_NUMPAD7, false, false, true, IDC_SELECT_TAB_6 }, + { base::VKEY_NUMPAD8, false, false, true, IDC_SELECT_TAB_7 }, + { base::VKEY_NUMPAD9, false, false, true, IDC_SELECT_LAST_TAB }, + + { base::VKEY_F4, false, true, false, IDC_CLOSE_TAB }, + { base::VKEY_F4, false, false, true, IDC_CLOSE_WINDOW }, // Zoom level. - { GDK_plus, IDC_ZOOM_PLUS, - GdkModifierType(GDK_CONTROL_MASK | GDK_SHIFT_MASK) }, - { GDK_equal, IDC_ZOOM_PLUS, GDK_CONTROL_MASK }, - { XF86XK_ZoomIn, IDC_ZOOM_PLUS, GdkModifierType(0) }, - { GDK_0, IDC_ZOOM_NORMAL, GDK_CONTROL_MASK }, - { GDK_minus, IDC_ZOOM_MINUS, GDK_CONTROL_MASK }, - { GDK_underscore, IDC_ZOOM_MINUS, - GdkModifierType(GDK_CONTROL_MASK | GDK_SHIFT_MASK) }, - { XF86XK_ZoomOut, IDC_ZOOM_MINUS, GdkModifierType(0) }, + { base::VKEY_OEM_PLUS, false, true, false, IDC_ZOOM_PLUS }, + { base::VKEY_OEM_PLUS, true, true, false, IDC_ZOOM_PLUS }, + { base::VKEY_0, false, true, false, IDC_ZOOM_NORMAL }, + { base::VKEY_OEM_MINUS, false, true, false, IDC_ZOOM_MINUS }, + { base::VKEY_OEM_MINUS, true, true, false, IDC_ZOOM_MINUS }, // 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 }, + { base::VKEY_F, false, true, false, IDC_FIND }, + { base::VKEY_G, false, true, false, IDC_FIND_NEXT }, + { base::VKEY_F3, false, false, false, IDC_FIND_NEXT }, + { base::VKEY_G, true, true, false, IDC_FIND_PREVIOUS }, + { base::VKEY_F3, true, false, false, IDC_FIND_PREVIOUS }, // Navigation / toolbar buttons. - { GDK_Home, IDC_HOME, GDK_MOD1_MASK }, - { XF86XK_HomePage, IDC_HOME, GdkModifierType(0) }, - { GDK_Escape, IDC_STOP, GdkModifierType(0) }, - { XF86XK_Stop, IDC_STOP, GdkModifierType(0) }, - { GDK_Left, IDC_BACK, GDK_MOD1_MASK }, - { GDK_BackSpace, IDC_BACK, GdkModifierType(0) }, - { XF86XK_Back, IDC_BACK, GdkModifierType(0) }, - { GDK_Right, IDC_FORWARD, GDK_MOD1_MASK }, - { GDK_BackSpace, IDC_FORWARD, GDK_SHIFT_MASK }, - { XF86XK_Forward, IDC_FORWARD, GdkModifierType(0) }, - { GDK_r, IDC_RELOAD, GDK_CONTROL_MASK }, - { GDK_F5, IDC_RELOAD, GdkModifierType(0) }, - { GDK_F5, IDC_RELOAD, GDK_CONTROL_MASK }, - { GDK_F5, IDC_RELOAD, GDK_SHIFT_MASK }, - { XF86XK_Reload, IDC_RELOAD, GdkModifierType(0) }, - { XF86XK_Refresh, IDC_RELOAD, GdkModifierType(0) }, + { base::VKEY_HOME, false, false, true, IDC_HOME }, + { base::VKEY_ESCAPE, false, false, false, IDC_STOP }, + { base::VKEY_LEFT, false, false, true, IDC_BACK }, + { base::VKEY_BACK, false, false, false, IDC_BACK }, + { base::VKEY_RIGHT, false, false, true, IDC_FORWARD }, + { base::VKEY_BACK, true, false, false, IDC_FORWARD }, + { base::VKEY_R, false, true, false, IDC_RELOAD }, + { base::VKEY_F5, false, false, false, IDC_RELOAD }, + { base::VKEY_F5, false, true, false, IDC_RELOAD }, + { base::VKEY_F5, true, false, false, IDC_RELOAD }, // Miscellany. - { GDK_d, IDC_STAR, GDK_CONTROL_MASK }, - { XF86XK_AddFavorite, IDC_STAR, GdkModifierType(0) }, - { XF86XK_Favorites, IDC_SHOW_BOOKMARK_BAR, GdkModifierType(0) }, - { GDK_b, IDC_SHOW_BOOKMARK_BAR, GDK_CONTROL_MASK }, - { XF86XK_History, IDC_SHOW_HISTORY, GdkModifierType(0) }, - { GDK_h, IDC_SHOW_HISTORY, GDK_CONTROL_MASK }, - { GDK_j, IDC_SHOW_DOWNLOADS, 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_j, IDC_DEV_TOOLS, GdkModifierType(GDK_CONTROL_MASK | GDK_MOD1_MASK) }, - { GDK_p, IDC_PRINT, GDK_CONTROL_MASK }, - { GDK_Escape, IDC_TASK_MANAGER, GDK_SHIFT_MASK }, - { GDK_f, IDC_FULLSCREEN, - GdkModifierType(GDK_CONTROL_MASK | GDK_MOD1_MASK) }, - { GDK_Delete, IDC_TASK_MANAGER, - GdkModifierType(GDK_CONTROL_MASK | GDK_MOD1_MASK) }, - { GDK_comma, IDC_CONTROL_PANEL, GdkModifierType(GDK_CONTROL_MASK) }, - { GDK_b, IDC_SHOW_BOOKMARK_MANAGER, - GdkModifierType(GDK_CONTROL_MASK | GDK_SHIFT_MASK) }, - { GDK_F1, IDC_HELP_PAGE, GdkModifierType(0) }, - { GDK_q, IDC_EXIT, GdkModifierType(GDK_CONTROL_MASK | GDK_SHIFT_MASK) }, + { base::VKEY_D, false, true, false, IDC_STAR }, + { base::VKEY_B, false, true, false, IDC_SHOW_BOOKMARK_BAR }, + { base::VKEY_H, false, true, false, IDC_SHOW_HISTORY }, + { base::VKEY_J, false, true, false, IDC_SHOW_DOWNLOADS }, + { base::VKEY_O, false, true, false, IDC_OPEN_FILE }, + { base::VKEY_F11, false, false, false, IDC_FULLSCREEN }, + { base::VKEY_U, false, true, false, IDC_VIEW_SOURCE }, + { base::VKEY_J, true, true, false, IDC_DEV_TOOLS }, + { base::VKEY_P, false, true, false, IDC_PRINT}, + { base::VKEY_ESCAPE, true, false, false, IDC_TASK_MANAGER }, + { base::VKEY_F11, false, true, true, IDC_FULLSCREEN }, + { base::VKEY_DELETE, false, true, true, IDC_TASK_MANAGER }, + { base::VKEY_OEM_COMMA, false, true, false, IDC_CONTROL_PANEL }, + { base::VKEY_B, true, true, false, IDC_SHOW_BOOKMARK_MANAGER }, + { base::VKEY_F1, false, false, false, IDC_HELP_PAGE }, + { base::VKEY_Q, true, true, false, IDC_EXIT }, }; const size_t kAcceleratorMapLength = arraysize(kAcceleratorMap); diff --git a/chrome/browser/views/accelerator_table_gtk.h b/chrome/browser/views/accelerator_table_gtk.h index 830fdb2..29f7588 100644 --- a/chrome/browser/views/accelerator_table_gtk.h +++ b/chrome/browser/views/accelerator_table_gtk.h @@ -5,16 +5,18 @@ #ifndef CHROME_BROWSER_VIEWS_ACCELERATOR_TABLE_GTK_H_ #define CHROME_BROWSER_VIEWS_ACCELERATOR_TABLE_GTK_H_ -#include <gtk/gtk.h> +#include <stdio.h> -// This contains the list of accelerators shared between the Linux Gtk and -// toolkit_view implementation. +// This contains the list of accelerators for the Linux toolkit_view +// implementation. namespace browser { struct AcceleratorMapping { - guint keyval; + int keycode; + bool shift_pressed; + bool ctrl_pressed; + bool alt_pressed; int command_id; - GdkModifierType modifier_type; }; // The list of accelerators. diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 7ef0c80..d4a0e8f 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -2008,17 +2008,10 @@ void BrowserView::LoadAccelerators() { DCHECK(focus_manager); // Let's fill our own accelerator table. for (size_t i = 0; i < browser::kAcceleratorMapLength; ++i) { - bool alt_down = - (browser::kAcceleratorMap[i].modifier_type & GDK_MOD1_MASK) == - GDK_MOD1_MASK; - bool ctrl_down = - (browser::kAcceleratorMap[i].modifier_type & GDK_CONTROL_MASK) == - GDK_CONTROL_MASK; - bool shift_down = - (browser::kAcceleratorMap[i].modifier_type & GDK_SHIFT_MASK) == - GDK_SHIFT_MASK; - views::Accelerator accelerator(browser::kAcceleratorMap[i].keyval, - shift_down, ctrl_down, alt_down); + views::Accelerator accelerator(browser::kAcceleratorMap[i].keycode, + browser::kAcceleratorMap[i].shift_pressed, + browser::kAcceleratorMap[i].ctrl_pressed, + browser::kAcceleratorMap[i].alt_pressed); accelerator_table_[accelerator] = browser::kAcceleratorMap[i].command_id; // Also register with the focus manager. diff --git a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc index 6a4f76c..dbc7c26 100644 --- a/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc +++ b/chrome/browser/views/tab_contents/tab_contents_view_gtk.cc @@ -310,7 +310,7 @@ void TabContentsViewGtk::HandleKeyboardEvent( bool alt_pressed = (event.modifiers & WebInputEvent::AltKey) == WebInputEvent::AltKey; - focus_manager->ProcessAccelerator(views::Accelerator(event.os_event->keyval, + focus_manager->ProcessAccelerator(views::Accelerator(event.windowsKeyCode, shift_pressed, ctrl_pressed, alt_pressed)); |