OLD | NEW |
1 // Copyright (c) 2012 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/base/win/ime_input.h" | 5 #include "ui/base/win/ime_input.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 ImeInput::~ImeInput() { | 130 ImeInput::~ImeInput() { |
131 } | 131 } |
132 | 132 |
133 bool ImeInput::SetInputLanguage() { | 133 bool ImeInput::SetInputLanguage() { |
134 // Retrieve the current keyboard layout from Windows and determine whether | 134 // Retrieve the current keyboard layout from Windows and determine whether |
135 // or not the current input context has IMEs. | 135 // or not the current input context has IMEs. |
136 // Also save its input language for language-specific operations required | 136 // Also save its input language for language-specific operations required |
137 // while composing a text. | 137 // while composing a text. |
138 HKL keyboard_layout = ::GetKeyboardLayout(0); | 138 HKL keyboard_layout = ::GetKeyboardLayout(0); |
139 input_language_id_ = reinterpret_cast<LANGID>(keyboard_layout); | 139 input_language_id_ = reinterpret_cast<LANGID>(keyboard_layout); |
140 ime_status_ = (::ImmIsIME(keyboard_layout) == TRUE) ? true : false; | 140 ime_status_ = (::ImmIsIME(keyboard_layout) == TRUE); |
141 return ime_status_; | 141 return ime_status_; |
142 } | 142 } |
143 | 143 |
144 void ImeInput::CreateImeWindow(HWND window_handle) { | 144 void ImeInput::CreateImeWindow(HWND window_handle) { |
145 // When a user disables TSF (Text Service Framework) and CUAS (Cicero | 145 // When a user disables TSF (Text Service Framework) and CUAS (Cicero |
146 // Unaware Application Support), Chinese IMEs somehow ignore function calls | 146 // Unaware Application Support), Chinese IMEs somehow ignore function calls |
147 // to ::ImmSetCandidateWindow(), i.e. they do not move their candidate | 147 // to ::ImmSetCandidateWindow(), i.e. they do not move their candidate |
148 // window to the position given as its parameters, and use the position | 148 // window to the position given as its parameters, and use the position |
149 // of the current system caret instead, i.e. it uses ::GetCaretPos() to | 149 // of the current system caret instead, i.e. it uses ::GetCaretPos() to |
150 // retrieve the position of their IME candidate window. | 150 // retrieve the position of their IME candidate window. |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 keystate[VK_RCONTROL] = 0; | 566 keystate[VK_RCONTROL] = 0; |
567 keystate[VK_LCONTROL] = 0; | 567 keystate[VK_LCONTROL] = 0; |
568 for (int i = 0; i <= VK_PACKET; ++i) { | 568 for (int i = 0; i <= VK_PACKET; ++i) { |
569 if (keystate[i] & kKeyDownMask) | 569 if (keystate[i] & kKeyDownMask) |
570 return false; | 570 return false; |
571 } | 571 } |
572 return true; | 572 return true; |
573 } | 573 } |
574 | 574 |
575 } // namespace ui | 575 } // namespace ui |
OLD | NEW |