mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 09:50:07 +00:00
[IMM32] Rewrite ImmRegisterWordW (#3892)
Implementing Japanese input... CORE-11700
This commit is contained in:
parent
1e62771c78
commit
94285dce4d
|
@ -3394,7 +3394,7 @@ BOOL WINAPI ImmRegisterWordA(
|
||||||
pszRegisterW[cch] = 0;
|
pszRegisterW[cch] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ImmRegisterWordW(hKL, pszReadingW, dwStyle, pszRegisterW);
|
ret = pImeDpi->ImeRegisterWord(pszReadingW, dwStyle, pszRegisterW);
|
||||||
|
|
||||||
Quit:
|
Quit:
|
||||||
if (pszReadingW)
|
if (pszReadingW)
|
||||||
|
@ -3411,28 +3411,56 @@ Quit:
|
||||||
BOOL WINAPI ImmRegisterWordW(
|
BOOL WINAPI ImmRegisterWordW(
|
||||||
HKL hKL, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR lpszRegister)
|
HKL hKL, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR lpszRegister)
|
||||||
{
|
{
|
||||||
ImmHkl *immHkl = IMM_GetImmHkl(hKL);
|
BOOL ret = FALSE;
|
||||||
TRACE("(%p, %s, %d, %s):\n", hKL, debugstr_w(lpszReading), dwStyle,
|
PIMEDPI pImeDpi;
|
||||||
debugstr_w(lpszRegister));
|
LPSTR pszReadingA = NULL, pszRegisterA = NULL;
|
||||||
if (immHkl->hIME && immHkl->pImeRegisterWord)
|
INT cchW, cchA;
|
||||||
{
|
|
||||||
if (is_kbd_ime_unicode(immHkl))
|
|
||||||
return immHkl->pImeRegisterWord(lpszReading,dwStyle,lpszRegister);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LPSTR lpszaReading = strdupWtoA(lpszReading);
|
|
||||||
LPSTR lpszaRegister = strdupWtoA(lpszRegister);
|
|
||||||
BOOL rc;
|
|
||||||
|
|
||||||
rc = immHkl->pImeRegisterWord((LPCWSTR)lpszaReading,dwStyle,
|
TRACE("(%p, %s, 0x%lX, %s)\n", hKL, debugstr_w(lpszReading), dwStyle,
|
||||||
(LPCWSTR)lpszaRegister);
|
debugstr_w(lpszRegister));
|
||||||
HeapFree(GetProcessHeap(),0,lpszaReading);
|
|
||||||
HeapFree(GetProcessHeap(),0,lpszaRegister);
|
pImeDpi = ImmLockOrLoadImeDpi(hKL);
|
||||||
return rc;
|
if (!pImeDpi)
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (pImeDpi->ImeInfo.fdwProperty & IME_PROP_UNICODE)
|
||||||
|
{
|
||||||
|
ret = pImeDpi->ImeRegisterWord(lpszReading, dwStyle, lpszRegister);
|
||||||
|
ImmUnlockImeDpi(pImeDpi);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lpszReading)
|
||||||
|
{
|
||||||
|
cchW = lstrlenW(lpszReading);
|
||||||
|
cchA = (cchW + 1) * sizeof(WCHAR);
|
||||||
|
pszReadingA = Imm32HeapAlloc(0, cchA);
|
||||||
|
if (!pszReadingA)
|
||||||
|
goto Quit;
|
||||||
|
cchA = WideCharToMultiByte(CP_ACP, 0, lpszReading, cchW, pszReadingA, cchA, NULL, NULL);
|
||||||
|
pszReadingA[cchA] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lpszRegister)
|
||||||
|
{
|
||||||
|
cchW = lstrlenW(lpszRegister);
|
||||||
|
cchA = (cchW + 1) * sizeof(WCHAR);
|
||||||
|
pszRegisterA = Imm32HeapAlloc(0, cchA);
|
||||||
|
if (!pszRegisterA)
|
||||||
|
goto Quit;
|
||||||
|
cchA = WideCharToMultiByte(CP_ACP, 0, lpszRegister, cchW, pszRegisterA, cchA, NULL, NULL);
|
||||||
|
pszRegisterA[cchA] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = pImeDpi->ImeRegisterWord(pszReadingA, dwStyle, pszRegisterA);
|
||||||
|
|
||||||
|
Quit:
|
||||||
|
if (pszReadingA)
|
||||||
|
HeapFree(g_hImm32Heap, 0, pszReadingA);
|
||||||
|
if (pszRegisterA)
|
||||||
|
HeapFree(g_hImm32Heap, 0, pszRegisterA);
|
||||||
|
ImmUnlockImeDpi(pImeDpi);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
|
Loading…
Reference in a new issue