diff options
Diffstat (limited to 'views/controls/button')
-rw-r--r-- | views/controls/button/custom_button.cc | 6 | ||||
-rw-r--r-- | views/controls/button/menu_button.cc | 3 | ||||
-rw-r--r-- | views/controls/button/native_button.cc | 10 |
3 files changed, 8 insertions, 11 deletions
diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc index e507d93..348e527 100644 --- a/views/controls/button/custom_button.cc +++ b/views/controls/button/custom_button.cc @@ -175,10 +175,10 @@ bool CustomButton::OnKeyPressed(const KeyEvent& e) { // Space sets button state to pushed. Enter clicks the button. This matches // the Windows native behavior of buttons, where Space clicks the button // on KeyRelease and Enter clicks the button on KeyPressed. - if (e.GetCharacter() == base::VKEY_SPACE) { + if (e.GetKeyCode() == base::VKEY_SPACE) { SetState(BS_PUSHED); return true; - } else if (e.GetCharacter() == base::VKEY_RETURN) { + } else if (e.GetKeyCode() == base::VKEY_RETURN) { SetState(BS_NORMAL); NotifyClick(e); return true; @@ -189,7 +189,7 @@ bool CustomButton::OnKeyPressed(const KeyEvent& e) { bool CustomButton::OnKeyReleased(const KeyEvent& e) { if (state_ != BS_DISABLED) { - if (e.GetCharacter() == base::VKEY_SPACE) { + if (e.GetKeyCode() == base::VKEY_SPACE) { SetState(BS_NORMAL); NotifyClick(e); return true; diff --git a/views/controls/button/menu_button.cc b/views/controls/button/menu_button.cc index 25a415d..5b353f3 100644 --- a/views/controls/button/menu_button.cc +++ b/views/controls/button/menu_button.cc @@ -214,7 +214,8 @@ void MenuButton::OnMouseReleased(const MouseEvent& e, // When the space bar or the enter key is pressed we need to show the menu. bool MenuButton::OnKeyReleased(const KeyEvent& e) { #if defined(OS_WIN) - if ((e.GetCharacter() == VK_SPACE) || (e.GetCharacter() == VK_RETURN)) { + if ((e.GetKeyCode() == base::VKEY_SPACE) || + (e.GetKeyCode() == base::VKEY_RETURN)) { return Activate(); } #else diff --git a/views/controls/button/native_button.cc b/views/controls/button/native_button.cc index e36719c..811fb56 100644 --- a/views/controls/button/native_button.cc +++ b/views/controls/button/native_button.cc @@ -10,6 +10,7 @@ #endif #include "app/l10n_util.h" +#include "base/keyboard_codes.h" #include "base/logging.h" namespace views { @@ -73,17 +74,12 @@ void NativeButton::SetLabel(const std::wstring& label) { } void NativeButton::SetIsDefault(bool is_default) { -#if defined(OS_WIN) - int return_code = VK_RETURN; -#else - int return_code = GDK_Return; -#endif if (is_default == is_default_) return; if (is_default) - AddAccelerator(Accelerator(return_code, false, false, false)); + AddAccelerator(Accelerator(base::VKEY_RETURN, false, false, false)); else - RemoveAccelerator(Accelerator(return_code, false, false, false)); + RemoveAccelerator(Accelerator(base::VKEY_RETURN, false, false, false)); SetAppearsAsDefault(is_default); } |