[IMM32] Improve ImmAssociateContext readability

CORE-11700
This commit is contained in:
Katayama Hirofumi MZ 2022-10-20 12:32:45 +09:00
parent f9b2b1a6cd
commit 72c56c2f1f
2 changed files with 17 additions and 11 deletions

View file

@ -513,19 +513,23 @@ HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC)
return hIMC;
dwValue = NtUserAssociateInputContext(hWnd, hIMC, 0);
if (dwValue == 0)
return hOldIMC;
if (dwValue != 1)
return NULL;
hwndFocus = (HWND)NtUserQueryWindow(hWnd, QUERY_WINDOW_FOCUS);
if (hwndFocus == hWnd)
switch (dwValue)
{
ImmSetActiveContext(hWnd, hOldIMC, FALSE);
ImmSetActiveContext(hWnd, hIMC, TRUE);
}
case 0:
return hOldIMC;
return hOldIMC;
case 1:
hwndFocus = (HWND)NtUserQueryWindow(hWnd, QUERY_WINDOW_FOCUS);
if (hwndFocus == hWnd)
{
ImmSetActiveContext(hWnd, hOldIMC, FALSE);
ImmSetActiveContext(hWnd, hIMC, TRUE);
}
return hOldIMC;
default:
return NULL;
}
}
/***********************************************************************

View file

@ -207,6 +207,7 @@ LPSTR APIENTRY Imm32AnsiFromWide(LPCWSTR pszW)
}
/* Converts the character index */
/* Win: CalcCharacterPositionAtoW */
LONG APIENTRY IchWideFromAnsi(LONG cchAnsi, LPCSTR pchAnsi, UINT uCodePage)
{
LONG cchWide;
@ -227,6 +228,7 @@ LONG APIENTRY IchWideFromAnsi(LONG cchAnsi, LPCSTR pchAnsi, UINT uCodePage)
}
/* Converts the character index */
/* Win: CalcCharacterPositionWtoA */
LONG APIENTRY IchAnsiFromWide(LONG cchWide, LPCWSTR pchWide, UINT uCodePage)
{
LONG cb, cchAnsi;