https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e6a51b54c4cb74d8cf502…
commit e6a51b54c4cb74d8cf5021519b671fab4af129b1
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Fri Oct 1 03:10:26 2021 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Fri Oct 1 03:10:26 2021 +0900
[IMM32] Move ImmFreeLayout from ime.c to imm.c
CORE-11700
---
dll/win32/imm32/ime.c | 67 -----------------------------------------------
dll/win32/imm32/imm.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++
dll/win32/imm32/precomp.h | 1 +
3 files changed, 68 insertions(+), 67 deletions(-)
diff --git a/dll/win32/imm32/ime.c b/dll/win32/imm32/ime.c
index 7ae3325f323..e831a81fcee 100644
--- a/dll/win32/imm32/ime.c
+++ b/dll/win32/imm32/ime.c
@@ -1677,70 +1677,3 @@ ImmGetImeMenuItemsW(HIMC hIMC, DWORD dwFlags, DWORD dwType,
return Imm32GetImeMenuItemsAW(hIMC, dwFlags, dwType, lpImeParentMenu, lpImeMenu,
dwSize, FALSE);
}
-
-/***********************************************************************
- * ImmFreeLayout (IMM32.@)
- */
-BOOL WINAPI ImmFreeLayout(DWORD dwUnknown)
-{
- WCHAR szKBD[9];
- UINT iKL, cKLs;
- HKL hOldKL, hNewKL, *pList;
- PIMEDPI pImeDpi;
- LANGID LangID;
-
- TRACE("(0x%lX)\n", dwUnknown);
-
- hOldKL = GetKeyboardLayout(0);
-
- if (dwUnknown == 1)
- {
- if (!IS_IME_HKL(hOldKL))
- return TRUE;
-
- LangID = LANGIDFROMLCID(GetSystemDefaultLCID());
-
- cKLs = GetKeyboardLayoutList(0, NULL);
- if (cKLs)
- {
- pList = Imm32HeapAlloc(0, cKLs * sizeof(HKL));
- if (pList == NULL)
- return FALSE;
-
- cKLs = GetKeyboardLayoutList(cKLs, pList);
- for (iKL = 0; iKL < cKLs; ++iKL)
- {
- if (!IS_IME_HKL(pList[iKL]))
- {
- LangID = LOWORD(pList[iKL]);
- break;
- }
- }
-
- Imm32HeapFree(pList);
- }
-
- StringCchPrintfW(szKBD, _countof(szKBD), L"%08X", LangID);
- if (!LoadKeyboardLayoutW(szKBD, KLF_ACTIVATE))
- LoadKeyboardLayoutW(L"00000409", KLF_ACTIVATE | 0x200);
- }
- else if (dwUnknown == 2)
- {
- RtlEnterCriticalSection(&g_csImeDpi);
-Retry:
- for (pImeDpi = g_pImeDpiList; pImeDpi; pImeDpi = pImeDpi->pNext)
- {
- if (Imm32ReleaseIME(pImeDpi->hKL))
- goto Retry;
- }
- RtlLeaveCriticalSection(&g_csImeDpi);
- }
- else
- {
- hNewKL = (HKL)(DWORD_PTR)dwUnknown;
- if (IS_IME_HKL(hNewKL) && hNewKL != hOldKL)
- Imm32ReleaseIME(hNewKL);
- }
-
- return TRUE;
-}
diff --git a/dll/win32/imm32/imm.c b/dll/win32/imm32/imm.c
index 5cb72db884c..f458685e0ec 100644
--- a/dll/win32/imm32/imm.c
+++ b/dll/win32/imm32/imm.c
@@ -101,6 +101,73 @@ HKL WINAPI ImmLoadLayout(HKL hKL, PIMEINFOEX pImeInfoEx)
return hKL;
}
+/***********************************************************************
+ * ImmFreeLayout (IMM32.@)
+ */
+BOOL WINAPI ImmFreeLayout(DWORD dwUnknown)
+{
+ WCHAR szKBD[9];
+ UINT iKL, cKLs;
+ HKL hOldKL, hNewKL, *pList;
+ PIMEDPI pImeDpi;
+ LANGID LangID;
+
+ TRACE("(0x%lX)\n", dwUnknown);
+
+ hOldKL = GetKeyboardLayout(0);
+
+ if (dwUnknown == 1)
+ {
+ if (!IS_IME_HKL(hOldKL))
+ return TRUE;
+
+ LangID = LANGIDFROMLCID(GetSystemDefaultLCID());
+
+ cKLs = GetKeyboardLayoutList(0, NULL);
+ if (cKLs)
+ {
+ pList = Imm32HeapAlloc(0, cKLs * sizeof(HKL));
+ if (pList == NULL)
+ return FALSE;
+
+ cKLs = GetKeyboardLayoutList(cKLs, pList);
+ for (iKL = 0; iKL < cKLs; ++iKL)
+ {
+ if (!IS_IME_HKL(pList[iKL]))
+ {
+ LangID = LOWORD(pList[iKL]);
+ break;
+ }
+ }
+
+ Imm32HeapFree(pList);
+ }
+
+ StringCchPrintfW(szKBD, _countof(szKBD), L"%08X", LangID);
+ if (!LoadKeyboardLayoutW(szKBD, KLF_ACTIVATE))
+ LoadKeyboardLayoutW(L"00000409", KLF_ACTIVATE | 0x200);
+ }
+ else if (dwUnknown == 2)
+ {
+ RtlEnterCriticalSection(&g_csImeDpi);
+Retry:
+ for (pImeDpi = g_pImeDpiList; pImeDpi; pImeDpi = pImeDpi->pNext)
+ {
+ if (Imm32ReleaseIME(pImeDpi->hKL))
+ goto Retry;
+ }
+ RtlLeaveCriticalSection(&g_csImeDpi);
+ }
+ else
+ {
+ hNewKL = (HKL)(DWORD_PTR)dwUnknown;
+ if (IS_IME_HKL(hNewKL) && hNewKL != hOldKL)
+ Imm32ReleaseIME(hNewKL);
+ }
+
+ return TRUE;
+}
+
typedef struct _tagImmHkl
{
struct list entry;
diff --git a/dll/win32/imm32/precomp.h b/dll/win32/imm32/precomp.h
index 1bcc18bbb30..c5522127cc3 100644
--- a/dll/win32/imm32/precomp.h
+++ b/dll/win32/imm32/precomp.h
@@ -81,6 +81,7 @@ LPVOID APIENTRY Imm32HeapAlloc(DWORD dwFlags, DWORD dwBytes);
LPWSTR APIENTRY Imm32WideFromAnsi(LPCSTR pszA);
LPSTR APIENTRY Imm32AnsiFromWide(LPCWSTR pszW);
PIMEDPI APIENTRY ImmLockOrLoadImeDpi(HKL hKL);
+BOOL APIENTRY Imm32ReleaseIME(HKL hKL);
static inline BOOL Imm32IsCrossThreadAccess(HIMC hIMC)
{