Skip to content

Commit 3b70265

Browse files
authored
Fix incorrect CandidateWindow position when using Pinyin IMEs in Windows (#18759)
1 parent 1a02de5 commit 3b70265

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
@@ -208,27 +208,6 @@ private void MoveImeWindow(Rect rect, IntPtr himc)
208208
var s = _parent?.DesktopScaling ?? 1;
209209
var (x1, y1, x2, y2) = ((int) (p1.X * s), (int) (p1.Y * s), (int) (p2.X * s), (int) (p2.Y * s));
210210

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

234213
if (ShowCompositionWindow)
@@ -247,14 +226,8 @@ private void MoveImeWindow(Rect rect, IntPtr himc)
247226
y2 += CaretMargin;
248227
}
249228

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

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

0 commit comments

Comments
 (0)