Skip to content

Commit 93d2d76

Browse files
committed
Fix incorrect CandidateWindow position when using Pinyin IMEs in Windows
1 parent 73d7579 commit 93d2d76

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

src/Windows/Avalonia.Win32/Input/Imm32InputMethod.cs

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -211,27 +211,6 @@ private void MoveImeWindow(Rect rect, IntPtr himc)
211211
var s = _parent?.DesktopScaling ?? 1;
212212
var (x1, y1, x2, y2) = ((int) (p1.X * s), (int) (p1.Y * s), (int) (p2.X * s), (int) (p2.Y * s));
213213

214-
if (!ShowCompositionWindow && _langId == LANG_ZH)
215-
{
216-
// Chinese IMEs ignore function calls to ::ImmSetCandidateWindow()
217-
// when a user disables TSF (Text Service Framework) and CUAS (Cicero
218-
// Unaware Application Support).
219-
// On the other hand, when a user enables TSF and CUAS, Chinese IMEs
220-
// ignore the position of the current system caret and uses the
221-
// parameters given to ::ImmSetCandidateWindow() with its 'dwStyle'
222-
// parameter CFS_CANDIDATEPOS.
223-
// Therefore, we do not only call ::ImmSetCandidateWindow() but also
224-
// set the positions of the temporary system caret.
225-
var candidateForm = new CANDIDATEFORM
226-
{
227-
dwIndex = 0,
228-
dwStyle = CFS_CANDIDATEPOS,
229-
ptCurrentPos = new POINT {X = x2, Y = y2}
230-
};
231-
232-
ImmSetCandidateWindow(himc, ref candidateForm);
233-
}
234-
235214
_caretManager.TryMove(x2, y2);
236215

237216
if (ShowCompositionWindow)
@@ -250,14 +229,8 @@ private void MoveImeWindow(Rect rect, IntPtr himc)
250229
y2 += CaretMargin;
251230
}
252231

253-
// Need to return here since some Chinese IMEs would stuck if set
254-
// candidate window position with CFS_EXCLUDE style.
255-
if (_langId == LANG_ZH)
256-
{
257-
return;
258-
}
259232

260-
// Japanese IMEs and Korean IMEs also use the rectangle given to
233+
// Chinese, Japanese, and Korean(CJK) IMEs also use the rectangle given to
261234
// ::ImmSetCandidateWindow() with its 'dwStyle' parameter CFS_EXCLUDE
262235
// to move their candidate windows when a user disables TSF and CUAS.
263236
// Therefore, we also set this parameter here.

0 commit comments

Comments
 (0)