xref: /reactos/win32ss/user/user32/misc/imm.c (revision dcf0788f)
1c2c66affSColin Finck /*
2c2c66affSColin Finck  * COPYRIGHT:       See COPYING in the top level directory
3c2c66affSColin Finck  * PROJECT:         ReactOS user32.dll
4c2c66affSColin Finck  * FILE:            win32ss/user/user32/misc/imm.c
5c2c66affSColin Finck  * PURPOSE:         User32.dll Imm functions
633fe4333SKatayama Hirofumi MZ  * PROGRAMMERS:     Dmitry Chapyshev (dmitry@reactos.org)
733fe4333SKatayama Hirofumi MZ  *                  Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
8c2c66affSColin Finck  */
9c2c66affSColin Finck 
10c2c66affSColin Finck #include <user32.h>
11c2c66affSColin Finck #include <strsafe.h>
128ea93d2aSKatayama Hirofumi MZ #include <immdev.h>
13c2c66affSColin Finck 
14c2c66affSColin Finck WINE_DEFAULT_DEBUG_CHANNEL(user32);
15c2c66affSColin Finck 
16c2c66affSColin Finck #define IMM_INIT_MAGIC 0x19650412
1799614febSKatayama Hirofumi MZ #define MAX_CANDIDATEFORM 4
18c2c66affSColin Finck 
192ab858c1SKatayama Hirofumi MZ /* Is != NULL when we have loaded the IMM ourselves */
2034600f3dSKatayama Hirofumi MZ HINSTANCE ghImm32 = NULL; // Win: ghImm32
212ab858c1SKatayama Hirofumi MZ 
2234600f3dSKatayama Hirofumi MZ BOOL gbImmInitializing = FALSE; // Win: bImmInitializing
23c2c66affSColin Finck 
2434600f3dSKatayama Hirofumi MZ INT gfConIme = -1; // Win: gfConIme
258c6dcdcfSKatayama Hirofumi MZ 
IntGetTopLevelWindow(HWND hWnd)26242e0b43SKatayama Hirofumi MZ HWND FASTCALL IntGetTopLevelWindow(HWND hWnd)
278c6dcdcfSKatayama Hirofumi MZ {
28242e0b43SKatayama Hirofumi MZ     DWORD style;
298c6dcdcfSKatayama Hirofumi MZ 
30242e0b43SKatayama Hirofumi MZ     for (; hWnd; hWnd = GetParent(hWnd))
31242e0b43SKatayama Hirofumi MZ     {
32242e0b43SKatayama Hirofumi MZ         style = (DWORD)GetWindowLongPtrW(hWnd, GWL_STYLE);
33242e0b43SKatayama Hirofumi MZ         if (!(style & WS_CHILD))
34242e0b43SKatayama Hirofumi MZ             break;
35242e0b43SKatayama Hirofumi MZ     }
368c6dcdcfSKatayama Hirofumi MZ 
37242e0b43SKatayama Hirofumi MZ     return hWnd;
388c6dcdcfSKatayama Hirofumi MZ }
398c6dcdcfSKatayama Hirofumi MZ 
4033fe4333SKatayama Hirofumi MZ /* define stub functions */
4133fe4333SKatayama Hirofumi MZ #undef DEFINE_IMM_ENTRY
4233fe4333SKatayama Hirofumi MZ #define DEFINE_IMM_ENTRY(type, name, params, retval, retkind) \
4333fe4333SKatayama Hirofumi MZ     static type WINAPI IMMSTUB_##name params { IMM_RETURN_##retkind((type)retval); }
4433fe4333SKatayama Hirofumi MZ #include "immtable.h"
45c2c66affSColin Finck 
4634600f3dSKatayama Hirofumi MZ // Win: gImmApiEntries
4733fe4333SKatayama Hirofumi MZ Imm32ApiTable gImmApiEntries = {
4833fe4333SKatayama Hirofumi MZ /* initialize by stubs */
4933fe4333SKatayama Hirofumi MZ #undef DEFINE_IMM_ENTRY
5033fe4333SKatayama Hirofumi MZ #define DEFINE_IMM_ENTRY(type, name, params, retval, retkind) \
5133fe4333SKatayama Hirofumi MZ     IMMSTUB_##name,
5233fe4333SKatayama Hirofumi MZ #include "immtable.h"
5333fe4333SKatayama Hirofumi MZ };
54c2c66affSColin Finck 
5534600f3dSKatayama Hirofumi MZ // Win: GetImmFileName
562ab858c1SKatayama Hirofumi MZ HRESULT
User32GetImmFileName(_Out_ LPWSTR lpBuffer,_In_ size_t cchBuffer)5734600f3dSKatayama Hirofumi MZ User32GetImmFileName(_Out_ LPWSTR lpBuffer, _In_ size_t cchBuffer)
58c45a6e15SJames Tabor {
592ab858c1SKatayama Hirofumi MZ     UINT length = GetSystemDirectoryW(lpBuffer, cchBuffer);
602ab858c1SKatayama Hirofumi MZ     if (length && length < cchBuffer)
61c45a6e15SJames Tabor     {
622ab858c1SKatayama Hirofumi MZ         StringCchCatW(lpBuffer, cchBuffer, L"\\");
632ab858c1SKatayama Hirofumi MZ         return StringCchCatW(lpBuffer, cchBuffer, L"imm32.dll");
64c45a6e15SJames Tabor     }
652ab858c1SKatayama Hirofumi MZ     return StringCchCopyW(lpBuffer, cchBuffer, L"imm32.dll");
66c45a6e15SJames Tabor }
67c45a6e15SJames Tabor 
6834600f3dSKatayama Hirofumi MZ // @unimplemented
6934600f3dSKatayama Hirofumi MZ // Win: _InitializeImmEntryTable
IntInitializeImmEntryTable(VOID)702ab858c1SKatayama Hirofumi MZ static BOOL IntInitializeImmEntryTable(VOID)
71c2c66affSColin Finck {
72c2c66affSColin Finck     WCHAR ImmFile[MAX_PATH];
73c2c66affSColin Finck     HMODULE imm32 = ghImm32;
74c2c66affSColin Finck 
752ab858c1SKatayama Hirofumi MZ     /* Check whether the IMM table has already been initialized */
762ab858c1SKatayama Hirofumi MZ     if (IMM_FN(ImmWINNLSEnableIME) != IMMSTUB_ImmWINNLSEnableIME)
772ab858c1SKatayama Hirofumi MZ         return TRUE;
78c2c66affSColin Finck 
7934600f3dSKatayama Hirofumi MZ     User32GetImmFileName(ImmFile, _countof(ImmFile));
802ab858c1SKatayama Hirofumi MZ     TRACE("File %S\n", ImmFile);
812ab858c1SKatayama Hirofumi MZ 
822ab858c1SKatayama Hirofumi MZ     /* If IMM32 is already loaded, use it without increasing reference count. */
83c2c66affSColin Finck     if (imm32 == NULL)
84c2c66affSColin Finck         imm32 = GetModuleHandleW(ImmFile);
85c2c66affSColin Finck 
862ab858c1SKatayama Hirofumi MZ     /*
872ab858c1SKatayama Hirofumi MZ      * Loading imm32.dll will call imm32!DllMain function.
882ab858c1SKatayama Hirofumi MZ      * imm32!DllMain calls User32InitializeImmEntryTable.
892ab858c1SKatayama Hirofumi MZ      * Thus, if imm32.dll was loaded, the table has been loaded.
902ab858c1SKatayama Hirofumi MZ      */
91c2c66affSColin Finck     if (imm32 == NULL)
92c2c66affSColin Finck     {
93c2c66affSColin Finck         imm32 = ghImm32 = LoadLibraryW(ImmFile);
94c2c66affSColin Finck         if (imm32 == NULL)
95c2c66affSColin Finck         {
962ab858c1SKatayama Hirofumi MZ             ERR("Did not load imm32.dll!\n");
97c2c66affSColin Finck             return FALSE;
98c2c66affSColin Finck         }
99c2c66affSColin Finck         return TRUE;
100c2c66affSColin Finck     }
101c2c66affSColin Finck 
10233fe4333SKatayama Hirofumi MZ /* load imm procedures */
10333fe4333SKatayama Hirofumi MZ #undef DEFINE_IMM_ENTRY
10433fe4333SKatayama Hirofumi MZ #define DEFINE_IMM_ENTRY(type, name, params, retval, retkind) \
10533fe4333SKatayama Hirofumi MZ     do { \
10633fe4333SKatayama Hirofumi MZ         FN_##name proc = (FN_##name)GetProcAddress(imm32, #name); \
1072ab858c1SKatayama Hirofumi MZ         if (!proc) { \
1082ab858c1SKatayama Hirofumi MZ             ERR("Could not load %s\n", #name); \
1092ab858c1SKatayama Hirofumi MZ             return FALSE; \
11033fe4333SKatayama Hirofumi MZ         } \
1112ab858c1SKatayama Hirofumi MZ         IMM_FN(name) = proc; \
11233fe4333SKatayama Hirofumi MZ     } while (0);
11333fe4333SKatayama Hirofumi MZ #include "immtable.h"
114c2c66affSColin Finck 
115c2c66affSColin Finck     return TRUE;
116c2c66affSColin Finck }
117c2c66affSColin Finck 
11834600f3dSKatayama Hirofumi MZ // Win: InitializeImmEntryTable
InitializeImmEntryTable(VOID)119c2c66affSColin Finck BOOL WINAPI InitializeImmEntryTable(VOID)
120c2c66affSColin Finck {
12134600f3dSKatayama Hirofumi MZ     gbImmInitializing = TRUE;
122c2c66affSColin Finck     return IntInitializeImmEntryTable();
123c2c66affSColin Finck }
124c2c66affSColin Finck 
12534600f3dSKatayama Hirofumi MZ // Win: User32InitializeImmEntryTable
User32InitializeImmEntryTable(DWORD magic)126c2c66affSColin Finck BOOL WINAPI User32InitializeImmEntryTable(DWORD magic)
127c2c66affSColin Finck {
128c45a6e15SJames Tabor     TRACE("Imm (%x)\n", magic);
129c2c66affSColin Finck 
130c2c66affSColin Finck     if (magic != IMM_INIT_MAGIC)
131c2c66affSColin Finck         return FALSE;
132c2c66affSColin Finck 
1332ab858c1SKatayama Hirofumi MZ     /* Check whether the IMM table has already been initialized */
1342ab858c1SKatayama Hirofumi MZ     if (IMM_FN(ImmWINNLSEnableIME) != IMMSTUB_ImmWINNLSEnableIME)
135c2c66affSColin Finck         return TRUE;
136c2c66affSColin Finck 
137c2c66affSColin Finck     IntInitializeImmEntryTable();
138c2c66affSColin Finck 
13934600f3dSKatayama Hirofumi MZ     if (ghImm32 == NULL && !gbImmInitializing)
140c2c66affSColin Finck     {
141c2c66affSColin Finck         WCHAR ImmFile[MAX_PATH];
14234600f3dSKatayama Hirofumi MZ         User32GetImmFileName(ImmFile, _countof(ImmFile));
143c2c66affSColin Finck         ghImm32 = LoadLibraryW(ImmFile);
144c2c66affSColin Finck         if (ghImm32 == NULL)
145c2c66affSColin Finck         {
1462ab858c1SKatayama Hirofumi MZ             ERR("Did not load imm32.dll!\n");
147c2c66affSColin Finck             return FALSE;
148c2c66affSColin Finck         }
149c2c66affSColin Finck     }
15033fe4333SKatayama Hirofumi MZ 
1512ab858c1SKatayama Hirofumi MZ     return IMM_FN(ImmRegisterClient)(&gSharedInfo, ghImm32);
152c2c66affSColin Finck }
153c2c66affSColin Finck 
15434600f3dSKatayama Hirofumi MZ // Win: ImeIsUsableContext
User32CanSetImeWindowToImc(HIMC hIMC,HWND hImeWnd)15523bb2703SKatayama Hirofumi MZ static BOOL User32CanSetImeWindowToImc(HIMC hIMC, HWND hImeWnd)
156fc62d268SKatayama Hirofumi MZ {
157fc62d268SKatayama Hirofumi MZ     PIMC pIMC = ValidateHandle(hIMC, TYPE_INPUTCONTEXT);
15823bb2703SKatayama Hirofumi MZ     return pIMC && (!pIMC->hImeWnd || pIMC->hImeWnd == hImeWnd || !ValidateHwnd(pIMC->hImeWnd));
15923bb2703SKatayama Hirofumi MZ }
16023bb2703SKatayama Hirofumi MZ 
16134600f3dSKatayama Hirofumi MZ // Win: GetIMEShowStatus
User32GetImeShowStatus(VOID)16223bb2703SKatayama Hirofumi MZ static BOOL User32GetImeShowStatus(VOID)
16323bb2703SKatayama Hirofumi MZ {
16423bb2703SKatayama Hirofumi MZ     return (BOOL)NtUserCallNoParam(NOPARAM_ROUTINE_GETIMESHOWSTATUS);
16523bb2703SKatayama Hirofumi MZ }
16623bb2703SKatayama Hirofumi MZ 
16725fcdc5cSKatayama Hirofumi MZ /* Sends a message to the IME UI window. */
16825fcdc5cSKatayama Hirofumi MZ /* Win: SendMessageToUI(pimeui, uMsg, wParam, lParam, !unicode) */
16923bb2703SKatayama Hirofumi MZ static LRESULT
User32SendImeUIMessage(PIMEUI pimeui,UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL unicode)17023bb2703SKatayama Hirofumi MZ User32SendImeUIMessage(PIMEUI pimeui, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
17123bb2703SKatayama Hirofumi MZ {
17223bb2703SKatayama Hirofumi MZ     LRESULT ret = 0;
17323bb2703SKatayama Hirofumi MZ     HWND hwndUI = pimeui->hwndUI;
17423bb2703SKatayama Hirofumi MZ     PWND pwnd, pwndUI;
17523bb2703SKatayama Hirofumi MZ 
176c35488ecSKatayama Hirofumi MZ     ASSERT(pimeui->spwnd != NULL);
177c35488ecSKatayama Hirofumi MZ 
17823bb2703SKatayama Hirofumi MZ     pwnd = pimeui->spwnd;
17923bb2703SKatayama Hirofumi MZ     pwndUI = ValidateHwnd(hwndUI);
18023bb2703SKatayama Hirofumi MZ     if (!pwnd || (pwnd->state & WNDS_DESTROYED) || (pwnd->state2 & WNDS2_INDESTROY) ||
18123bb2703SKatayama Hirofumi MZ         !pwndUI || (pwndUI->state & WNDS_DESTROYED) || (pwndUI->state2 & WNDS2_INDESTROY))
18223bb2703SKatayama Hirofumi MZ     {
18323bb2703SKatayama Hirofumi MZ         return 0;
18423bb2703SKatayama Hirofumi MZ     }
18523bb2703SKatayama Hirofumi MZ 
18623bb2703SKatayama Hirofumi MZ     InterlockedIncrement(&pimeui->nCntInIMEProc);
18723bb2703SKatayama Hirofumi MZ 
18823bb2703SKatayama Hirofumi MZ     if (unicode)
18923bb2703SKatayama Hirofumi MZ         ret = SendMessageW(hwndUI, uMsg, wParam, lParam);
19023bb2703SKatayama Hirofumi MZ     else
19123bb2703SKatayama Hirofumi MZ         ret = SendMessageA(hwndUI, uMsg, wParam, lParam);
19223bb2703SKatayama Hirofumi MZ 
19323bb2703SKatayama Hirofumi MZ     InterlockedDecrement(&pimeui->nCntInIMEProc);
19423bb2703SKatayama Hirofumi MZ 
19523bb2703SKatayama Hirofumi MZ     return ret;
19623bb2703SKatayama Hirofumi MZ }
19723bb2703SKatayama Hirofumi MZ 
19834600f3dSKatayama Hirofumi MZ // Win: SendOpenStatusNotify
User32NotifyOpenStatus(PIMEUI pimeui,HWND hwndIMC,BOOL bOpen)19923bb2703SKatayama Hirofumi MZ static VOID User32NotifyOpenStatus(PIMEUI pimeui, HWND hwndIMC, BOOL bOpen)
20023bb2703SKatayama Hirofumi MZ {
20123bb2703SKatayama Hirofumi MZ     WPARAM wParam = (bOpen ? IMN_OPENSTATUSWINDOW : IMN_CLOSESTATUSWINDOW);
20223bb2703SKatayama Hirofumi MZ 
203c35488ecSKatayama Hirofumi MZ     ASSERT(pimeui->spwnd != NULL);
204c35488ecSKatayama Hirofumi MZ 
20523bb2703SKatayama Hirofumi MZ     pimeui->fShowStatus = bOpen;
20623bb2703SKatayama Hirofumi MZ 
20723bb2703SKatayama Hirofumi MZ     if (LOWORD(GetWin32ClientInfo()->dwExpWinVer) >= 0x400)
20823bb2703SKatayama Hirofumi MZ         SendMessageW(hwndIMC, WM_IME_NOTIFY, wParam, 0);
20923bb2703SKatayama Hirofumi MZ     else
21023bb2703SKatayama Hirofumi MZ         User32SendImeUIMessage(pimeui, WM_IME_NOTIFY, wParam, 0, TRUE);
21123bb2703SKatayama Hirofumi MZ }
21223bb2703SKatayama Hirofumi MZ 
21334600f3dSKatayama Hirofumi MZ // Win: ImeMarkUsedContext
User32SetImeWindowOfImc(HIMC hIMC,HWND hImeWnd)21423bb2703SKatayama Hirofumi MZ static VOID User32SetImeWindowOfImc(HIMC hIMC, HWND hImeWnd)
21523bb2703SKatayama Hirofumi MZ {
21623bb2703SKatayama Hirofumi MZ     PIMC pIMC = ValidateHandle(hIMC, TYPE_INPUTCONTEXT);
21723bb2703SKatayama Hirofumi MZ     if (!pIMC || pIMC->hImeWnd == hImeWnd)
21823bb2703SKatayama Hirofumi MZ         return;
21923bb2703SKatayama Hirofumi MZ 
22023bb2703SKatayama Hirofumi MZ     NtUserUpdateInputContext(hIMC, UIC_IMEWINDOW, (ULONG_PTR)hImeWnd);
22123bb2703SKatayama Hirofumi MZ }
22223bb2703SKatayama Hirofumi MZ 
22334600f3dSKatayama Hirofumi MZ // Win: ImeSetImc
User32UpdateImcOfImeUI(PIMEUI pimeui,HIMC hNewIMC)22423bb2703SKatayama Hirofumi MZ static VOID User32UpdateImcOfImeUI(PIMEUI pimeui, HIMC hNewIMC)
22523bb2703SKatayama Hirofumi MZ {
226c35488ecSKatayama Hirofumi MZ     HWND hImeWnd;
22723bb2703SKatayama Hirofumi MZ     HIMC hOldIMC = pimeui->hIMC;
22823bb2703SKatayama Hirofumi MZ 
229c35488ecSKatayama Hirofumi MZ     ASSERT(pimeui->spwnd != NULL);
230c35488ecSKatayama Hirofumi MZ     hImeWnd = UserHMGetHandle(pimeui->spwnd);
231c35488ecSKatayama Hirofumi MZ 
23223bb2703SKatayama Hirofumi MZ     if (hNewIMC == hOldIMC)
23323bb2703SKatayama Hirofumi MZ         return;
23423bb2703SKatayama Hirofumi MZ 
23523bb2703SKatayama Hirofumi MZ     if (hOldIMC)
23623bb2703SKatayama Hirofumi MZ         User32SetImeWindowOfImc(hOldIMC, NULL);
23723bb2703SKatayama Hirofumi MZ 
23823bb2703SKatayama Hirofumi MZ     pimeui->hIMC = hNewIMC;
23923bb2703SKatayama Hirofumi MZ 
24023bb2703SKatayama Hirofumi MZ     if (hNewIMC)
24123bb2703SKatayama Hirofumi MZ         User32SetImeWindowOfImc(hNewIMC, hImeWnd);
24223bb2703SKatayama Hirofumi MZ }
24323bb2703SKatayama Hirofumi MZ 
24425fcdc5cSKatayama Hirofumi MZ /* Handles WM_IME_NOTIFY message of the default IME window. */
24525fcdc5cSKatayama Hirofumi MZ /* Win: ImeNotifyHandler */
ImeWnd_OnImeNotify(PIMEUI pimeui,WPARAM wParam,LPARAM lParam)24682136b3eSKatayama Hirofumi MZ static LRESULT ImeWnd_OnImeNotify(PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
24782136b3eSKatayama Hirofumi MZ {
24882136b3eSKatayama Hirofumi MZ     LRESULT ret = 0;
24982136b3eSKatayama Hirofumi MZ     HIMC hIMC;
25082136b3eSKatayama Hirofumi MZ     LPINPUTCONTEXT pIC;
251c35488ecSKatayama Hirofumi MZ     HWND hwndUI, hwndIMC, hImeWnd, hwndOwner;
252c35488ecSKatayama Hirofumi MZ 
253c35488ecSKatayama Hirofumi MZ     ASSERT(pimeui->spwnd != NULL);
25482136b3eSKatayama Hirofumi MZ 
25582136b3eSKatayama Hirofumi MZ     switch (wParam)
25682136b3eSKatayama Hirofumi MZ     {
25782136b3eSKatayama Hirofumi MZ         case IMN_SETCONVERSIONMODE:
25882136b3eSKatayama Hirofumi MZ         case IMN_SETOPENSTATUS:
25982136b3eSKatayama Hirofumi MZ             hIMC = pimeui->hIMC;
26082136b3eSKatayama Hirofumi MZ             pIC = IMM_FN(ImmLockIMC)(hIMC);
26182136b3eSKatayama Hirofumi MZ             if (pIC)
26282136b3eSKatayama Hirofumi MZ             {
26382136b3eSKatayama Hirofumi MZ                 hwndIMC = pimeui->hwndIMC;
26482136b3eSKatayama Hirofumi MZ                 if (IsWindow(hwndIMC))
26582136b3eSKatayama Hirofumi MZ                 {
26682136b3eSKatayama Hirofumi MZ                     NtUserNotifyIMEStatus(hwndIMC, pIC->fOpen, pIC->fdwConversion);
26782136b3eSKatayama Hirofumi MZ                 }
268c35488ecSKatayama Hirofumi MZ                 else if (gfConIme == TRUE && pimeui->spwnd)
26982136b3eSKatayama Hirofumi MZ                 {
270c35488ecSKatayama Hirofumi MZ                     hImeWnd = UserHMGetHandle(pimeui->spwnd);
271c35488ecSKatayama Hirofumi MZ                     hwndOwner = GetWindow(hImeWnd, GW_OWNER);
272c35488ecSKatayama Hirofumi MZ                     if (hwndOwner)
273c35488ecSKatayama Hirofumi MZ                     {
274c35488ecSKatayama Hirofumi MZ                         NtUserNotifyIMEStatus(hwndOwner, pIC->fOpen, pIC->fdwConversion);
275c35488ecSKatayama Hirofumi MZ                     }
27682136b3eSKatayama Hirofumi MZ                 }
27782136b3eSKatayama Hirofumi MZ 
27882136b3eSKatayama Hirofumi MZ                 IMM_FN(ImmUnlockIMC)(hIMC);
27982136b3eSKatayama Hirofumi MZ             }
28082136b3eSKatayama Hirofumi MZ             /* FALL THROUGH */
28182136b3eSKatayama Hirofumi MZ         default:
28282136b3eSKatayama Hirofumi MZ             ret = User32SendImeUIMessage(pimeui, WM_IME_NOTIFY, wParam, lParam, TRUE);
28382136b3eSKatayama Hirofumi MZ             break;
28482136b3eSKatayama Hirofumi MZ 
28582136b3eSKatayama Hirofumi MZ         case IMN_PRIVATE:
28682136b3eSKatayama Hirofumi MZ             hwndUI = pimeui->hwndUI;
28782136b3eSKatayama Hirofumi MZ             if (IsWindow(hwndUI))
28882136b3eSKatayama Hirofumi MZ                 ret = SendMessageW(hwndUI, WM_IME_NOTIFY, wParam, lParam);
28982136b3eSKatayama Hirofumi MZ             break;
29082136b3eSKatayama Hirofumi MZ     }
29182136b3eSKatayama Hirofumi MZ 
29282136b3eSKatayama Hirofumi MZ     return ret;
29382136b3eSKatayama Hirofumi MZ }
29482136b3eSKatayama Hirofumi MZ 
29525fcdc5cSKatayama Hirofumi MZ /* Creates the IME UI window. */
29625fcdc5cSKatayama Hirofumi MZ /* Win: CreateIMEUI */
User32CreateImeUIWindow(PIMEUI pimeui,HKL hKL)29723bb2703SKatayama Hirofumi MZ static HWND User32CreateImeUIWindow(PIMEUI pimeui, HKL hKL)
29823bb2703SKatayama Hirofumi MZ {
29923bb2703SKatayama Hirofumi MZ     IMEINFOEX ImeInfoEx;
30023bb2703SKatayama Hirofumi MZ     PIMEDPI pImeDpi;
30123bb2703SKatayama Hirofumi MZ     WNDCLASSW wc;
30223bb2703SKatayama Hirofumi MZ     HWND hwndUI = NULL;
30323bb2703SKatayama Hirofumi MZ     CHAR szUIClass[32];
30423bb2703SKatayama Hirofumi MZ     PWND pwnd = pimeui->spwnd;
30523bb2703SKatayama Hirofumi MZ 
306c35488ecSKatayama Hirofumi MZ     ASSERT(pimeui->spwnd != NULL);
307c35488ecSKatayama Hirofumi MZ 
30823bb2703SKatayama Hirofumi MZ     if (!pwnd || !IMM_FN(ImmGetImeInfoEx)(&ImeInfoEx, ImeInfoExKeyboardLayout, &hKL))
30923bb2703SKatayama Hirofumi MZ         return NULL;
31023bb2703SKatayama Hirofumi MZ 
31123bb2703SKatayama Hirofumi MZ     pImeDpi = IMM_FN(ImmLockImeDpi)(hKL);
31223bb2703SKatayama Hirofumi MZ     if (!pImeDpi)
31323bb2703SKatayama Hirofumi MZ         return NULL;
31423bb2703SKatayama Hirofumi MZ 
31523bb2703SKatayama Hirofumi MZ     if (!GetClassInfoW(pImeDpi->hInst, ImeInfoEx.wszUIClass, &wc))
31623bb2703SKatayama Hirofumi MZ         goto Quit;
31723bb2703SKatayama Hirofumi MZ 
31823bb2703SKatayama Hirofumi MZ     if (ImeInfoEx.ImeInfo.fdwProperty & IME_PROP_UNICODE)
31923bb2703SKatayama Hirofumi MZ     {
32023bb2703SKatayama Hirofumi MZ         hwndUI = CreateWindowW(ImeInfoEx.wszUIClass, ImeInfoEx.wszUIClass, WS_POPUP | WS_DISABLED,
32123bb2703SKatayama Hirofumi MZ                                0, 0, 0, 0, UserHMGetHandle(pwnd), 0, wc.hInstance, NULL);
32223bb2703SKatayama Hirofumi MZ     }
32323bb2703SKatayama Hirofumi MZ     else
32423bb2703SKatayama Hirofumi MZ     {
32523bb2703SKatayama Hirofumi MZ         WideCharToMultiByte(CP_ACP, 0, ImeInfoEx.wszUIClass, -1,
32623bb2703SKatayama Hirofumi MZ                             szUIClass, _countof(szUIClass), NULL, NULL);
32723bb2703SKatayama Hirofumi MZ         szUIClass[_countof(szUIClass) - 1] = 0;
32823bb2703SKatayama Hirofumi MZ 
32923bb2703SKatayama Hirofumi MZ         hwndUI = CreateWindowA(szUIClass, szUIClass, WS_POPUP | WS_DISABLED,
33023bb2703SKatayama Hirofumi MZ                                0, 0, 0, 0, UserHMGetHandle(pwnd), 0, wc.hInstance, NULL);
33123bb2703SKatayama Hirofumi MZ     }
33223bb2703SKatayama Hirofumi MZ 
33323bb2703SKatayama Hirofumi MZ     if (hwndUI)
33493955f37SKatayama Hirofumi MZ         NtUserSetWindowLongPtr(hwndUI, IMMGWLP_IMC, (LONG_PTR)pimeui->hIMC, FALSE);
33523bb2703SKatayama Hirofumi MZ 
33623bb2703SKatayama Hirofumi MZ Quit:
33723bb2703SKatayama Hirofumi MZ     IMM_FN(ImmUnlockImeDpi)(pImeDpi);
33823bb2703SKatayama Hirofumi MZ     return hwndUI;
339fc62d268SKatayama Hirofumi MZ }
340fc62d268SKatayama Hirofumi MZ 
34125fcdc5cSKatayama Hirofumi MZ /* Initializes the default IME window. */
34225fcdc5cSKatayama Hirofumi MZ /* Win: ImeWndCreateHandler */
ImeWnd_OnCreate(PIMEUI pimeui,LPCREATESTRUCT lpCS)343c06ccceaSKatayama Hirofumi MZ static INT ImeWnd_OnCreate(PIMEUI pimeui, LPCREATESTRUCT lpCS)
344fc62d268SKatayama Hirofumi MZ {
345fc62d268SKatayama Hirofumi MZ     PWND pParentWnd, pWnd = pimeui->spwnd;
34623bb2703SKatayama Hirofumi MZ     HIMC hIMC = NULL;
347fc62d268SKatayama Hirofumi MZ 
348fc62d268SKatayama Hirofumi MZ     if (!pWnd || (pWnd->style & (WS_DISABLED | WS_POPUP)) != (WS_DISABLED | WS_POPUP))
349c06ccceaSKatayama Hirofumi MZ         return -1;
350fc62d268SKatayama Hirofumi MZ 
351fc62d268SKatayama Hirofumi MZ     pParentWnd = ValidateHwnd(lpCS->hwndParent);
352fc62d268SKatayama Hirofumi MZ     if (pParentWnd)
353fc62d268SKatayama Hirofumi MZ     {
354fc62d268SKatayama Hirofumi MZ         hIMC = pParentWnd->hImc;
35523bb2703SKatayama Hirofumi MZ         if (hIMC && !User32CanSetImeWindowToImc(hIMC, UserHMGetHandle(pWnd)))
35623bb2703SKatayama Hirofumi MZ             hIMC = NULL;
357fc62d268SKatayama Hirofumi MZ     }
358fc62d268SKatayama Hirofumi MZ 
35923bb2703SKatayama Hirofumi MZ     User32UpdateImcOfImeUI(pimeui, hIMC);
36023bb2703SKatayama Hirofumi MZ 
361fc62d268SKatayama Hirofumi MZ     pimeui->fShowStatus = FALSE;
362fc62d268SKatayama Hirofumi MZ     pimeui->nCntInIMEProc = 0;
363fc62d268SKatayama Hirofumi MZ     pimeui->fActivate = FALSE;
364fc62d268SKatayama Hirofumi MZ     pimeui->fDestroy = FALSE;
365fc62d268SKatayama Hirofumi MZ     pimeui->hwndIMC = NULL;
366fc62d268SKatayama Hirofumi MZ     pimeui->hKL = GetWin32ClientInfo()->hKL;
367fc62d268SKatayama Hirofumi MZ     pimeui->fCtrlShowStatus = TRUE;
368c06ccceaSKatayama Hirofumi MZ     pimeui->dwLastStatus = 0;
369fc62d268SKatayama Hirofumi MZ 
370c06ccceaSKatayama Hirofumi MZ     return 0;
371fc62d268SKatayama Hirofumi MZ }
372fc62d268SKatayama Hirofumi MZ 
37325fcdc5cSKatayama Hirofumi MZ /* Destroys the IME UI window. */
37425fcdc5cSKatayama Hirofumi MZ /* Win: DestroyIMEUI */
User32DestroyImeUIWindow(PIMEUI pimeui)37523bb2703SKatayama Hirofumi MZ static VOID User32DestroyImeUIWindow(PIMEUI pimeui)
376fc62d268SKatayama Hirofumi MZ {
377fc62d268SKatayama Hirofumi MZ     HWND hwndUI = pimeui->hwndUI;
378fc62d268SKatayama Hirofumi MZ 
379fc62d268SKatayama Hirofumi MZ     if (IsWindow(hwndUI))
380fc62d268SKatayama Hirofumi MZ     {
381fc62d268SKatayama Hirofumi MZ         pimeui->fDestroy = TRUE;
382fc62d268SKatayama Hirofumi MZ         NtUserDestroyWindow(hwndUI);
383fc62d268SKatayama Hirofumi MZ     }
384fc62d268SKatayama Hirofumi MZ 
385fc62d268SKatayama Hirofumi MZ     pimeui->fShowStatus = pimeui->fDestroy = FALSE;
386fc62d268SKatayama Hirofumi MZ     pimeui->hwndUI = NULL;
387fc62d268SKatayama Hirofumi MZ }
388fc62d268SKatayama Hirofumi MZ 
38925fcdc5cSKatayama Hirofumi MZ /* Handles WM_IME_SELECT message of the default IME window. */
39025fcdc5cSKatayama Hirofumi MZ /* Win: ImeSelectHandler */
ImeWnd_OnImeSelect(PIMEUI pimeui,WPARAM wParam,LPARAM lParam)3913fc83b43SKatayama Hirofumi MZ static VOID ImeWnd_OnImeSelect(PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
39223bb2703SKatayama Hirofumi MZ {
39323bb2703SKatayama Hirofumi MZ     HKL hKL;
39423bb2703SKatayama Hirofumi MZ     HWND hwndUI, hwndIMC = pimeui->hwndIMC;
39523bb2703SKatayama Hirofumi MZ 
39623bb2703SKatayama Hirofumi MZ     if (wParam)
39723bb2703SKatayama Hirofumi MZ     {
39823bb2703SKatayama Hirofumi MZ         pimeui->hKL = hKL = (HKL)lParam;
399c06ccceaSKatayama Hirofumi MZ 
400c06ccceaSKatayama Hirofumi MZ         if (!pimeui->fActivate)
401c06ccceaSKatayama Hirofumi MZ             return;
402c06ccceaSKatayama Hirofumi MZ 
40323bb2703SKatayama Hirofumi MZ         pimeui->hwndUI = hwndUI = User32CreateImeUIWindow(pimeui, hKL);
40423bb2703SKatayama Hirofumi MZ         if (hwndUI)
40523bb2703SKatayama Hirofumi MZ             User32SendImeUIMessage(pimeui, WM_IME_SELECT, wParam, lParam, TRUE);
40623bb2703SKatayama Hirofumi MZ 
40723bb2703SKatayama Hirofumi MZ         if (User32GetImeShowStatus() && pimeui->fCtrlShowStatus)
40823bb2703SKatayama Hirofumi MZ         {
40923bb2703SKatayama Hirofumi MZ             if (!pimeui->fShowStatus && pimeui->fActivate && IsWindow(hwndIMC))
41023bb2703SKatayama Hirofumi MZ                 User32NotifyOpenStatus(pimeui, hwndIMC, TRUE);
41123bb2703SKatayama Hirofumi MZ         }
41223bb2703SKatayama Hirofumi MZ     }
41323bb2703SKatayama Hirofumi MZ     else
41423bb2703SKatayama Hirofumi MZ     {
41523bb2703SKatayama Hirofumi MZ         if (pimeui->fShowStatus && pimeui->fActivate && IsWindow(hwndIMC))
41623bb2703SKatayama Hirofumi MZ             User32NotifyOpenStatus(pimeui, hwndIMC, FALSE);
41723bb2703SKatayama Hirofumi MZ 
41823bb2703SKatayama Hirofumi MZ         User32SendImeUIMessage(pimeui, WM_IME_SELECT, wParam, lParam, TRUE);
41923bb2703SKatayama Hirofumi MZ         User32DestroyImeUIWindow(pimeui);
42023bb2703SKatayama Hirofumi MZ         pimeui->hKL = NULL;
42123bb2703SKatayama Hirofumi MZ     }
42223bb2703SKatayama Hirofumi MZ }
42323bb2703SKatayama Hirofumi MZ 
42425fcdc5cSKatayama Hirofumi MZ /* Handles WM_IME_CONTROL message of the default IME window. */
42525fcdc5cSKatayama Hirofumi MZ /* Win: ImeControlHandler(pimeui, wParam, lParam, !unicode) */
4263fc83b43SKatayama Hirofumi MZ static LRESULT
ImeWnd_OnImeControl(PIMEUI pimeui,WPARAM wParam,LPARAM lParam,BOOL unicode)4273fc83b43SKatayama Hirofumi MZ ImeWnd_OnImeControl(PIMEUI pimeui, WPARAM wParam, LPARAM lParam, BOOL unicode)
4283fc83b43SKatayama Hirofumi MZ {
4293fc83b43SKatayama Hirofumi MZ     HIMC hIMC = pimeui->hIMC;
4303fc83b43SKatayama Hirofumi MZ     DWORD dwConversion, dwSentence;
4313fc83b43SKatayama Hirofumi MZ     POINT pt;
4323fc83b43SKatayama Hirofumi MZ 
433c06ccceaSKatayama Hirofumi MZ     if (IS_CICERO_MODE())
434c06ccceaSKatayama Hirofumi MZ     {
435c06ccceaSKatayama Hirofumi MZ         if (wParam == IMC_OPENSTATUSWINDOW)
436c06ccceaSKatayama Hirofumi MZ         {
437c06ccceaSKatayama Hirofumi MZ             IMM_FN(CtfImmRestoreToolbarWnd)(pimeui->dwLastStatus);
438c06ccceaSKatayama Hirofumi MZ             pimeui->dwLastStatus = 0;
439c06ccceaSKatayama Hirofumi MZ         }
440c06ccceaSKatayama Hirofumi MZ         else if (wParam == IMC_CLOSESTATUSWINDOW)
441c06ccceaSKatayama Hirofumi MZ         {
442c06ccceaSKatayama Hirofumi MZ             pimeui->dwLastStatus = IMM_FN(CtfImmHideToolbarWnd)();
443c06ccceaSKatayama Hirofumi MZ         }
444c06ccceaSKatayama Hirofumi MZ     }
445c06ccceaSKatayama Hirofumi MZ 
4463fc83b43SKatayama Hirofumi MZ     if (!hIMC)
4473fc83b43SKatayama Hirofumi MZ         return 0;
4483fc83b43SKatayama Hirofumi MZ 
4493fc83b43SKatayama Hirofumi MZ     switch (wParam)
4503fc83b43SKatayama Hirofumi MZ     {
4513fc83b43SKatayama Hirofumi MZ         case IMC_GETCONVERSIONMODE:
4523fc83b43SKatayama Hirofumi MZ             if (!IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence))
4533fc83b43SKatayama Hirofumi MZ                 return 1;
4543fc83b43SKatayama Hirofumi MZ             return dwConversion;
4553fc83b43SKatayama Hirofumi MZ 
4563fc83b43SKatayama Hirofumi MZ         case IMC_GETSENTENCEMODE:
4573fc83b43SKatayama Hirofumi MZ             if (!IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence))
4583fc83b43SKatayama Hirofumi MZ                 return 1;
4593fc83b43SKatayama Hirofumi MZ             return dwSentence;
4603fc83b43SKatayama Hirofumi MZ 
4613fc83b43SKatayama Hirofumi MZ         case IMC_GETOPENSTATUS:
4623fc83b43SKatayama Hirofumi MZ             return IMM_FN(ImmGetOpenStatus)(hIMC);
4633fc83b43SKatayama Hirofumi MZ 
4643fc83b43SKatayama Hirofumi MZ         case IMC_SETCONVERSIONMODE:
4653fc83b43SKatayama Hirofumi MZ             if (!IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence) ||
4663fc83b43SKatayama Hirofumi MZ                 !IMM_FN(ImmSetConversionStatus)(hIMC, (DWORD)lParam, dwSentence))
4673fc83b43SKatayama Hirofumi MZ             {
4683fc83b43SKatayama Hirofumi MZ                 return 1;
4693fc83b43SKatayama Hirofumi MZ             }
4703fc83b43SKatayama Hirofumi MZ             break;
4713fc83b43SKatayama Hirofumi MZ 
4723fc83b43SKatayama Hirofumi MZ         case IMC_SETSENTENCEMODE:
4733fc83b43SKatayama Hirofumi MZ             if (!IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence) ||
4743fc83b43SKatayama Hirofumi MZ                 !IMM_FN(ImmSetConversionStatus)(hIMC, dwConversion, (DWORD)lParam))
4753fc83b43SKatayama Hirofumi MZ             {
4763fc83b43SKatayama Hirofumi MZ                 return 1;
4773fc83b43SKatayama Hirofumi MZ             }
4783fc83b43SKatayama Hirofumi MZ             break;
4793fc83b43SKatayama Hirofumi MZ 
4803fc83b43SKatayama Hirofumi MZ         case IMC_SETOPENSTATUS:
4813fc83b43SKatayama Hirofumi MZ             if (!IMM_FN(ImmSetOpenStatus)(hIMC, (BOOL)lParam))
4823fc83b43SKatayama Hirofumi MZ                 return 1;
4833fc83b43SKatayama Hirofumi MZ             break;
4843fc83b43SKatayama Hirofumi MZ 
4853fc83b43SKatayama Hirofumi MZ         case IMC_GETCANDIDATEPOS:
4863fc83b43SKatayama Hirofumi MZ         case IMC_GETCOMPOSITIONWINDOW:
4873fc83b43SKatayama Hirofumi MZ         case IMC_GETSOFTKBDPOS:
4883fc83b43SKatayama Hirofumi MZ         case IMC_SETSOFTKBDPOS:
4893fc83b43SKatayama Hirofumi MZ         case IMC_GETSTATUSWINDOWPOS:
4903fc83b43SKatayama Hirofumi MZ             return User32SendImeUIMessage(pimeui, WM_IME_CONTROL, wParam, lParam, unicode);
4913fc83b43SKatayama Hirofumi MZ 
4923fc83b43SKatayama Hirofumi MZ         case IMC_SETCANDIDATEPOS:
4933fc83b43SKatayama Hirofumi MZ             if (!IMM_FN(ImmSetCandidateWindow)(hIMC, (LPCANDIDATEFORM)lParam))
4943fc83b43SKatayama Hirofumi MZ                 return 1;
4953fc83b43SKatayama Hirofumi MZ             break;
4963fc83b43SKatayama Hirofumi MZ 
4973fc83b43SKatayama Hirofumi MZ         case IMC_GETCOMPOSITIONFONT:
4983fc83b43SKatayama Hirofumi MZ             if (unicode)
4993fc83b43SKatayama Hirofumi MZ             {
5003fc83b43SKatayama Hirofumi MZ                 if (!IMM_FN(ImmGetCompositionFontW)(hIMC, (LPLOGFONTW)lParam))
5013fc83b43SKatayama Hirofumi MZ                     return 1;
5023fc83b43SKatayama Hirofumi MZ             }
5033fc83b43SKatayama Hirofumi MZ             else
5043fc83b43SKatayama Hirofumi MZ             {
5053fc83b43SKatayama Hirofumi MZ                 if (!IMM_FN(ImmGetCompositionFontA)(hIMC, (LPLOGFONTA)lParam))
5063fc83b43SKatayama Hirofumi MZ                     return 1;
5073fc83b43SKatayama Hirofumi MZ             }
5083fc83b43SKatayama Hirofumi MZ             break;
5093fc83b43SKatayama Hirofumi MZ 
5103fc83b43SKatayama Hirofumi MZ         case IMC_SETCOMPOSITIONFONT:
5113fc83b43SKatayama Hirofumi MZ             if (unicode)
5123fc83b43SKatayama Hirofumi MZ             {
5133fc83b43SKatayama Hirofumi MZ                 if (!IMM_FN(ImmSetCompositionFontW)(hIMC, (LPLOGFONTW)lParam))
5143fc83b43SKatayama Hirofumi MZ                     return 1;
5153fc83b43SKatayama Hirofumi MZ             }
5163fc83b43SKatayama Hirofumi MZ             else
5173fc83b43SKatayama Hirofumi MZ             {
5183fc83b43SKatayama Hirofumi MZ                 if (!IMM_FN(ImmSetCompositionFontA)(hIMC, (LPLOGFONTA)lParam))
5193fc83b43SKatayama Hirofumi MZ                     return 1;
5203fc83b43SKatayama Hirofumi MZ             }
5213fc83b43SKatayama Hirofumi MZ             break;
5223fc83b43SKatayama Hirofumi MZ 
5233fc83b43SKatayama Hirofumi MZ         case IMC_SETCOMPOSITIONWINDOW:
5243fc83b43SKatayama Hirofumi MZ             if (!IMM_FN(ImmSetCompositionWindow)(hIMC, (LPCOMPOSITIONFORM)lParam))
5253fc83b43SKatayama Hirofumi MZ                 return 1;
5263fc83b43SKatayama Hirofumi MZ             break;
5273fc83b43SKatayama Hirofumi MZ 
5283fc83b43SKatayama Hirofumi MZ         case IMC_SETSTATUSWINDOWPOS:
5293fc83b43SKatayama Hirofumi MZ             pt.x = GET_X_LPARAM(lParam);
5303fc83b43SKatayama Hirofumi MZ             pt.y = GET_Y_LPARAM(lParam);
5313fc83b43SKatayama Hirofumi MZ             if (!IMM_FN(ImmSetStatusWindowPos)(hIMC, &pt))
5323fc83b43SKatayama Hirofumi MZ                 return 1;
5333fc83b43SKatayama Hirofumi MZ             break;
5343fc83b43SKatayama Hirofumi MZ 
5353fc83b43SKatayama Hirofumi MZ         case IMC_CLOSESTATUSWINDOW:
5363fc83b43SKatayama Hirofumi MZ             if (pimeui->fShowStatus && User32GetImeShowStatus())
5373fc83b43SKatayama Hirofumi MZ             {
5383fc83b43SKatayama Hirofumi MZ                 pimeui->fShowStatus = FALSE;
5393fc83b43SKatayama Hirofumi MZ                 User32SendImeUIMessage(pimeui, WM_IME_NOTIFY, IMN_CLOSESTATUSWINDOW, 0, TRUE);
5403fc83b43SKatayama Hirofumi MZ             }
5413fc83b43SKatayama Hirofumi MZ             pimeui->fCtrlShowStatus = FALSE;
5423fc83b43SKatayama Hirofumi MZ             break;
5433fc83b43SKatayama Hirofumi MZ 
5443fc83b43SKatayama Hirofumi MZ         case IMC_OPENSTATUSWINDOW:
5453fc83b43SKatayama Hirofumi MZ             if (!pimeui->fShowStatus && User32GetImeShowStatus())
5463fc83b43SKatayama Hirofumi MZ             {
5473fc83b43SKatayama Hirofumi MZ                 pimeui->fShowStatus = TRUE;
5483fc83b43SKatayama Hirofumi MZ                 User32SendImeUIMessage(pimeui, WM_IME_NOTIFY, IMN_OPENSTATUSWINDOW, 0, TRUE);
5493fc83b43SKatayama Hirofumi MZ             }
5503fc83b43SKatayama Hirofumi MZ             pimeui->fCtrlShowStatus = TRUE;
5513fc83b43SKatayama Hirofumi MZ             break;
5523fc83b43SKatayama Hirofumi MZ 
5533fc83b43SKatayama Hirofumi MZ         default:
5543fc83b43SKatayama Hirofumi MZ             break;
5553fc83b43SKatayama Hirofumi MZ     }
5563fc83b43SKatayama Hirofumi MZ 
5573fc83b43SKatayama Hirofumi MZ     return 0;
5583fc83b43SKatayama Hirofumi MZ }
5593fc83b43SKatayama Hirofumi MZ 
56025fcdc5cSKatayama Hirofumi MZ /* Modify the IME activation status. */
56125fcdc5cSKatayama Hirofumi MZ /* Win: FocusSetIMCContext */
User32SetImeActivenessOfWindow(HWND hWnd,BOOL bActive)56299614febSKatayama Hirofumi MZ static VOID FASTCALL User32SetImeActivenessOfWindow(HWND hWnd, BOOL bActive)
56399614febSKatayama Hirofumi MZ {
56499614febSKatayama Hirofumi MZ     HIMC hIMC;
56599614febSKatayama Hirofumi MZ 
56699614febSKatayama Hirofumi MZ     if (!hWnd || !IsWindow(hWnd))
56799614febSKatayama Hirofumi MZ     {
56899614febSKatayama Hirofumi MZ         IMM_FN(ImmSetActiveContext)(NULL, NULL, bActive);
56999614febSKatayama Hirofumi MZ         return;
57099614febSKatayama Hirofumi MZ     }
57199614febSKatayama Hirofumi MZ 
57299614febSKatayama Hirofumi MZ     hIMC = IMM_FN(ImmGetContext)(hWnd);
57399614febSKatayama Hirofumi MZ     IMM_FN(ImmSetActiveContext)(hWnd, hIMC, bActive);
57499614febSKatayama Hirofumi MZ     IMM_FN(ImmReleaseContext)(hWnd, hIMC);
57599614febSKatayama Hirofumi MZ }
57699614febSKatayama Hirofumi MZ 
57725fcdc5cSKatayama Hirofumi MZ /* Win: CtfLoadThreadLayout */
CtfLoadThreadLayout(PIMEUI pimeui)57825fcdc5cSKatayama Hirofumi MZ VOID FASTCALL CtfLoadThreadLayout(PIMEUI pimeui)
57925fcdc5cSKatayama Hirofumi MZ {
58025fcdc5cSKatayama Hirofumi MZ     IMM_FN(CtfImmTIMActivate)(pimeui->hKL);
58125fcdc5cSKatayama Hirofumi MZ     pimeui->hKL = GetWin32ClientInfo()->hKL;
58225fcdc5cSKatayama Hirofumi MZ     IMM_FN(ImmLoadIME)(pimeui->hKL);
58325fcdc5cSKatayama Hirofumi MZ     pimeui->hwndUI = NULL;
58425fcdc5cSKatayama Hirofumi MZ }
58525fcdc5cSKatayama Hirofumi MZ 
58625fcdc5cSKatayama Hirofumi MZ /* Open the IME help or check the existence of the IME help. */
58725fcdc5cSKatayama Hirofumi MZ static LRESULT FASTCALL
User32DoImeHelp(PIMEUI pimeui,WPARAM wParam,LPARAM lParam)58825fcdc5cSKatayama Hirofumi MZ User32DoImeHelp(PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
58925fcdc5cSKatayama Hirofumi MZ {
59025fcdc5cSKatayama Hirofumi MZ     WCHAR szHelpFile[MAX_PATH];
59125fcdc5cSKatayama Hirofumi MZ     DWORD ret, dwEsc = IME_ESC_GETHELPFILENAME;
59225fcdc5cSKatayama Hirofumi MZ     size_t cch;
59325fcdc5cSKatayama Hirofumi MZ 
59425fcdc5cSKatayama Hirofumi MZ     /* Is there any IME help file? */
59525fcdc5cSKatayama Hirofumi MZ     ret = IMM_FN(ImmEscapeW)(pimeui->hKL, pimeui->hIMC, IME_ESC_QUERY_SUPPORT, &dwEsc);
59625fcdc5cSKatayama Hirofumi MZ     if (!ret || !lParam)
59725fcdc5cSKatayama Hirofumi MZ         return ret;
59825fcdc5cSKatayama Hirofumi MZ 
59925fcdc5cSKatayama Hirofumi MZ     /* Get the help filename */
60025fcdc5cSKatayama Hirofumi MZ     if (IMM_FN(ImmEscapeW)(pimeui->hKL, pimeui->hIMC, IME_ESC_GETHELPFILENAME, szHelpFile))
60125fcdc5cSKatayama Hirofumi MZ     {
60225fcdc5cSKatayama Hirofumi MZ         /* Check filename extension */
60325fcdc5cSKatayama Hirofumi MZ         cch = wcslen(szHelpFile);
60425fcdc5cSKatayama Hirofumi MZ         if (cch > 4 && _wcsicmp(&szHelpFile[cch - 4], L".HLP") == 0)
60525fcdc5cSKatayama Hirofumi MZ         {
60625fcdc5cSKatayama Hirofumi MZ             /* Open the old-style help */
60725fcdc5cSKatayama Hirofumi MZ             TRACE("szHelpFile: %s\n", debugstr_w(szHelpFile));
60825fcdc5cSKatayama Hirofumi MZ             WinHelpW(NULL, szHelpFile, HELP_FINDER, 0);
60925fcdc5cSKatayama Hirofumi MZ         }
61025fcdc5cSKatayama Hirofumi MZ         else
61125fcdc5cSKatayama Hirofumi MZ         {
61225fcdc5cSKatayama Hirofumi MZ             /* Open the new-style help */
61325fcdc5cSKatayama Hirofumi MZ             FIXME("(%p, %p, %p): %s\n", pimeui, wParam, lParam, debugstr_w(szHelpFile));
61425fcdc5cSKatayama Hirofumi MZ             ret = FALSE;
61525fcdc5cSKatayama Hirofumi MZ         }
61625fcdc5cSKatayama Hirofumi MZ     }
61725fcdc5cSKatayama Hirofumi MZ 
61825fcdc5cSKatayama Hirofumi MZ     return ret;
61925fcdc5cSKatayama Hirofumi MZ }
62025fcdc5cSKatayama Hirofumi MZ 
62125fcdc5cSKatayama Hirofumi MZ /* Handles WM_IME_SYSTEM message of the default IME window. */
62225fcdc5cSKatayama Hirofumi MZ /* Win: ImeSystemHandler */
ImeWnd_OnImeSystem(PIMEUI pimeui,WPARAM wParam,LPARAM lParam)62399614febSKatayama Hirofumi MZ static LRESULT ImeWnd_OnImeSystem(PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
62499614febSKatayama Hirofumi MZ {
62599614febSKatayama Hirofumi MZ     LRESULT ret = 0;
62699614febSKatayama Hirofumi MZ     LPINPUTCONTEXTDX pIC;
62799614febSKatayama Hirofumi MZ     HIMC hIMC = pimeui->hIMC;
62899614febSKatayama Hirofumi MZ     LPCANDIDATEFORM pCandForm;
62999614febSKatayama Hirofumi MZ     LPCOMPOSITIONFORM pCompForm;
63099614febSKatayama Hirofumi MZ     DWORD dwConversion, dwSentence;
63199614febSKatayama Hirofumi MZ     HWND hImeWnd;
63299614febSKatayama Hirofumi MZ     BOOL bCompForm;
63399614febSKatayama Hirofumi MZ     CANDIDATEFORM CandForm;
63499614febSKatayama Hirofumi MZ     COMPOSITIONFORM CompForm;
63599614febSKatayama Hirofumi MZ     UINT iCandForm;
63699614febSKatayama Hirofumi MZ 
637c35488ecSKatayama Hirofumi MZ     ASSERT(pimeui->spwnd != NULL);
638c35488ecSKatayama Hirofumi MZ 
63999614febSKatayama Hirofumi MZ     switch (wParam)
64099614febSKatayama Hirofumi MZ     {
64125fcdc5cSKatayama Hirofumi MZ         case IMS_NOTIFYIMESHOW:
64299614febSKatayama Hirofumi MZ             if (User32GetImeShowStatus() == !lParam)
64399614febSKatayama Hirofumi MZ             {
64499614febSKatayama Hirofumi MZ                 hImeWnd = UserHMGetHandle(pimeui->spwnd);
645242e0b43SKatayama Hirofumi MZ                 NtUserCallHwndParamLock(hImeWnd, lParam, TWOPARAM_ROUTINE_IMESHOWSTATUSCHANGE);
64699614febSKatayama Hirofumi MZ             }
64799614febSKatayama Hirofumi MZ             break;
64899614febSKatayama Hirofumi MZ 
64925fcdc5cSKatayama Hirofumi MZ         case IMS_UPDATEIMEUI:
65099614febSKatayama Hirofumi MZ             if (!hIMC)
65199614febSKatayama Hirofumi MZ                 break;
65299614febSKatayama Hirofumi MZ 
65399614febSKatayama Hirofumi MZ             bCompForm = TRUE;
65499614febSKatayama Hirofumi MZ             pIC = IMM_FN(ImmLockIMC)(hIMC);
65599614febSKatayama Hirofumi MZ             if (pIC)
65699614febSKatayama Hirofumi MZ             {
65799614febSKatayama Hirofumi MZ                 bCompForm = !(pIC->dwUIFlags & 0x2);
65899614febSKatayama Hirofumi MZ                 IMM_FN(ImmUnlockIMC)(hIMC);
65999614febSKatayama Hirofumi MZ             }
66099614febSKatayama Hirofumi MZ 
66199614febSKatayama Hirofumi MZ             if (!IsWindow(pimeui->hwndIMC))
66299614febSKatayama Hirofumi MZ                 break;
66399614febSKatayama Hirofumi MZ 
66499614febSKatayama Hirofumi MZ             if (bCompForm && IMM_FN(ImmGetCompositionWindow)(hIMC, &CompForm))
66599614febSKatayama Hirofumi MZ             {
66699614febSKatayama Hirofumi MZ                 if (CompForm.dwStyle)
66799614febSKatayama Hirofumi MZ                     IMM_FN(ImmSetCompositionWindow)(hIMC, &CompForm);
66899614febSKatayama Hirofumi MZ             }
66999614febSKatayama Hirofumi MZ 
67099614febSKatayama Hirofumi MZ             for (iCandForm = 0; iCandForm < MAX_CANDIDATEFORM; ++iCandForm)
67199614febSKatayama Hirofumi MZ             {
67299614febSKatayama Hirofumi MZ                 if (IMM_FN(ImmGetCandidateWindow)(hIMC, iCandForm, &CandForm))
67399614febSKatayama Hirofumi MZ                 {
67499614febSKatayama Hirofumi MZ                     if (CandForm.dwStyle)
67599614febSKatayama Hirofumi MZ                         IMM_FN(ImmSetCandidateWindow)(hIMC, &CandForm);
67699614febSKatayama Hirofumi MZ                 }
67799614febSKatayama Hirofumi MZ             }
67899614febSKatayama Hirofumi MZ             break;
67999614febSKatayama Hirofumi MZ 
68025fcdc5cSKatayama Hirofumi MZ         case IMS_SETCANDFORM:
68199614febSKatayama Hirofumi MZ             pIC = IMM_FN(ImmLockIMC)(hIMC);
68299614febSKatayama Hirofumi MZ             if (!pIC)
68399614febSKatayama Hirofumi MZ                 break;
68499614febSKatayama Hirofumi MZ 
68599614febSKatayama Hirofumi MZ             pCandForm = &pIC->cfCandForm[lParam];
68699614febSKatayama Hirofumi MZ             IMM_FN(ImmSetCandidateWindow)(hIMC, pCandForm);
68799614febSKatayama Hirofumi MZ             IMM_FN(ImmUnlockIMC)(hIMC);
68899614febSKatayama Hirofumi MZ             break;
68999614febSKatayama Hirofumi MZ 
69025fcdc5cSKatayama Hirofumi MZ         case IMS_SETCOMPFONT:
69199614febSKatayama Hirofumi MZ             pIC = IMM_FN(ImmLockIMC)(hIMC);
69299614febSKatayama Hirofumi MZ             if (!pIC)
69399614febSKatayama Hirofumi MZ                 break;
69499614febSKatayama Hirofumi MZ 
69599614febSKatayama Hirofumi MZ             IMM_FN(ImmSetCompositionFontW)(hIMC, &pIC->lfFont.W);
69699614febSKatayama Hirofumi MZ             IMM_FN(ImmUnlockIMC)(hIMC);
69799614febSKatayama Hirofumi MZ             break;
69899614febSKatayama Hirofumi MZ 
69925fcdc5cSKatayama Hirofumi MZ         case IMS_SETCOMPFORM:
70099614febSKatayama Hirofumi MZ             pIC = IMM_FN(ImmLockIMC)(hIMC);
70199614febSKatayama Hirofumi MZ             if (!pIC)
70299614febSKatayama Hirofumi MZ                 break;
70399614febSKatayama Hirofumi MZ 
70499614febSKatayama Hirofumi MZ             pCompForm = &pIC->cfCompForm;
70599614febSKatayama Hirofumi MZ             pIC->dwUIFlags |= 0x8;
70699614febSKatayama Hirofumi MZ             IMM_FN(ImmSetCompositionWindow)(hIMC, pCompForm);
70799614febSKatayama Hirofumi MZ             IMM_FN(ImmUnlockIMC)(hIMC);
70899614febSKatayama Hirofumi MZ             break;
70999614febSKatayama Hirofumi MZ 
71025fcdc5cSKatayama Hirofumi MZ         case IMS_CONFIGURE:
71199614febSKatayama Hirofumi MZ             IMM_FN(ImmConfigureIMEW)((HKL)lParam, pimeui->hwndIMC, IME_CONFIG_GENERAL, NULL);
71299614febSKatayama Hirofumi MZ             break;
71399614febSKatayama Hirofumi MZ 
71425fcdc5cSKatayama Hirofumi MZ         case IMS_SETOPENSTATUS:
71599614febSKatayama Hirofumi MZ             if (hIMC)
71699614febSKatayama Hirofumi MZ                 IMM_FN(ImmSetOpenStatus)(hIMC, (BOOL)lParam);
71799614febSKatayama Hirofumi MZ             break;
71899614febSKatayama Hirofumi MZ 
71925fcdc5cSKatayama Hirofumi MZ         case IMS_FREELAYOUT:
720*dcf0788fSKatayama Hirofumi MZ             ret = IMM_FN(ImmFreeLayout)((HKL)lParam);
72199614febSKatayama Hirofumi MZ             break;
72299614febSKatayama Hirofumi MZ 
72399614febSKatayama Hirofumi MZ         case 0x13:
72425fcdc5cSKatayama Hirofumi MZ             FIXME("\n");
72599614febSKatayama Hirofumi MZ             break;
72699614febSKatayama Hirofumi MZ 
72725fcdc5cSKatayama Hirofumi MZ         case IMS_GETCONVSTATUS:
72899614febSKatayama Hirofumi MZ             IMM_FN(ImmGetConversionStatus)(hIMC, &dwConversion, &dwSentence);
72999614febSKatayama Hirofumi MZ             ret = dwConversion;
73099614febSKatayama Hirofumi MZ             break;
73199614febSKatayama Hirofumi MZ 
73225fcdc5cSKatayama Hirofumi MZ         case IMS_IMEHELP:
73325fcdc5cSKatayama Hirofumi MZ             return User32DoImeHelp(pimeui, wParam, lParam);
73499614febSKatayama Hirofumi MZ 
7358f719cb9SKatayama Hirofumi MZ         case IMS_IMEACTIVATE:
73699614febSKatayama Hirofumi MZ             User32SetImeActivenessOfWindow((HWND)lParam, TRUE);
73799614febSKatayama Hirofumi MZ             break;
73899614febSKatayama Hirofumi MZ 
7398f719cb9SKatayama Hirofumi MZ         case IMS_IMEDEACTIVATE:
74099614febSKatayama Hirofumi MZ             User32SetImeActivenessOfWindow((HWND)lParam, FALSE);
74199614febSKatayama Hirofumi MZ             break;
74299614febSKatayama Hirofumi MZ 
7438f719cb9SKatayama Hirofumi MZ         case IMS_ACTIVATELAYOUT:
74499614febSKatayama Hirofumi MZ             ret = IMM_FN(ImmActivateLayout)((HKL)lParam);
74599614febSKatayama Hirofumi MZ             break;
74699614febSKatayama Hirofumi MZ 
747ffbdb7d3SKatayama Hirofumi MZ         case IMS_GETIMEMENU:
74899614febSKatayama Hirofumi MZ             ret = IMM_FN(ImmPutImeMenuItemsIntoMappedFile)((HIMC)lParam);
74999614febSKatayama Hirofumi MZ             break;
75099614febSKatayama Hirofumi MZ 
75199614febSKatayama Hirofumi MZ         case 0x1D:
75225fcdc5cSKatayama Hirofumi MZ             FIXME("\n");
75399614febSKatayama Hirofumi MZ             break;
75499614febSKatayama Hirofumi MZ 
75525fcdc5cSKatayama Hirofumi MZ         case IMS_GETCONTEXT:
75699614febSKatayama Hirofumi MZ             ret = (ULONG_PTR)IMM_FN(ImmGetContext)((HWND)lParam);
75799614febSKatayama Hirofumi MZ             break;
75899614febSKatayama Hirofumi MZ 
75925fcdc5cSKatayama Hirofumi MZ         case IMS_SENDNOTIFICATION:
76025fcdc5cSKatayama Hirofumi MZ         case IMS_COMPLETECOMPSTR:
76125fcdc5cSKatayama Hirofumi MZ         case IMS_SETLANGBAND:
76225fcdc5cSKatayama Hirofumi MZ         case IMS_UNSETLANGBAND:
76399614febSKatayama Hirofumi MZ             ret = IMM_FN(ImmSystemHandler)(hIMC, wParam, lParam);
76499614febSKatayama Hirofumi MZ             break;
76599614febSKatayama Hirofumi MZ 
76625fcdc5cSKatayama Hirofumi MZ         case IMS_LOADTHREADLAYOUT:
76725fcdc5cSKatayama Hirofumi MZ             CtfLoadThreadLayout(pimeui);
76825fcdc5cSKatayama Hirofumi MZ             break;
76925fcdc5cSKatayama Hirofumi MZ 
77099614febSKatayama Hirofumi MZ         default:
77199614febSKatayama Hirofumi MZ             break;
77299614febSKatayama Hirofumi MZ     }
77399614febSKatayama Hirofumi MZ 
77499614febSKatayama Hirofumi MZ     return ret;
77599614febSKatayama Hirofumi MZ }
77699614febSKatayama Hirofumi MZ 
77725fcdc5cSKatayama Hirofumi MZ /* Handles WM_IME_SETCONTEXT message of the default IME window. */
77825fcdc5cSKatayama Hirofumi MZ /* Win: ImeSetContextHandler */
ImeWnd_OnImeSetContext(PIMEUI pimeui,WPARAM wParam,LPARAM lParam)7798c6dcdcfSKatayama Hirofumi MZ LRESULT ImeWnd_OnImeSetContext(PIMEUI pimeui, WPARAM wParam, LPARAM lParam)
7808c6dcdcfSKatayama Hirofumi MZ {
7818c6dcdcfSKatayama Hirofumi MZ     LRESULT ret;
7828c6dcdcfSKatayama Hirofumi MZ     HIMC hIMC;
7838c6dcdcfSKatayama Hirofumi MZ     LPINPUTCONTEXTDX pIC;
784c35488ecSKatayama Hirofumi MZ     HWND hwndFocus, hwndOldImc, hwndNewImc, hImeWnd, hwndActive, hwndOwner;
785242e0b43SKatayama Hirofumi MZ     PWND pwndFocus, pImeWnd, pwndOwner;
7868c6dcdcfSKatayama Hirofumi MZ     COMPOSITIONFORM CompForm;
7878c6dcdcfSKatayama Hirofumi MZ 
7888c6dcdcfSKatayama Hirofumi MZ     pimeui->fActivate = !!wParam;
7898c6dcdcfSKatayama Hirofumi MZ     hwndOldImc = pimeui->hwndIMC;
790c35488ecSKatayama Hirofumi MZ     ASSERT(pimeui->spwnd != NULL);
7918c6dcdcfSKatayama Hirofumi MZ 
7928c6dcdcfSKatayama Hirofumi MZ     if (wParam)
7938c6dcdcfSKatayama Hirofumi MZ     {
7948c6dcdcfSKatayama Hirofumi MZ         if (!pimeui->hwndUI)
7958c6dcdcfSKatayama Hirofumi MZ             pimeui->hwndUI = User32CreateImeUIWindow(pimeui, pimeui->hKL);
7968c6dcdcfSKatayama Hirofumi MZ 
79734600f3dSKatayama Hirofumi MZ         if (gfConIme == -1)
7988c6dcdcfSKatayama Hirofumi MZ         {
799c35488ecSKatayama Hirofumi MZ             gfConIme = (INT)NtUserGetThreadState(THREADSTATE_CHECKCONIME);
80034600f3dSKatayama Hirofumi MZ             if (gfConIme)
8018c6dcdcfSKatayama Hirofumi MZ                 pimeui->fCtrlShowStatus = FALSE;
8028c6dcdcfSKatayama Hirofumi MZ         }
8038c6dcdcfSKatayama Hirofumi MZ 
804c35488ecSKatayama Hirofumi MZ         hImeWnd = UserHMGetHandle(pimeui->spwnd);
805c35488ecSKatayama Hirofumi MZ 
80634600f3dSKatayama Hirofumi MZ         if (gfConIme)
8078c6dcdcfSKatayama Hirofumi MZ         {
808c35488ecSKatayama Hirofumi MZ             hwndOwner = GetWindow(hImeWnd, GW_OWNER);
809c35488ecSKatayama Hirofumi MZ             pwndOwner = ValidateHwnd(hwndOwner);
8108c6dcdcfSKatayama Hirofumi MZ             if (pwndOwner)
8118c6dcdcfSKatayama Hirofumi MZ             {
8128c6dcdcfSKatayama Hirofumi MZ                 User32UpdateImcOfImeUI(pimeui, pwndOwner->hImc);
8138c6dcdcfSKatayama Hirofumi MZ 
8148c6dcdcfSKatayama Hirofumi MZ                 if (pimeui->hwndUI)
8158c6dcdcfSKatayama Hirofumi MZ                     SetWindowLongPtrW(pimeui->hwndUI, IMMGWLP_IMC, (LONG_PTR)pwndOwner->hImc);
8168c6dcdcfSKatayama Hirofumi MZ             }
8178c6dcdcfSKatayama Hirofumi MZ 
8188c6dcdcfSKatayama Hirofumi MZ             return User32SendImeUIMessage(pimeui, WM_IME_SETCONTEXT, wParam, lParam, TRUE);
8198c6dcdcfSKatayama Hirofumi MZ         }
8208c6dcdcfSKatayama Hirofumi MZ 
8218c6dcdcfSKatayama Hirofumi MZ         hwndFocus = (HWND)NtUserQueryWindow(hImeWnd, QUERY_WINDOW_FOCUS);
8228c6dcdcfSKatayama Hirofumi MZ 
8238c6dcdcfSKatayama Hirofumi MZ         hIMC = IMM_FN(ImmGetContext)(hwndFocus);
8248c6dcdcfSKatayama Hirofumi MZ 
8258c6dcdcfSKatayama Hirofumi MZ         if (hIMC && !User32CanSetImeWindowToImc(hIMC, hImeWnd))
8268c6dcdcfSKatayama Hirofumi MZ         {
8278c6dcdcfSKatayama Hirofumi MZ             User32UpdateImcOfImeUI(pimeui, NULL);
8288c6dcdcfSKatayama Hirofumi MZ             return 0;
8298c6dcdcfSKatayama Hirofumi MZ         }
8308c6dcdcfSKatayama Hirofumi MZ 
8318c6dcdcfSKatayama Hirofumi MZ         User32UpdateImcOfImeUI(pimeui, hIMC);
8328c6dcdcfSKatayama Hirofumi MZ 
8338c6dcdcfSKatayama Hirofumi MZ         if (pimeui->hwndUI)
8348c6dcdcfSKatayama Hirofumi MZ             SetWindowLongPtrW(pimeui->hwndUI, IMMGWLP_IMC, (LONG_PTR)hIMC);
8358c6dcdcfSKatayama Hirofumi MZ 
8368c6dcdcfSKatayama Hirofumi MZ         if (hIMC)
8378c6dcdcfSKatayama Hirofumi MZ         {
8388c6dcdcfSKatayama Hirofumi MZ             pIC = IMM_FN(ImmLockIMC)(hIMC);
8398c6dcdcfSKatayama Hirofumi MZ             if (!pIC)
8408c6dcdcfSKatayama Hirofumi MZ                 return 0;
8418c6dcdcfSKatayama Hirofumi MZ 
8428c6dcdcfSKatayama Hirofumi MZ             if (hwndFocus != pIC->hWnd)
8438c6dcdcfSKatayama Hirofumi MZ             {
8448c6dcdcfSKatayama Hirofumi MZ                 IMM_FN(ImmUnlockIMC)(hIMC);
8458c6dcdcfSKatayama Hirofumi MZ                 return 0;
8468c6dcdcfSKatayama Hirofumi MZ             }
8478c6dcdcfSKatayama Hirofumi MZ 
8488c6dcdcfSKatayama Hirofumi MZ             if ((pIC->dwUIFlags & 0x40000) && hwndOldImc != hwndFocus)
8498c6dcdcfSKatayama Hirofumi MZ             {
8508c6dcdcfSKatayama Hirofumi MZ                 RtlZeroMemory(&CompForm, sizeof(CompForm));
8518c6dcdcfSKatayama Hirofumi MZ                 IMM_FN(ImmSetCompositionWindow)(hIMC, &CompForm);
8528c6dcdcfSKatayama Hirofumi MZ 
8538c6dcdcfSKatayama Hirofumi MZ                 pIC->dwUIFlags &= ~0x40000;
8548c6dcdcfSKatayama Hirofumi MZ             }
8558c6dcdcfSKatayama Hirofumi MZ 
8568c6dcdcfSKatayama Hirofumi MZ             IMM_FN(ImmUnlockIMC)(hIMC);
8578c6dcdcfSKatayama Hirofumi MZ 
8588c6dcdcfSKatayama Hirofumi MZ             hImeWnd = UserHMGetHandle(pimeui->spwnd);
8598c6dcdcfSKatayama Hirofumi MZ             if (NtUserSetImeOwnerWindow(hImeWnd, hwndFocus))
8608c6dcdcfSKatayama Hirofumi MZ                 pimeui->hwndIMC = hwndFocus;
8618c6dcdcfSKatayama Hirofumi MZ         }
8628c6dcdcfSKatayama Hirofumi MZ         else
8638c6dcdcfSKatayama Hirofumi MZ         {
8648c6dcdcfSKatayama Hirofumi MZ             pimeui->hwndIMC = hwndFocus;
8658c6dcdcfSKatayama Hirofumi MZ 
8668c6dcdcfSKatayama Hirofumi MZ             hImeWnd = UserHMGetHandle(pimeui->spwnd);
8678c6dcdcfSKatayama Hirofumi MZ             NtUserSetImeOwnerWindow(hImeWnd, NULL);
8688c6dcdcfSKatayama Hirofumi MZ         }
8698c6dcdcfSKatayama Hirofumi MZ     }
8708c6dcdcfSKatayama Hirofumi MZ 
8718c6dcdcfSKatayama Hirofumi MZ     ret = User32SendImeUIMessage(pimeui, WM_IME_SETCONTEXT, wParam, lParam, TRUE);
8728c6dcdcfSKatayama Hirofumi MZ 
8738c6dcdcfSKatayama Hirofumi MZ     if (!pimeui->spwnd)
8748c6dcdcfSKatayama Hirofumi MZ         return 0;
8758c6dcdcfSKatayama Hirofumi MZ 
8768c6dcdcfSKatayama Hirofumi MZ     if (!pimeui->fCtrlShowStatus || !User32GetImeShowStatus())
8778c6dcdcfSKatayama Hirofumi MZ         return ret;
8788c6dcdcfSKatayama Hirofumi MZ 
8798c6dcdcfSKatayama Hirofumi MZ     hImeWnd = UserHMGetHandle(pimeui->spwnd);
8808c6dcdcfSKatayama Hirofumi MZ     hwndFocus = (HWND)NtUserQueryWindow(hImeWnd, QUERY_WINDOW_FOCUS);
8818c6dcdcfSKatayama Hirofumi MZ     pwndFocus = ValidateHwnd(hwndFocus);
8828c6dcdcfSKatayama Hirofumi MZ 
8838c6dcdcfSKatayama Hirofumi MZ     if (wParam)
8848c6dcdcfSKatayama Hirofumi MZ     {
885c35488ecSKatayama Hirofumi MZ         pImeWnd = ValidateHwnd(hImeWnd);
886c35488ecSKatayama Hirofumi MZ         if (pwndFocus && pImeWnd && pImeWnd->head.pti == pwndFocus->head.pti)
8878c6dcdcfSKatayama Hirofumi MZ         {
8888c6dcdcfSKatayama Hirofumi MZ             hwndNewImc = pimeui->hwndIMC;
8898c6dcdcfSKatayama Hirofumi MZ             if (pimeui->fShowStatus)
8908c6dcdcfSKatayama Hirofumi MZ             {
891242e0b43SKatayama Hirofumi MZ                 if (hwndOldImc && hwndNewImc && hwndOldImc != hwndNewImc &&
892242e0b43SKatayama Hirofumi MZ                     IntGetTopLevelWindow(hwndOldImc) != IntGetTopLevelWindow(hwndNewImc))
8938c6dcdcfSKatayama Hirofumi MZ                 {
8948c6dcdcfSKatayama Hirofumi MZ                     User32NotifyOpenStatus(pimeui, hwndOldImc, FALSE);
8958c6dcdcfSKatayama Hirofumi MZ                     User32NotifyOpenStatus(pimeui, hwndNewImc, TRUE);
8968c6dcdcfSKatayama Hirofumi MZ                 }
8978c6dcdcfSKatayama Hirofumi MZ             }
8988c6dcdcfSKatayama Hirofumi MZ             else
8998c6dcdcfSKatayama Hirofumi MZ             {
9008c6dcdcfSKatayama Hirofumi MZ                 if (ValidateHwnd(hwndNewImc))
9018c6dcdcfSKatayama Hirofumi MZ                     User32NotifyOpenStatus(pimeui, hwndNewImc, TRUE);
9028c6dcdcfSKatayama Hirofumi MZ             }
9038c6dcdcfSKatayama Hirofumi MZ         }
9048c6dcdcfSKatayama Hirofumi MZ 
9058c6dcdcfSKatayama Hirofumi MZ         pImeWnd = pimeui->spwnd;
9068c6dcdcfSKatayama Hirofumi MZ         hImeWnd = (pImeWnd ? UserHMGetHandle(pImeWnd) : NULL);
9078c6dcdcfSKatayama Hirofumi MZ         if (hImeWnd)
9088c6dcdcfSKatayama Hirofumi MZ             NtUserCallHwndLock(hImeWnd, HWNDLOCK_ROUTINE_CHECKIMESHOWSTATUSINTHRD);
9098c6dcdcfSKatayama Hirofumi MZ     }
9108c6dcdcfSKatayama Hirofumi MZ     else
9118c6dcdcfSKatayama Hirofumi MZ     {
9128c6dcdcfSKatayama Hirofumi MZ         pImeWnd = pimeui->spwnd;
9138c6dcdcfSKatayama Hirofumi MZ         hImeWnd = UserHMGetHandle(pImeWnd);
9148c6dcdcfSKatayama Hirofumi MZ         hwndActive = (HWND)NtUserQueryWindow(hImeWnd, QUERY_WINDOW_ACTIVE);
9158c6dcdcfSKatayama Hirofumi MZ         if (!pwndFocus || !hwndActive || pImeWnd->head.pti != pwndFocus->head.pti)
9168c6dcdcfSKatayama Hirofumi MZ         {
9178c6dcdcfSKatayama Hirofumi MZ             if (IsWindow(hwndOldImc))
9188c6dcdcfSKatayama Hirofumi MZ             {
9198c6dcdcfSKatayama Hirofumi MZ                 User32NotifyOpenStatus(pimeui, hwndOldImc, FALSE);
9208c6dcdcfSKatayama Hirofumi MZ             }
9218c6dcdcfSKatayama Hirofumi MZ             else
9228c6dcdcfSKatayama Hirofumi MZ             {
9238c6dcdcfSKatayama Hirofumi MZ                 pimeui->fShowStatus = FALSE;
9248c6dcdcfSKatayama Hirofumi MZ                 User32SendImeUIMessage(pimeui, WM_IME_NOTIFY, IMN_CLOSESTATUSWINDOW, 0, TRUE);
9258c6dcdcfSKatayama Hirofumi MZ             }
9268c6dcdcfSKatayama Hirofumi MZ         }
9278c6dcdcfSKatayama Hirofumi MZ     }
9288c6dcdcfSKatayama Hirofumi MZ 
9298c6dcdcfSKatayama Hirofumi MZ     return ret;
9308c6dcdcfSKatayama Hirofumi MZ }
9318c6dcdcfSKatayama Hirofumi MZ 
93225fcdc5cSKatayama Hirofumi MZ /* The window procedure of the default IME window */
933c7e8b544SKatayama Hirofumi MZ /* Win: ImeWndProcWorker(pWnd, msg, wParam, lParam, !unicode) */
93434600f3dSKatayama Hirofumi MZ LRESULT WINAPI
ImeWndProc_common(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam,BOOL unicode)93534600f3dSKatayama Hirofumi MZ ImeWndProc_common(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode) // ReactOS
936c2c66affSColin Finck {
937c2c66affSColin Finck     PWND pWnd;
938c2c66affSColin Finck     PIMEUI pimeui;
939c06ccceaSKatayama Hirofumi MZ     LRESULT ret;
940c2c66affSColin Finck 
941c2c66affSColin Finck     pWnd = ValidateHwnd(hwnd);
942e1f8b32cSKatayama Hirofumi MZ     if (pWnd == NULL)
943c2c66affSColin Finck     {
944e1f8b32cSKatayama Hirofumi MZ         ERR("hwnd was %p\n", hwnd);
945e1f8b32cSKatayama Hirofumi MZ         return 0;
946e1f8b32cSKatayama Hirofumi MZ     }
947e1f8b32cSKatayama Hirofumi MZ 
948e1f8b32cSKatayama Hirofumi MZ     if (!pWnd->fnid)
949e1f8b32cSKatayama Hirofumi MZ     {
950e1f8b32cSKatayama Hirofumi MZ         NtUserSetWindowFNID(hwnd, FNID_IME);
951e1f8b32cSKatayama Hirofumi MZ     }
952e1f8b32cSKatayama Hirofumi MZ     else if (pWnd->fnid != FNID_IME)
953e1f8b32cSKatayama Hirofumi MZ     {
954e1f8b32cSKatayama Hirofumi MZ         ERR("fnid was 0x%x\n", pWnd->fnid);
955e1f8b32cSKatayama Hirofumi MZ         return 0;
956e1f8b32cSKatayama Hirofumi MZ     }
957e1f8b32cSKatayama Hirofumi MZ 
958e1f8b32cSKatayama Hirofumi MZ     pimeui = (PIMEUI)GetWindowLongPtrW(hwnd, 0);
959e1f8b32cSKatayama Hirofumi MZ     if (pimeui == NULL)
960e1f8b32cSKatayama Hirofumi MZ     {
961e1f8b32cSKatayama Hirofumi MZ         pimeui = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMEUI));
962e1f8b32cSKatayama Hirofumi MZ         if (pimeui == NULL)
963e1f8b32cSKatayama Hirofumi MZ         {
964e1f8b32cSKatayama Hirofumi MZ             ERR("HeapAlloc failed\n");
965e1f8b32cSKatayama Hirofumi MZ             NtUserSetWindowFNID(hwnd, FNID_DESTROY);
966e1f8b32cSKatayama Hirofumi MZ             DestroyWindow(hwnd);
967e1f8b32cSKatayama Hirofumi MZ             return 0;
968e1f8b32cSKatayama Hirofumi MZ         }
969e1f8b32cSKatayama Hirofumi MZ 
970e1f8b32cSKatayama Hirofumi MZ         SetWindowLongPtrW(hwnd, 0, (LONG_PTR)pimeui);
971e1f8b32cSKatayama Hirofumi MZ         pimeui->spwnd = pWnd;
972e1f8b32cSKatayama Hirofumi MZ     }
973e1f8b32cSKatayama Hirofumi MZ 
974c06ccceaSKatayama Hirofumi MZ     if (IS_CICERO_MODE())
975c06ccceaSKatayama Hirofumi MZ     {
976c06ccceaSKatayama Hirofumi MZ         ret = IMM_FN(CtfImmDispatchDefImeMessage)(hwnd, msg, wParam, lParam);
977c06ccceaSKatayama Hirofumi MZ         if (ret)
978c06ccceaSKatayama Hirofumi MZ             return ret;
979c06ccceaSKatayama Hirofumi MZ     }
980c06ccceaSKatayama Hirofumi MZ 
981fc62d268SKatayama Hirofumi MZ     if (pimeui->nCntInIMEProc > 0)
982c2c66affSColin Finck     {
983fc62d268SKatayama Hirofumi MZ         switch (msg)
984fc62d268SKatayama Hirofumi MZ         {
985fc62d268SKatayama Hirofumi MZ             case WM_IME_CHAR:
986fc62d268SKatayama Hirofumi MZ             case WM_IME_COMPOSITIONFULL:
987fc62d268SKatayama Hirofumi MZ             case WM_IME_CONTROL:
988fc62d268SKatayama Hirofumi MZ             case WM_IME_REQUEST:
989fc62d268SKatayama Hirofumi MZ             case WM_IME_SELECT:
990fc62d268SKatayama Hirofumi MZ             case WM_IME_SETCONTEXT:
991fc62d268SKatayama Hirofumi MZ             case WM_IME_STARTCOMPOSITION:
992fc62d268SKatayama Hirofumi MZ             case WM_IME_COMPOSITION:
993fc62d268SKatayama Hirofumi MZ             case WM_IME_ENDCOMPOSITION:
994fc62d268SKatayama Hirofumi MZ                 return 0;
995c2c66affSColin Finck 
996c06ccceaSKatayama Hirofumi MZ             case WM_IME_NOTIFY:
997c06ccceaSKatayama Hirofumi MZ                 if (wParam < IMN_PRIVATE || IS_IME_HKL(pimeui->hKL) || !IS_CICERO_MODE())
998c06ccceaSKatayama Hirofumi MZ                     return 0;
999c06ccceaSKatayama Hirofumi MZ                 break;
1000c06ccceaSKatayama Hirofumi MZ 
1001fc62d268SKatayama Hirofumi MZ             case WM_IME_SYSTEM:
100299614febSKatayama Hirofumi MZ                 switch (wParam)
100399614febSKatayama Hirofumi MZ                 {
100499614febSKatayama Hirofumi MZ                     case 0x03:
100599614febSKatayama Hirofumi MZ                     case 0x10:
100699614febSKatayama Hirofumi MZ                     case 0x13:
100799614febSKatayama Hirofumi MZ                         break;
100899614febSKatayama Hirofumi MZ 
100999614febSKatayama Hirofumi MZ                     default:
1010fc62d268SKatayama Hirofumi MZ                         return 0;
101199614febSKatayama Hirofumi MZ                 }
101299614febSKatayama Hirofumi MZ                 break;
1013fc62d268SKatayama Hirofumi MZ 
1014fc62d268SKatayama Hirofumi MZ             default:
1015e1f8b32cSKatayama Hirofumi MZ                 goto Finish;
1016c2c66affSColin Finck         }
1017fc62d268SKatayama Hirofumi MZ     }
1018e1f8b32cSKatayama Hirofumi MZ 
1019e1f8b32cSKatayama Hirofumi MZ     if ((pWnd->state2 & WNDS2_INDESTROY) || (pWnd->state & WNDS_DESTROYED))
1020e1f8b32cSKatayama Hirofumi MZ     {
1021e1f8b32cSKatayama Hirofumi MZ         switch (msg)
1022e1f8b32cSKatayama Hirofumi MZ         {
1023e1f8b32cSKatayama Hirofumi MZ             case WM_DESTROY:
1024e1f8b32cSKatayama Hirofumi MZ             case WM_NCDESTROY:
1025e1f8b32cSKatayama Hirofumi MZ             case WM_FINALDESTROY:
1026e1f8b32cSKatayama Hirofumi MZ                 break;
1027e1f8b32cSKatayama Hirofumi MZ 
1028e1f8b32cSKatayama Hirofumi MZ             default:
1029e1f8b32cSKatayama Hirofumi MZ                 return 0;
1030e1f8b32cSKatayama Hirofumi MZ         }
1031fc62d268SKatayama Hirofumi MZ     }
1032fc62d268SKatayama Hirofumi MZ 
1033fc62d268SKatayama Hirofumi MZ     switch (msg)
1034fc62d268SKatayama Hirofumi MZ     {
1035fc62d268SKatayama Hirofumi MZ         case WM_CREATE:
1036c06ccceaSKatayama Hirofumi MZ             return ImeWnd_OnCreate(pimeui, (LPCREATESTRUCT)lParam);
1037fc62d268SKatayama Hirofumi MZ 
1038fc62d268SKatayama Hirofumi MZ         case WM_DESTROY:
103923bb2703SKatayama Hirofumi MZ             User32DestroyImeUIWindow(pimeui);
1040e1f8b32cSKatayama Hirofumi MZ             return 0;
1041fc62d268SKatayama Hirofumi MZ 
1042fc62d268SKatayama Hirofumi MZ         case WM_NCDESTROY:
1043e1f8b32cSKatayama Hirofumi MZ         case WM_FINALDESTROY:
1044e1f8b32cSKatayama Hirofumi MZ             pimeui->spwnd = NULL;
1045fc62d268SKatayama Hirofumi MZ             HeapFree(GetProcessHeap(), 0, pimeui);
1046fc62d268SKatayama Hirofumi MZ             NtUserSetWindowFNID(hwnd, FNID_DESTROY);
1047fc62d268SKatayama Hirofumi MZ             break;
1048fc62d268SKatayama Hirofumi MZ 
1049fc62d268SKatayama Hirofumi MZ         case WM_ERASEBKGND:
1050fc62d268SKatayama Hirofumi MZ             return TRUE;
1051fc62d268SKatayama Hirofumi MZ 
1052fc62d268SKatayama Hirofumi MZ         case WM_PAINT:
1053e1f8b32cSKatayama Hirofumi MZ             return 0;
1054fc62d268SKatayama Hirofumi MZ 
1055fc62d268SKatayama Hirofumi MZ         case WM_IME_STARTCOMPOSITION:
1056fc62d268SKatayama Hirofumi MZ         case WM_IME_COMPOSITION:
1057fc62d268SKatayama Hirofumi MZ         case WM_IME_ENDCOMPOSITION:
105823bb2703SKatayama Hirofumi MZ             return User32SendImeUIMessage(pimeui, msg, wParam, lParam, unicode);
1059fc62d268SKatayama Hirofumi MZ 
1060fc62d268SKatayama Hirofumi MZ         case WM_IME_CONTROL:
10613fc83b43SKatayama Hirofumi MZ             return ImeWnd_OnImeControl(pimeui, wParam, lParam, unicode);
1062fc62d268SKatayama Hirofumi MZ 
1063fc62d268SKatayama Hirofumi MZ         case WM_IME_NOTIFY:
106482136b3eSKatayama Hirofumi MZ             return ImeWnd_OnImeNotify(pimeui, wParam, lParam);
1065fc62d268SKatayama Hirofumi MZ 
1066fc62d268SKatayama Hirofumi MZ         case WM_IME_REQUEST:
1067e1f8b32cSKatayama Hirofumi MZ             return 0;
1068fc62d268SKatayama Hirofumi MZ 
1069fc62d268SKatayama Hirofumi MZ         case WM_IME_SELECT:
107023bb2703SKatayama Hirofumi MZ             ImeWnd_OnImeSelect(pimeui, wParam, lParam);
1071e1f8b32cSKatayama Hirofumi MZ             return (LRESULT)pimeui;
1072fc62d268SKatayama Hirofumi MZ 
1073fc62d268SKatayama Hirofumi MZ         case WM_IME_SETCONTEXT:
10748c6dcdcfSKatayama Hirofumi MZ             return ImeWnd_OnImeSetContext(pimeui, wParam, lParam);
1075fc62d268SKatayama Hirofumi MZ 
1076fc62d268SKatayama Hirofumi MZ         case WM_IME_SYSTEM:
107799614febSKatayama Hirofumi MZ             return ImeWnd_OnImeSystem(pimeui, wParam, lParam);
1078fc62d268SKatayama Hirofumi MZ 
1079fc62d268SKatayama Hirofumi MZ         default:
1080e1f8b32cSKatayama Hirofumi MZ             break;
1081e1f8b32cSKatayama Hirofumi MZ     }
1082e1f8b32cSKatayama Hirofumi MZ 
1083e1f8b32cSKatayama Hirofumi MZ Finish:
1084fc62d268SKatayama Hirofumi MZ     if (unicode)
1085fc62d268SKatayama Hirofumi MZ         return DefWindowProcW(hwnd, msg, wParam, lParam);
1086fc62d268SKatayama Hirofumi MZ     return DefWindowProcA(hwnd, msg, wParam, lParam);
1087fc62d268SKatayama Hirofumi MZ }
1088c2c66affSColin Finck 
108934600f3dSKatayama Hirofumi MZ // Win: ImeWndProcA
ImeWndProcA(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)1090c2c66affSColin Finck LRESULT WINAPI ImeWndProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
1091c2c66affSColin Finck {
1092c2c66affSColin Finck     return ImeWndProc_common(hwnd, msg, wParam, lParam, FALSE);
1093c2c66affSColin Finck }
1094c2c66affSColin Finck 
109534600f3dSKatayama Hirofumi MZ // Win: ImeWndProcW
ImeWndProcW(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)1096c2c66affSColin Finck LRESULT WINAPI ImeWndProcW( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
1097c2c66affSColin Finck {
1098c2c66affSColin Finck     return ImeWndProc_common(hwnd, msg, wParam, lParam, TRUE);
1099c2c66affSColin Finck }
1100c2c66affSColin Finck 
110134600f3dSKatayama Hirofumi MZ // Win: UpdatePerUserImmEnabling
UpdatePerUserImmEnabling(VOID)110234600f3dSKatayama Hirofumi MZ BOOL WINAPI UpdatePerUserImmEnabling(VOID)
1103c45a6e15SJames Tabor {
110434600f3dSKatayama Hirofumi MZ     HMODULE imm32;
110534600f3dSKatayama Hirofumi MZ     BOOL ret;
110634600f3dSKatayama Hirofumi MZ 
110734600f3dSKatayama Hirofumi MZ     ret = NtUserCallNoParam(NOPARAM_ROUTINE_UPDATEPERUSERIMMENABLING);
110834600f3dSKatayama Hirofumi MZ     if (!ret || !(gpsi->dwSRVIFlags & SRVINFO_IMM32))
110934600f3dSKatayama Hirofumi MZ         return FALSE;
111034600f3dSKatayama Hirofumi MZ 
111134600f3dSKatayama Hirofumi MZ     imm32 = GetModuleHandleW(L"imm32.dll");
111234600f3dSKatayama Hirofumi MZ     if (imm32)
111334600f3dSKatayama Hirofumi MZ         return TRUE;
111434600f3dSKatayama Hirofumi MZ 
1115c45a6e15SJames Tabor     imm32 = LoadLibraryW(L"imm32.dll");
111667d8ffb6SKatayama Hirofumi MZ     if (imm32 == NULL)
1117c45a6e15SJames Tabor     {
111867d8ffb6SKatayama Hirofumi MZ         ERR("Imm32 not installed!\n");
111934600f3dSKatayama Hirofumi MZ         ret = FALSE;
1120c45a6e15SJames Tabor     }
112134600f3dSKatayama Hirofumi MZ 
112234600f3dSKatayama Hirofumi MZ     return ret;
1123c45a6e15SJames Tabor }
1124c45a6e15SJames Tabor 
1125c2c66affSColin Finck BOOL
1126c2c66affSColin Finck WINAPI
RegisterIMEClass(VOID)1127c2c66affSColin Finck RegisterIMEClass(VOID)
1128c2c66affSColin Finck {
1129c2c66affSColin Finck     ATOM atom;
1130d735373eSKatayama Hirofumi MZ     WNDCLASSEXW WndClass = { sizeof(WndClass) };
1131c2c66affSColin Finck 
1132d735373eSKatayama Hirofumi MZ     WndClass.lpszClassName  = L"IME";
1133c2c66affSColin Finck     WndClass.style          = CS_GLOBALCLASS;
1134c2c66affSColin Finck     WndClass.lpfnWndProc    = ImeWndProcW;
1135c2c66affSColin Finck     WndClass.cbWndExtra     = sizeof(LONG_PTR);
1136c2c66affSColin Finck     WndClass.hCursor        = LoadCursorW(NULL, IDC_ARROW);
1137c2c66affSColin Finck 
1138d735373eSKatayama Hirofumi MZ     atom = RegisterClassExWOWW(&WndClass, 0, FNID_IME, 0, FALSE);
1139d735373eSKatayama Hirofumi MZ     if (!atom)
1140c2c66affSColin Finck     {
1141c2c66affSColin Finck         ERR("Failed to register IME Class!\n");
1142c2c66affSColin Finck         return FALSE;
1143c2c66affSColin Finck     }
1144c2c66affSColin Finck 
1145d735373eSKatayama Hirofumi MZ     RegisterDefaultClasses |= ICLASS_TO_MASK(ICLS_IME);
1146d735373eSKatayama Hirofumi MZ     TRACE("RegisterIMEClass atom = %u\n", atom);
1147d735373eSKatayama Hirofumi MZ     return TRUE;
1148d735373eSKatayama Hirofumi MZ }
1149d735373eSKatayama Hirofumi MZ 
1150c2c66affSColin Finck /*
115133fe4333SKatayama Hirofumi MZ  * @implemented
1152c2c66affSColin Finck  */
1153c2c66affSColin Finck BOOL
1154c2c66affSColin Finck WINAPI
IMPSetIMEW(HWND hwnd,LPIMEPROW ime)1155c2c66affSColin Finck IMPSetIMEW(HWND hwnd, LPIMEPROW ime)
1156c2c66affSColin Finck {
115733fe4333SKatayama Hirofumi MZ     return IMM_FN(ImmIMPSetIMEW)(hwnd, ime);
1158c2c66affSColin Finck }
1159c2c66affSColin Finck 
1160c2c66affSColin Finck /*
116133fe4333SKatayama Hirofumi MZ  * @implemented
1162c2c66affSColin Finck  */
1163c2c66affSColin Finck BOOL
1164c2c66affSColin Finck WINAPI
IMPQueryIMEW(LPIMEPROW ime)1165c2c66affSColin Finck IMPQueryIMEW(LPIMEPROW ime)
1166c2c66affSColin Finck {
116733fe4333SKatayama Hirofumi MZ     return IMM_FN(ImmIMPQueryIMEW)(ime);
1168c2c66affSColin Finck }
1169c2c66affSColin Finck 
1170c2c66affSColin Finck /*
117133fe4333SKatayama Hirofumi MZ  * @implemented
1172c2c66affSColin Finck  */
1173c2c66affSColin Finck BOOL
1174c2c66affSColin Finck WINAPI
IMPGetIMEW(HWND hwnd,LPIMEPROW ime)1175c2c66affSColin Finck IMPGetIMEW(HWND hwnd, LPIMEPROW ime)
1176c2c66affSColin Finck {
117733fe4333SKatayama Hirofumi MZ     return IMM_FN(ImmIMPGetIMEW)(hwnd, ime);
1178c2c66affSColin Finck }
1179c2c66affSColin Finck 
1180c2c66affSColin Finck /*
118133fe4333SKatayama Hirofumi MZ  * @implemented
1182c2c66affSColin Finck  */
1183c2c66affSColin Finck BOOL
1184c2c66affSColin Finck WINAPI
IMPSetIMEA(HWND hwnd,LPIMEPROA ime)1185c2c66affSColin Finck IMPSetIMEA(HWND hwnd, LPIMEPROA ime)
1186c2c66affSColin Finck {
118733fe4333SKatayama Hirofumi MZ     return IMM_FN(ImmIMPSetIMEA)(hwnd, ime);
1188c2c66affSColin Finck }
1189c2c66affSColin Finck 
1190c2c66affSColin Finck /*
119133fe4333SKatayama Hirofumi MZ  * @implemented
1192c2c66affSColin Finck  */
1193c2c66affSColin Finck BOOL
1194c2c66affSColin Finck WINAPI
IMPQueryIMEA(LPIMEPROA ime)1195c2c66affSColin Finck IMPQueryIMEA(LPIMEPROA ime)
1196c2c66affSColin Finck {
119733fe4333SKatayama Hirofumi MZ     return IMM_FN(ImmIMPQueryIMEA)(ime);
1198c2c66affSColin Finck }
1199c2c66affSColin Finck 
1200c2c66affSColin Finck /*
120133fe4333SKatayama Hirofumi MZ  * @implemented
1202c2c66affSColin Finck  */
1203c2c66affSColin Finck BOOL
1204c2c66affSColin Finck WINAPI
IMPGetIMEA(HWND hwnd,LPIMEPROA ime)1205c2c66affSColin Finck IMPGetIMEA(HWND hwnd, LPIMEPROA ime)
1206c2c66affSColin Finck {
120733fe4333SKatayama Hirofumi MZ     return IMM_FN(ImmIMPGetIMEA)(hwnd, ime);
1208c2c66affSColin Finck }
1209c2c66affSColin Finck 
1210c2c66affSColin Finck /*
121133fe4333SKatayama Hirofumi MZ  * @implemented
1212c2c66affSColin Finck  */
1213c2c66affSColin Finck LRESULT
1214c2c66affSColin Finck WINAPI
SendIMEMessageExW(HWND hwnd,LPARAM lParam)121533fe4333SKatayama Hirofumi MZ SendIMEMessageExW(HWND hwnd, LPARAM lParam)
1216c2c66affSColin Finck {
121733fe4333SKatayama Hirofumi MZ     return IMM_FN(ImmSendIMEMessageExW)(hwnd, lParam);
1218c2c66affSColin Finck }
1219c2c66affSColin Finck 
1220c2c66affSColin Finck /*
122133fe4333SKatayama Hirofumi MZ  * @implemented
1222c2c66affSColin Finck  */
1223c2c66affSColin Finck LRESULT
1224c2c66affSColin Finck WINAPI
SendIMEMessageExA(HWND hwnd,LPARAM lParam)122533fe4333SKatayama Hirofumi MZ SendIMEMessageExA(HWND hwnd, LPARAM lParam)
1226c2c66affSColin Finck {
122733fe4333SKatayama Hirofumi MZ     return IMM_FN(ImmSendIMEMessageExA)(hwnd, lParam);
1228c2c66affSColin Finck }
1229c2c66affSColin Finck 
1230c2c66affSColin Finck /*
123133fe4333SKatayama Hirofumi MZ  * @implemented
1232c2c66affSColin Finck  */
1233c2c66affSColin Finck BOOL
1234c2c66affSColin Finck WINAPI
WINNLSEnableIME(HWND hwnd,BOOL enable)1235c2c66affSColin Finck WINNLSEnableIME(HWND hwnd, BOOL enable)
1236c2c66affSColin Finck {
123733fe4333SKatayama Hirofumi MZ     return IMM_FN(ImmWINNLSEnableIME)(hwnd, enable);
1238c2c66affSColin Finck }
1239c2c66affSColin Finck 
1240c2c66affSColin Finck /*
124133fe4333SKatayama Hirofumi MZ  * @implemented
1242c2c66affSColin Finck  */
1243c2c66affSColin Finck BOOL
1244c2c66affSColin Finck WINAPI
WINNLSGetEnableStatus(HWND hwnd)1245c2c66affSColin Finck WINNLSGetEnableStatus(HWND hwnd)
1246c2c66affSColin Finck {
124733fe4333SKatayama Hirofumi MZ     return IMM_FN(ImmWINNLSGetEnableStatus)(hwnd);
1248c2c66affSColin Finck }
1249c2c66affSColin Finck 
1250c2c66affSColin Finck /*
1251c2c66affSColin Finck  * @implemented
1252c2c66affSColin Finck  */
1253c2c66affSColin Finck UINT
1254c2c66affSColin Finck WINAPI
WINNLSGetIMEHotkey(HWND hwnd)1255c2c66affSColin Finck WINNLSGetIMEHotkey(HWND hwnd)
1256c2c66affSColin Finck {
1257c2c66affSColin Finck     return FALSE;
1258c2c66affSColin Finck }
1259