OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ime/win/imm32_manager.h" | 5 #include "ui/base/ime/win/imm32_manager.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 void IMM32Manager::SetInputLanguage() { | 126 void IMM32Manager::SetInputLanguage() { |
127 // Retrieve the current input language from the system's keyboard layout. | 127 // Retrieve the current input language from the system's keyboard layout. |
128 // Using GetKeyboardLayoutName instead of GetKeyboardLayout, because | 128 // Using GetKeyboardLayoutName instead of GetKeyboardLayout, because |
129 // the language from GetKeyboardLayout is the language under where the | 129 // the language from GetKeyboardLayout is the language under where the |
130 // keyboard layout is installed. And the language from GetKeyboardLayoutName | 130 // keyboard layout is installed. And the language from GetKeyboardLayoutName |
131 // indicates the language of the keyboard layout itself. | 131 // indicates the language of the keyboard layout itself. |
132 // See crbug.com/344834. | 132 // See crbug.com/344834. |
133 WCHAR keyboard_layout[KL_NAMELENGTH]; | 133 WCHAR keyboard_layout[KL_NAMELENGTH]; |
134 if (::GetKeyboardLayoutNameW(keyboard_layout)) { | 134 if (::GetKeyboardLayoutNameW(keyboard_layout)) { |
135 input_language_id_ = | 135 input_language_id_ = |
136 static_cast<LANGID>(_wtoi(&keyboard_layout[KL_NAMELENGTH >> 1])); | 136 static_cast<LANGID>( |
| 137 wcstol(&keyboard_layout[KL_NAMELENGTH >> 1], nullptr, 16)); |
137 } else { | 138 } else { |
138 input_language_id_ = 0x0409; // Fallback to en-US. | 139 input_language_id_ = 0x0409; // Fallback to en-US. |
139 } | 140 } |
140 } | 141 } |
141 | 142 |
142 void IMM32Manager::CreateImeWindow(HWND window_handle) { | 143 void IMM32Manager::CreateImeWindow(HWND window_handle) { |
143 // When a user disables TSF (Text Service Framework) and CUAS (Cicero | 144 // When a user disables TSF (Text Service Framework) and CUAS (Cicero |
144 // Unaware Application Support), Chinese IMEs somehow ignore function calls | 145 // Unaware Application Support), Chinese IMEs somehow ignore function calls |
145 // to ::ImmSetCandidateWindow(), i.e. they do not move their candidate | 146 // to ::ImmSetCandidateWindow(), i.e. they do not move their candidate |
146 // window to the position given as its parameters, and use the position | 147 // window to the position given as its parameters, and use the position |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 | IME_CMODE_KATAKANA | 602 | IME_CMODE_KATAKANA |
602 | IME_CMODE_FULLSHAPE); | 603 | IME_CMODE_FULLSHAPE); |
603 break; | 604 break; |
604 default: | 605 default: |
605 *open = FALSE; | 606 *open = FALSE; |
606 break; | 607 break; |
607 } | 608 } |
608 } | 609 } |
609 | 610 |
610 } // namespace ui | 611 } // namespace ui |
OLD | NEW |