| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/ime/input_method_win.h" | 5 #include "ui/views/ime/input_method_win.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "ui/base/ime/composition_text.h" | 10 #include "ui/base/ime/composition_text.h" |
| 11 #include "ui/base/ime/text_input_client.h" | 11 #include "ui/base/ime/text_input_client.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 253 |
| 254 LRESULT InputMethodWin::OnChar( | 254 LRESULT InputMethodWin::OnChar( |
| 255 UINT message, WPARAM wparam, LPARAM lparam, BOOL* handled) { | 255 UINT message, WPARAM wparam, LPARAM lparam, BOOL* handled) { |
| 256 *handled = TRUE; | 256 *handled = TRUE; |
| 257 | 257 |
| 258 // We need to send character events to the focused text input client event if | 258 // We need to send character events to the focused text input client event if |
| 259 // its text input type is ui::TEXT_INPUT_TYPE_NONE. | 259 // its text input type is ui::TEXT_INPUT_TYPE_NONE. |
| 260 if (!GetTextInputClient()) | 260 if (!GetTextInputClient()) |
| 261 return 0; | 261 return 0; |
| 262 | 262 |
| 263 int flags = 0; | 263 GetTextInputClient()->InsertChar(static_cast<char16>(wparam), |
| 264 flags |= (::GetKeyState(VK_MENU) & 0x80)? ui::EF_ALT_DOWN : 0; | 264 GetModifiersFromKeyState()); |
| 265 flags |= (::GetKeyState(VK_SHIFT) & 0x80)? ui::EF_SHIFT_DOWN : 0; | |
| 266 flags |= (::GetKeyState(VK_CONTROL) & 0x80)? ui::EF_CONTROL_DOWN : 0; | |
| 267 GetTextInputClient()->InsertChar(static_cast<char16>(wparam), flags); | |
| 268 return 0; | 265 return 0; |
| 269 } | 266 } |
| 270 | 267 |
| 271 LRESULT InputMethodWin::OnDeadChar( | 268 LRESULT InputMethodWin::OnDeadChar( |
| 272 UINT message, WPARAM wparam, LPARAM lparam, BOOL* handled) { | 269 UINT message, WPARAM wparam, LPARAM lparam, BOOL* handled) { |
| 273 *handled = TRUE; | 270 *handled = TRUE; |
| 274 | 271 |
| 275 if (IsTextInputTypeNone()) | 272 if (IsTextInputTypeNone()) |
| 276 return 0; | 273 return 0; |
| 277 | 274 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 case ui::TEXT_INPUT_TYPE_PASSWORD: | 419 case ui::TEXT_INPUT_TYPE_PASSWORD: |
| 423 ime_input_.DisableIME(hwnd()); | 420 ime_input_.DisableIME(hwnd()); |
| 424 break; | 421 break; |
| 425 default: | 422 default: |
| 426 ime_input_.EnableIME(hwnd()); | 423 ime_input_.EnableIME(hwnd()); |
| 427 break; | 424 break; |
| 428 } | 425 } |
| 429 } | 426 } |
| 430 | 427 |
| 431 } // namespace views | 428 } // namespace views |
| OLD | NEW |