From a66aa94042d130a8c1220be94468f640aedf6db4 Mon Sep 17 00:00:00 2001 From: "skuhne@chromium.org" Date: Wed, 30 May 2012 23:18:34 +0000 Subject: Fixing french keyboard handling BUG=129017 TEST=none Review URL: https://chromiumcodereview.appspot.com/10452042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139678 0039d316-1c4b-4281-b951-d872f2087c98 --- ash/accelerators/accelerator_controller.cc | 4 ++++ ash/accelerators/accelerator_controller_unittest.cc | 4 ++++ ash/accelerators/accelerator_table.cc | 16 ---------------- ash/ime_control_delegate.h | 5 +++++ 4 files changed, 13 insertions(+), 16 deletions(-) (limited to 'ash') diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index 3cd9db2..6434a5f 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -242,6 +242,10 @@ void AcceleratorController::UnregisterAll(ui::AcceleratorTarget* target) { } bool AcceleratorController::Process(const ui::Accelerator& accelerator) { + if (ime_control_delegate_.get()) { + return accelerator_manager_->Process( + ime_control_delegate_->RemapAccelerator(accelerator)); + } return accelerator_manager_->Process(accelerator); } diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc index 510e250..71eef58 100644 --- a/ash/accelerators/accelerator_controller_unittest.cc +++ b/ash/accelerators/accelerator_controller_unittest.cc @@ -249,6 +249,10 @@ class DummyImeControlDelegate : public ImeControlDelegate { const ui::Accelerator& last_accelerator() const { return last_accelerator_; } + ui::Accelerator RemapAccelerator( + const ui::Accelerator& accelerator) { + return ui::Accelerator(accelerator); + } private: const bool consume_; diff --git a/ash/accelerators/accelerator_table.cc b/ash/accelerators/accelerator_table.cc index dd64375..bbe3229 100644 --- a/ash/accelerators/accelerator_table.cc +++ b/ash/accelerators/accelerator_table.cc @@ -84,22 +84,6 @@ const AcceleratorData kAcceleratorData[] = { { true, ui::VKEY_8, ui::EF_ALT_DOWN, SELECT_WIN_7 }, { true, ui::VKEY_9, ui::EF_ALT_DOWN, SELECT_LAST_WIN }, - // We need the number keys with and without shift since the French keyboard - // does not have explicit number keys. Instead they have to press - // 'Shift' + .. to access the keys. If we ever have an overlap of - // functionality, we should think about either assembling this table - // dynamically - or by decoding the keys properly (which is of course in - // conflict with other keyboards since the Shift+ is missing then). - { true, ui::VKEY_1, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, SELECT_WIN_0 }, - { true, ui::VKEY_2, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, SELECT_WIN_1 }, - { true, ui::VKEY_3, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, SELECT_WIN_2 }, - { true, ui::VKEY_4, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, SELECT_WIN_3 }, - { true, ui::VKEY_5, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, SELECT_WIN_4 }, - { true, ui::VKEY_6, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, SELECT_WIN_5 }, - { true, ui::VKEY_7, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, SELECT_WIN_6 }, - { true, ui::VKEY_8, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, SELECT_WIN_7 }, - { true, ui::VKEY_9, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN, SELECT_LAST_WIN }, - // Window management shortcuts. { true, ui::VKEY_OEM_4, ui::EF_ALT_DOWN, WINDOW_SNAP_LEFT }, { true, ui::VKEY_OEM_6, ui::EF_ALT_DOWN, WINDOW_SNAP_RIGHT }, diff --git a/ash/ime_control_delegate.h b/ash/ime_control_delegate.h index 5d6e538..f52ef50 100644 --- a/ash/ime_control_delegate.h +++ b/ash/ime_control_delegate.h @@ -21,6 +21,11 @@ class ImeControlDelegate { virtual bool HandlePreviousIme() = 0; // Switches to another IME depending on the |accelerator|. virtual bool HandleSwitchIme(const ui::Accelerator& accelerator) = 0; + + // Checks for special language anomalies and re-map the |accelerator| + // accordingly. + virtual ui::Accelerator RemapAccelerator( + const ui::Accelerator& accelerator) = 0; }; } // namespace ash -- cgit v1.1