4 * Copyright 1998 Patrik Stridvall
5 * Copyright 2002, 2003 CodeWeavers, Aric Stewart
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(imm);
35 #define FROM_IME 0xcafe1337
37 static void (WINAPI *pX11DRV_ForceXIMReset)(HWND);
39 typedef struct tagInputContextData
41 LPBYTE CompositionString;
42 LPBYTE CompositionReadingString;
44 LPBYTE ResultReadingString;
45 DWORD dwCompStringSize; /* buffer size */
46 DWORD dwCompStringLength; /* string length (in bytes) */
47 DWORD dwCompReadStringSize;
48 DWORD dwResultStringSize;
49 DWORD dwResultReadStringSize;
56 COMPOSITIONFORM CompForm;
59 static InputContextData *root_context = NULL;
60 static HWND hwndDefault = NULL;
61 static HANDLE hImeInst;
62 static const WCHAR WC_IMECLASSNAME[] = {'I','M','E',0};
65 static UINT WM_MSIME_SERVICE;
66 static UINT WM_MSIME_RECONVERTOPTIONS;
67 static UINT WM_MSIME_MOUSE;
68 static UINT WM_MSIME_RECONVERTREQUEST;
69 static UINT WM_MSIME_RECONVERT;
70 static UINT WM_MSIME_QUERYPOSITION;
71 static UINT WM_MSIME_DOCUMENTFEED;
76 static LRESULT WINAPI IME_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
78 static void UpdateDataInDefaultIMEWindow(HWND hwnd);
79 static void ImmInternalPostIMEMessage(UINT, WPARAM, LPARAM);
80 static void ImmInternalSetOpenStatus(BOOL fOpen);
82 static VOID IMM_PostResult(InputContextData *data)
85 TRACE("Posting result as IME_CHAR\n");
87 for (i = 0; i < data->dwResultStringSize / sizeof (WCHAR); i++)
88 ImmInternalPostIMEMessage (WM_IME_CHAR, ((WCHAR*)data->ResultString)[i],
91 /* clear the buffer */
92 if (data->dwResultStringSize)
93 HeapFree(GetProcessHeap(),0,data->ResultString);
94 data->dwResultStringSize = 0;
95 data->ResultString = NULL;
98 static void IMM_Register(void)
101 ZeroMemory(&wndClass, sizeof(WNDCLASSW));
102 wndClass.style = CS_GLOBALCLASS | CS_IME | CS_HREDRAW | CS_VREDRAW;
103 wndClass.lpfnWndProc = (WNDPROC) IME_WindowProc;
104 wndClass.cbClsExtra = 0;
105 wndClass.cbWndExtra = 0;
106 wndClass.hInstance = hImeInst;
107 wndClass.hCursor = LoadCursorW(NULL, (LPWSTR)IDC_ARROW);
108 wndClass.hIcon = NULL;
109 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW +1);
110 wndClass.lpszMenuName = 0;
111 wndClass.lpszClassName = WC_IMECLASSNAME;
112 RegisterClassW(&wndClass);
115 static void IMM_Unregister(void)
117 UnregisterClassW(WC_IMECLASSNAME, NULL);
120 static void IMM_RegisterMessages(void)
122 WM_MSIME_SERVICE = RegisterWindowMessageA("MSIMEService");
123 WM_MSIME_RECONVERTOPTIONS = RegisterWindowMessageA("MSIMEReconvertOptions");
124 WM_MSIME_MOUSE = RegisterWindowMessageA("MSIMEMouseOperation");
125 WM_MSIME_RECONVERTREQUEST = RegisterWindowMessageA("MSIMEReconvertRequest");
126 WM_MSIME_RECONVERT = RegisterWindowMessageA("MSIMEReconvert");
127 WM_MSIME_QUERYPOSITION = RegisterWindowMessageA("MSIMEQueryPosition");
128 WM_MSIME_DOCUMENTFEED = RegisterWindowMessageA("MSIMEDocumentFeed");
132 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpReserved)
136 TRACE("%p, %lx, %p\n",hInstDLL,fdwReason,lpReserved);
139 case DLL_PROCESS_ATTACH:
140 DisableThreadLibraryCalls(hInstDLL);
142 IMM_RegisterMessages();
143 x11drv = GetModuleHandleA("x11drv.dll");
144 if (x11drv) pX11DRV_ForceXIMReset = (void *)GetProcAddress( x11drv, "ForceXIMReset");
146 case DLL_PROCESS_DETACH:
149 DestroyWindow(hwndDefault);
158 /* for posting messages as the IME */
159 static void ImmInternalPostIMEMessage(UINT msg, WPARAM wParam, LPARAM lParam)
161 HWND target = GetFocus();
163 PostMessageW(root_context->hwnd,msg,wParam,lParam);
165 PostMessageW(target, msg, wParam, lParam);
169 static void ImmInternalSetOpenStatus(BOOL fOpen)
171 TRACE("Setting internal state to %s\n",(fOpen)?"OPEN":"CLOSED");
173 root_context->bOpen = fOpen;
174 root_context->bInternalState = fOpen;
178 ShowWindow(hwndDefault,SW_HIDE);
180 if (root_context->dwCompStringSize)
181 HeapFree(GetProcessHeap(),0,root_context->CompositionString);
182 if (root_context->dwCompReadStringSize)
183 HeapFree(GetProcessHeap(),0,root_context->CompositionReadingString);
184 if (root_context->dwResultStringSize)
185 HeapFree(GetProcessHeap(),0,root_context->ResultString);
186 if (root_context->dwResultReadStringSize)
187 HeapFree(GetProcessHeap(),0,root_context->ResultReadingString);
188 root_context->dwCompStringSize = 0;
189 root_context->dwCompStringLength = 0;
190 root_context->CompositionString = NULL;
191 root_context->dwCompReadStringSize = 0;
192 root_context->CompositionReadingString = NULL;
193 root_context->dwResultStringSize = 0;
194 root_context->ResultString = NULL;
195 root_context->dwResultReadStringSize = 0;
196 root_context->ResultReadingString = NULL;
199 ShowWindow(hwndDefault, SW_SHOWNOACTIVATE);
201 SendMessageW(root_context->hwnd, WM_IME_NOTIFY, IMN_SETOPENSTATUS, 0);
205 /***********************************************************************
206 * ImmAssociateContext (IMM32.@)
208 HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC)
210 InputContextData *data = (InputContextData*)hIMC;
212 WARN("(%p, %p): semi-stub\n",hWnd,hIMC);
218 * WINE SPECIFIC! MAY CONFLICT
219 * associate the root context we have an XIM created
223 root_context = (InputContextData*)hIMC;
227 * If already associated just return
229 if (data->hwnd == hWnd)
232 if (IsWindow(data->hwnd))
235 * Post a message that your context is switching
237 SendMessageW(data->hwnd, WM_IME_SETCONTEXT, FALSE, ISC_SHOWUIALL);
242 if (IsWindow(data->hwnd))
245 * Post a message that your context is switching
247 SendMessageW(data->hwnd, WM_IME_SETCONTEXT, TRUE, ISC_SHOWUIALL);
251 * TODO: We need to keep track of the old context associated
252 * with a window and return it for now we will return NULL;
257 /***********************************************************************
258 * ImmConfigureIMEA (IMM32.@)
260 BOOL WINAPI ImmConfigureIMEA(
261 HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData)
263 FIXME("(%p, %p, %ld, %p): stub\n",
264 hKL, hWnd, dwMode, lpData
266 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
270 /***********************************************************************
271 * ImmConfigureIMEW (IMM32.@)
273 BOOL WINAPI ImmConfigureIMEW(
274 HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData)
276 FIXME("(%p, %p, %ld, %p): stub\n",
277 hKL, hWnd, dwMode, lpData
279 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
283 /***********************************************************************
284 * ImmCreateContext (IMM32.@)
286 HIMC WINAPI ImmCreateContext(void)
288 InputContextData *new_context;
290 new_context = HeapAlloc(GetProcessHeap(),0,sizeof(InputContextData));
291 ZeroMemory(new_context,sizeof(InputContextData));
293 return (HIMC)new_context;
296 /***********************************************************************
297 * ImmDestroyContext (IMM32.@)
299 BOOL WINAPI ImmDestroyContext(HIMC hIMC)
301 InputContextData *data = (InputContextData*)hIMC;
303 TRACE("Destroying %p\n",hIMC);
307 if (data->dwCompStringSize)
308 HeapFree(GetProcessHeap(),0,data->CompositionString);
309 if (data->dwCompReadStringSize)
310 HeapFree(GetProcessHeap(),0,data->CompositionReadingString);
311 if (data->dwResultStringSize)
312 HeapFree(GetProcessHeap(),0,data->ResultString);
313 if (data->dwResultReadStringSize)
314 HeapFree(GetProcessHeap(),0,data->ResultReadingString);
318 DeleteObject(data->textfont);
319 data->textfont = NULL;
322 HeapFree(GetProcessHeap(),0,data);
327 /***********************************************************************
328 * ImmDisableIME (IMM32.@)
330 BOOL WINAPI ImmDisableIME(DWORD idThread)
332 FIXME("(%ld): stub\n", idThread);
336 /***********************************************************************
337 * ImmEnumRegisterWordA (IMM32.@)
339 UINT WINAPI ImmEnumRegisterWordA(
340 HKL hKL, REGISTERWORDENUMPROCA lpfnEnumProc,
341 LPCSTR lpszReading, DWORD dwStyle,
342 LPCSTR lpszRegister, LPVOID lpData)
344 FIXME("(%p, %p, %s, %ld, %s, %p): stub\n",
346 debugstr_a(lpszReading), dwStyle,
347 debugstr_a(lpszRegister), lpData
349 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
353 /***********************************************************************
354 * ImmEnumRegisterWordW (IMM32.@)
356 UINT WINAPI ImmEnumRegisterWordW(
357 HKL hKL, REGISTERWORDENUMPROCW lpfnEnumProc,
358 LPCWSTR lpszReading, DWORD dwStyle,
359 LPCWSTR lpszRegister, LPVOID lpData)
361 FIXME("(%p, %p, %s, %ld, %s, %p): stub\n",
363 debugstr_w(lpszReading), dwStyle,
364 debugstr_w(lpszRegister), lpData
366 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
370 /***********************************************************************
371 * ImmEscapeA (IMM32.@)
373 LRESULT WINAPI ImmEscapeA(
375 UINT uEscape, LPVOID lpData)
377 FIXME("(%p, %p, %d, %p): stub\n",
378 hKL, hIMC, uEscape, lpData
380 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
384 /***********************************************************************
385 * ImmEscapeW (IMM32.@)
387 LRESULT WINAPI ImmEscapeW(
389 UINT uEscape, LPVOID lpData)
391 FIXME("(%p, %p, %d, %p): stub\n",
392 hKL, hIMC, uEscape, lpData
394 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
398 /***********************************************************************
399 * ImmGetCandidateListA (IMM32.@)
401 DWORD WINAPI ImmGetCandidateListA(
402 HIMC hIMC, DWORD deIndex,
403 LPCANDIDATELIST lpCandList, DWORD dwBufLen)
405 FIXME("(%p, %ld, %p, %ld): stub\n",
409 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
413 /***********************************************************************
414 * ImmGetCandidateListCountA (IMM32.@)
416 DWORD WINAPI ImmGetCandidateListCountA(
417 HIMC hIMC, LPDWORD lpdwListCount)
419 FIXME("(%p, %p): stub\n", hIMC, lpdwListCount);
420 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
424 /***********************************************************************
425 * ImmGetCandidateListCountW (IMM32.@)
427 DWORD WINAPI ImmGetCandidateListCountW(
428 HIMC hIMC, LPDWORD lpdwListCount)
430 FIXME("(%p, %p): stub\n", hIMC, lpdwListCount);
431 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
435 /***********************************************************************
436 * ImmGetCandidateListW (IMM32.@)
438 DWORD WINAPI ImmGetCandidateListW(
439 HIMC hIMC, DWORD deIndex,
440 LPCANDIDATELIST lpCandList, DWORD dwBufLen)
442 FIXME("(%p, %ld, %p, %ld): stub\n",
446 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
450 /***********************************************************************
451 * ImmGetCandidateWindow (IMM32.@)
453 BOOL WINAPI ImmGetCandidateWindow(
454 HIMC hIMC, DWORD dwBufLen, LPCANDIDATEFORM lpCandidate)
456 FIXME("(%p, %ld, %p): stub\n", hIMC, dwBufLen, lpCandidate);
457 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
461 /***********************************************************************
462 * ImmGetCompositionFontA (IMM32.@)
464 BOOL WINAPI ImmGetCompositionFontA(HIMC hIMC, LPLOGFONTA lplf)
466 FIXME("(%p, %p): stub\n", hIMC, lplf);
467 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
471 /***********************************************************************
472 * ImmGetCompositionFontW (IMM32.@)
474 BOOL WINAPI ImmGetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf)
476 FIXME("(%p, %p): stub\n", hIMC, lplf);
477 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
481 /***********************************************************************
482 * ImmGetCompositionStringA (IMM32.@)
484 LONG WINAPI ImmGetCompositionStringA(
485 HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
489 InputContextData *data = (InputContextData*)hIMC;
491 TRACE("(%p, 0x%lx, %p, %ld)\n", hIMC, dwIndex, lpBuf, dwBufLen);
496 if (dwIndex == GCS_RESULTSTR)
498 TRACE("GSC_RESULTSTR %p %li\n",data->ResultString,
499 data->dwResultStringSize);
501 buf = HeapAlloc( GetProcessHeap(), 0, data->dwResultStringSize * 3 );
502 rc = WideCharToMultiByte(CP_ACP, 0, (LPWSTR)data->ResultString,
503 data->dwResultStringSize / sizeof(WCHAR), buf,
504 data->dwResultStringSize * 3, NULL, NULL);
506 memcpy(lpBuf,buf,rc);
509 HeapFree( GetProcessHeap(), 0, buf );
511 else if (dwIndex == GCS_COMPSTR)
513 TRACE("GSC_COMPSTR %p %li\n",data->CompositionString,
514 data->dwCompStringLength/ sizeof(WCHAR));
516 buf = HeapAlloc( GetProcessHeap(), 0, data->dwCompStringLength * 3 );
517 rc = WideCharToMultiByte(CP_ACP, 0,(LPWSTR)data->CompositionString,
518 data->dwCompStringLength/ sizeof(WCHAR), buf,
519 data->dwCompStringLength* 3, NULL, NULL);
521 memcpy(lpBuf,buf,rc);
522 HeapFree( GetProcessHeap(), 0, buf );
524 else if (dwIndex == GCS_COMPATTR)
526 TRACE("GSC_COMPATTR %p %li\n",data->CompositionString,
527 data->dwCompStringLength/ sizeof(WCHAR));
529 rc = WideCharToMultiByte(CP_ACP, 0, (LPWSTR)data->CompositionString,
530 data->dwCompStringLength/ sizeof(WCHAR), NULL,
536 for (i = 0; i < rc; i++)
537 ((LPBYTE)lpBuf)[i] = ATTR_INPUT;
540 else if (dwIndex == GCS_COMPCLAUSE)
542 TRACE("GSC_COMPCLAUSE %p %li\n",data->CompositionString,
543 data->dwCompStringLength/ sizeof(WCHAR));
545 rc = WideCharToMultiByte(CP_ACP, 0, (LPWSTR)data->CompositionString,
546 data->dwCompStringLength/ sizeof(WCHAR), NULL,
549 if (dwBufLen >= sizeof(DWORD)*2)
551 ((LPDWORD)lpBuf)[0] = 0;
552 ((LPDWORD)lpBuf)[1] = rc;
554 rc = sizeof(DWORD)*2;
558 FIXME("Unhandled index 0x%lx\n",dwIndex);
564 /***********************************************************************
565 * ImmGetCompositionStringW (IMM32.@)
567 LONG WINAPI ImmGetCompositionStringW(
568 HIMC hIMC, DWORD dwIndex,
569 LPVOID lpBuf, DWORD dwBufLen)
572 InputContextData *data = (InputContextData*)hIMC;
574 TRACE("(%p, 0x%lx, %p, %ld)\n",
575 hIMC, dwIndex, lpBuf, dwBufLen
581 if (dwIndex == GCS_RESULTSTR)
585 if (dwBufLen >= data->dwResultStringSize)
586 memcpy(lpBuf,data->ResultString,data->dwResultStringSize);
588 rc = data->dwResultStringSize;
590 else if (dwIndex == GCS_RESULTREADSTR)
592 if (dwBufLen >= data->dwResultReadStringSize)
593 memcpy(lpBuf,data->ResultReadingString,
594 data->dwResultReadStringSize);
596 rc = data->dwResultReadStringSize;
598 else if (dwIndex == GCS_COMPSTR)
600 if (dwBufLen >= data->dwCompStringLength)
601 memcpy(lpBuf,data->CompositionString,data->dwCompStringLength);
603 rc = data->dwCompStringLength;
605 else if (dwIndex == GCS_COMPATTR)
607 int len = data->dwCompStringLength;
612 for (i = 0; i < len; i++)
613 ((LPBYTE)lpBuf)[i] = ATTR_INPUT;
618 else if (dwIndex == GCS_COMPCLAUSE)
620 if (dwBufLen >= sizeof(DWORD)*2)
622 ((LPDWORD)lpBuf)[0] = 0;
623 ((LPDWORD)lpBuf)[1] = data->dwCompStringLength/sizeof(WCHAR);
625 rc = sizeof(DWORD)*2;
627 else if (dwIndex == GCS_COMPREADSTR)
629 if (dwBufLen >= data->dwCompReadStringSize)
630 memcpy(lpBuf,data->CompositionReadingString,
631 data->dwCompReadStringSize);
633 rc = data->dwCompReadStringSize;
637 FIXME("Unhandled index 0x%lx\n",dwIndex);
643 /***********************************************************************
644 * ImmGetCompositionWindow (IMM32.@)
646 BOOL WINAPI ImmGetCompositionWindow(HIMC hIMC, LPCOMPOSITIONFORM lpCompForm)
648 InputContextData *data = (InputContextData*)hIMC;
650 TRACE("(%p, %p)\n", hIMC, lpCompForm);
655 memcpy(lpCompForm,&(data->CompForm),sizeof(COMPOSITIONFORM));
659 /***********************************************************************
660 * ImmGetContext (IMM32.@)
663 HIMC WINAPI ImmGetContext(HWND hWnd)
665 FIXME("(%p): stub\n", hWnd);
670 root_context->hwnd = hWnd;
671 return (HIMC)root_context;
674 /***********************************************************************
675 * ImmGetConversionListA (IMM32.@)
677 DWORD WINAPI ImmGetConversionListA(
679 LPCSTR pSrc, LPCANDIDATELIST lpDst,
680 DWORD dwBufLen, UINT uFlag)
682 FIXME("(%p, %p, %s, %p, %ld, %d): stub\n",
683 hKL, hIMC, debugstr_a(pSrc), lpDst, dwBufLen, uFlag
685 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
689 /***********************************************************************
690 * ImmGetConversionListW (IMM32.@)
692 DWORD WINAPI ImmGetConversionListW(
694 LPCWSTR pSrc, LPCANDIDATELIST lpDst,
695 DWORD dwBufLen, UINT uFlag)
697 FIXME("(%p, %p, %s, %p, %ld, %d): stub\n",
698 hKL, hIMC, debugstr_w(pSrc), lpDst, dwBufLen, uFlag
700 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
704 /***********************************************************************
705 * ImmGetConversionStatus (IMM32.@)
707 BOOL WINAPI ImmGetConversionStatus(
708 HIMC hIMC, LPDWORD lpfdwConversion, LPDWORD lpfdwSentence)
710 TRACE("(%p, %p, %p): best guess\n", hIMC, lpfdwConversion, lpfdwSentence);
712 *lpfdwConversion = IME_CMODE_NATIVE;
714 *lpfdwSentence = IME_SMODE_NONE;
718 /***********************************************************************
719 * ImmGetDefaultIMEWnd (IMM32.@)
721 HWND WINAPI ImmGetDefaultIMEWnd(HWND hWnd)
723 FIXME("(%p - %p %p ): semi-stub\n", hWnd,hwndDefault, root_context);
725 if (hwndDefault == NULL)
727 static const WCHAR the_name[] = {'I','M','E','\0'};
730 hwndDefault = CreateWindowExW( WS_EX_CLIENTEDGE, WC_IMECLASSNAME,
731 the_name, WS_POPUPWINDOW|WS_CAPTION, 0, 0, 120, 55, 0, 0,
734 TRACE("Default created (0x%x)\n",(INT)hwndDefault);
737 return (HWND)hwndDefault;
740 /***********************************************************************
741 * ImmGetDescriptionA (IMM32.@)
743 UINT WINAPI ImmGetDescriptionA(
744 HKL hKL, LPSTR lpszDescription, UINT uBufLen)
749 TRACE("%p %p %d\n", hKL, lpszDescription, uBufLen);
751 /* find out how many characters in the unicode buffer */
752 len = ImmGetDescriptionW( hKL, NULL, 0 );
754 /* allocate a buffer of that size */
755 buf = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof (WCHAR) );
759 /* fetch the unicode buffer */
760 len = ImmGetDescriptionW( hKL, buf, len + 1 );
762 /* convert it back to ASCII */
763 len = WideCharToMultiByte( CP_ACP, 0, buf, len + 1,
764 lpszDescription, uBufLen, NULL, NULL );
766 HeapFree( GetProcessHeap(), 0, buf );
771 /***********************************************************************
772 * ImmGetDescriptionW (IMM32.@)
774 UINT WINAPI ImmGetDescriptionW(HKL hKL, LPWSTR lpszDescription, UINT uBufLen)
776 static const WCHAR name[] = { 'W','i','n','e',' ','X','I','M',0 };
778 FIXME("(%p, %p, %d): semi stub\n", hKL, lpszDescription, uBufLen);
780 if (!uBufLen) return lstrlenW( name );
781 lstrcpynW( lpszDescription, name, uBufLen );
782 return lstrlenW( lpszDescription );
785 /***********************************************************************
786 * ImmGetGuideLineA (IMM32.@)
788 DWORD WINAPI ImmGetGuideLineA(
789 HIMC hIMC, DWORD dwIndex, LPSTR lpBuf, DWORD dwBufLen)
791 FIXME("(%p, %ld, %s, %ld): stub\n",
792 hIMC, dwIndex, debugstr_a(lpBuf), dwBufLen
794 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
798 /***********************************************************************
799 * ImmGetGuideLineW (IMM32.@)
801 DWORD WINAPI ImmGetGuideLineW(HIMC hIMC, DWORD dwIndex, LPWSTR lpBuf, DWORD dwBufLen)
803 FIXME("(%p, %ld, %s, %ld): stub\n",
804 hIMC, dwIndex, debugstr_w(lpBuf), dwBufLen
806 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
810 /***********************************************************************
811 * ImmGetIMEFileNameA (IMM32.@)
813 UINT WINAPI ImmGetIMEFileNameA(
814 HKL hKL, LPSTR lpszFileName, UINT uBufLen)
816 FIXME("(%p, %p, %d): stub\n", hKL, lpszFileName, uBufLen);
817 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
821 /***********************************************************************
822 * ImmGetIMEFileNameW (IMM32.@)
824 UINT WINAPI ImmGetIMEFileNameW(
825 HKL hKL, LPWSTR lpszFileName, UINT uBufLen)
827 FIXME("(%p, %p, %d): stub\n", hKL, lpszFileName, uBufLen);
828 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
832 /***********************************************************************
833 * ImmGetOpenStatus (IMM32.@)
835 BOOL WINAPI ImmGetOpenStatus(HIMC hIMC)
837 InputContextData *data = (InputContextData*)hIMC;
841 FIXME("(%p): semi-stub\n", hIMC);
846 /***********************************************************************
847 * ImmGetProperty (IMM32.@)
849 DWORD WINAPI ImmGetProperty(HKL hKL, DWORD fdwIndex)
852 TRACE("(%p, %ld)\n", hKL, fdwIndex);
857 TRACE("(%s)\n", "IGP_PROPERTY");
858 rc = IME_PROP_UNICODE | IME_PROP_AT_CARET;
861 FIXME("(%s)\n", "IGP_CONVERSION");
862 rc = IME_CMODE_NATIVE;
865 FIXME("%s)\n", "IGP_SENTENCE");
866 rc = IME_SMODE_AUTOMATIC;
869 TRACE("(%s)\n", "IGP_SETCOMPSTR");
873 TRACE("(%s)\n", "IGP_SELECT");
874 rc = SELECT_CAP_CONVERSION | SELECT_CAP_SENTENCE;
876 case IGP_GETIMEVERSION:
877 TRACE("(%s)\n", "IGP_GETIMEVERSION");
881 TRACE("(%s)\n", "IGP_UI");
890 /***********************************************************************
891 * ImmGetRegisterWordStyleA (IMM32.@)
893 UINT WINAPI ImmGetRegisterWordStyleA(
894 HKL hKL, UINT nItem, LPSTYLEBUFA lpStyleBuf)
896 FIXME("(%p, %d, %p): stub\n", hKL, nItem, lpStyleBuf);
897 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
901 /***********************************************************************
902 * ImmGetRegisterWordStyleW (IMM32.@)
904 UINT WINAPI ImmGetRegisterWordStyleW(
905 HKL hKL, UINT nItem, LPSTYLEBUFW lpStyleBuf)
907 FIXME("(%p, %d, %p): stub\n", hKL, nItem, lpStyleBuf);
908 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
912 /***********************************************************************
913 * ImmGetStatusWindowPos (IMM32.@)
915 BOOL WINAPI ImmGetStatusWindowPos(HIMC hIMC, LPPOINT lpptPos)
917 FIXME("(%p, %p): stub\n", hIMC, lpptPos);
918 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
922 /***********************************************************************
923 * ImmGetVirtualKey (IMM32.@)
925 UINT WINAPI ImmGetVirtualKey(HWND hWnd)
927 OSVERSIONINFOA version;
928 FIXME("(%p): stub\n", hWnd);
929 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
930 GetVersionExA( &version );
931 switch(version.dwPlatformId)
933 case VER_PLATFORM_WIN32_WINDOWS:
934 return VK_PROCESSKEY;
935 case VER_PLATFORM_WIN32_NT:
938 FIXME("%ld not supported\n",version.dwPlatformId);
939 return VK_PROCESSKEY;
943 /***********************************************************************
944 * ImmInstallIMEA (IMM32.@)
946 HKL WINAPI ImmInstallIMEA(
947 LPCSTR lpszIMEFileName, LPCSTR lpszLayoutText)
949 FIXME("(%s, %s): stub\n",
950 debugstr_a(lpszIMEFileName), debugstr_a(lpszLayoutText)
952 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
956 /***********************************************************************
957 * ImmInstallIMEW (IMM32.@)
959 HKL WINAPI ImmInstallIMEW(
960 LPCWSTR lpszIMEFileName, LPCWSTR lpszLayoutText)
962 FIXME("(%s, %s): stub\n",
963 debugstr_w(lpszIMEFileName), debugstr_w(lpszLayoutText)
965 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
969 /***********************************************************************
972 BOOL WINAPI ImmIsIME(HKL hKL)
974 FIXME("(%p): semi-stub\n", hKL);
976 * Dead key locales will return TRUE here when they should not
977 * There is probibly a more proper way to check this.
979 return (root_context != NULL);
982 /***********************************************************************
983 * ImmIsUIMessageA (IMM32.@)
985 BOOL WINAPI ImmIsUIMessageA(
986 HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
990 TRACE("(%p, %x, %d, %ld)\n", hWndIME, msg, wParam, lParam);
991 if ((msg >= WM_IME_STARTCOMPOSITION && msg <= WM_IME_KEYLAST) ||
992 (msg >= WM_IME_SETCONTEXT && msg <= WM_IME_KEYUP) ||
993 (msg == WM_MSIME_SERVICE) ||
994 (msg == WM_MSIME_RECONVERTOPTIONS) ||
995 (msg == WM_MSIME_MOUSE) ||
996 (msg == WM_MSIME_RECONVERTREQUEST) ||
997 (msg == WM_MSIME_RECONVERT) ||
998 (msg == WM_MSIME_QUERYPOSITION) ||
999 (msg == WM_MSIME_DOCUMENTFEED))
1003 ImmGetDefaultIMEWnd(NULL);
1005 if (hWndIME == NULL)
1006 PostMessageA(hwndDefault, msg, wParam, lParam);
1013 /***********************************************************************
1014 * ImmIsUIMessageW (IMM32.@)
1016 BOOL WINAPI ImmIsUIMessageW(
1017 HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
1020 TRACE("(%p, %d, %d, %ld): stub\n", hWndIME, msg, wParam, lParam);
1021 if ((msg >= WM_IME_STARTCOMPOSITION && msg <= WM_IME_KEYLAST) ||
1022 (msg >= WM_IME_SETCONTEXT && msg <= WM_IME_KEYUP) ||
1023 (msg == WM_MSIME_SERVICE) ||
1024 (msg == WM_MSIME_RECONVERTOPTIONS) ||
1025 (msg == WM_MSIME_MOUSE) ||
1026 (msg == WM_MSIME_RECONVERTREQUEST) ||
1027 (msg == WM_MSIME_RECONVERT) ||
1028 (msg == WM_MSIME_QUERYPOSITION) ||
1029 (msg == WM_MSIME_DOCUMENTFEED))
1034 /***********************************************************************
1035 * ImmNotifyIME (IMM32.@)
1037 BOOL WINAPI ImmNotifyIME(
1038 HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
1041 FIXME("(%p, %ld, %ld, %ld): stub\n",
1042 hIMC, dwAction, dwIndex, dwValue);
1046 case NI_CHANGECANDIDATELIST:
1047 FIXME("%s\n","NI_CHANGECANDIDATELIST");
1049 case NI_CLOSECANDIDATE:
1050 FIXME("%s\n","NI_CLOSECANDIDATE");
1052 case NI_COMPOSITIONSTR:
1056 TRACE("%s - %s\n","NI_COMPOSITIONSTR","CPS_CANCEL");
1057 if (pX11DRV_ForceXIMReset)
1058 pX11DRV_ForceXIMReset(root_context->hwnd);
1059 if (root_context->dwCompStringSize)
1061 HeapFree(GetProcessHeap(),0,
1062 root_context->CompositionString);
1063 root_context->dwCompStringSize = 0;
1064 root_context->dwCompStringLength = 0;
1065 root_context->CompositionString = NULL;
1066 ImmInternalPostIMEMessage(WM_IME_COMPOSITION, 0,
1072 TRACE("%s - %s\n","NI_COMPOSITIONSTR","CPS_COMPLETE");
1073 if (hIMC != (HIMC)FROM_IME && pX11DRV_ForceXIMReset)
1074 pX11DRV_ForceXIMReset(root_context->hwnd);
1076 if (root_context->dwResultStringSize)
1078 HeapFree(GetProcessHeap(),0,root_context->ResultString);
1079 root_context->dwResultStringSize = 0;
1080 root_context->ResultString = NULL;
1082 if (root_context->dwCompStringLength)
1084 root_context->ResultString = HeapAlloc(
1085 GetProcessHeap(), 0, root_context->dwCompStringLength);
1086 root_context->dwResultStringSize =
1087 root_context->dwCompStringLength;
1089 memcpy(root_context->ResultString,
1090 root_context->CompositionString,
1091 root_context->dwCompStringLength);
1093 HeapFree(GetProcessHeap(),0,
1094 root_context->CompositionString);
1096 root_context->dwCompStringSize = 0;
1097 root_context->dwCompStringLength = 0;
1098 root_context->CompositionString = NULL;
1099 root_context->bRead = FALSE;
1101 ImmInternalPostIMEMessage(WM_IME_COMPOSITION, 0,
1104 ImmInternalPostIMEMessage(WM_IME_COMPOSITION,
1105 root_context->ResultString[0],
1106 GCS_RESULTSTR|GCS_RESULTCLAUSE);
1110 FIXME("%s - %s\n","NI_COMPOSITIONSTR","CPS_CONVERT");
1113 FIXME("%s - %s\n","NI_COMPOSITIONSTR","CPS_REVERT");
1116 ERR("%s - %s (%li)\n","NI_COMPOSITIONSTR","UNKNOWN",dwIndex);
1120 case NI_IMEMENUSELECTED:
1121 FIXME("%s\n", "NI_IMEMENUSELECTED");
1123 case NI_OPENCANDIDATE:
1124 FIXME("%s\n", "NI_OPENCANDIDATE");
1126 case NI_SELECTCANDIDATESTR:
1127 FIXME("%s\n", "NI_SELECTCANDIDATESTR");
1129 case NI_SETCANDIDATE_PAGESIZE:
1130 FIXME("%s\n", "NI_SETCANDIDATE_PAGESIZE");
1132 case NI_SETCANDIDATE_PAGESTART:
1133 FIXME("%s\n", "NI_SETCANDIDATE_PAGESTART");
1142 /***********************************************************************
1143 * ImmRegisterWordA (IMM32.@)
1145 BOOL WINAPI ImmRegisterWordA(
1146 HKL hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR lpszRegister)
1148 FIXME("(%p, %s, %ld, %s): stub\n",
1149 hKL, debugstr_a(lpszReading), dwStyle, debugstr_a(lpszRegister)
1151 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1155 /***********************************************************************
1156 * ImmRegisterWordW (IMM32.@)
1158 BOOL WINAPI ImmRegisterWordW(
1159 HKL hKL, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR lpszRegister)
1161 FIXME("(%p, %s, %ld, %s): stub\n",
1162 hKL, debugstr_w(lpszReading), dwStyle, debugstr_w(lpszRegister)
1164 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1168 /***********************************************************************
1169 * ImmReleaseContext (IMM32.@)
1171 BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC)
1173 FIXME("(%p, %p): stub\n", hWnd, hIMC);
1178 /***********************************************************************
1179 * ImmSetCandidateWindow (IMM32.@)
1181 BOOL WINAPI ImmSetCandidateWindow(
1182 HIMC hIMC, LPCANDIDATEFORM lpCandidate)
1184 FIXME("(%p, %p): stub\n", hIMC, lpCandidate);
1185 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1189 /***********************************************************************
1190 * ImmSetCompositionFontA (IMM32.@)
1192 BOOL WINAPI ImmSetCompositionFontA(HIMC hIMC, LPLOGFONTA lplf)
1194 InputContextData *data = (InputContextData*)hIMC;
1195 TRACE("(%p, %p)\n", hIMC, lplf);
1200 memcpy(&data->font,lplf,sizeof(LOGFONTA));
1201 MultiByteToWideChar(CP_ACP, 0, lplf->lfFaceName, -1, data->font.lfFaceName,
1204 SendMessageW(root_context->hwnd, WM_IME_NOTIFY, IMN_SETCOMPOSITIONFONT, 0);
1208 DeleteObject(data->textfont);
1209 data->textfont = NULL;
1212 data->textfont = CreateFontIndirectW(&data->font);
1216 /***********************************************************************
1217 * ImmSetCompositionFontW (IMM32.@)
1219 BOOL WINAPI ImmSetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf)
1221 InputContextData *data = (InputContextData*)hIMC;
1222 TRACE("(%p, %p)\n", hIMC, lplf);
1227 memcpy(&data->font,lplf,sizeof(LOGFONTW));
1228 SendMessageW(root_context->hwnd, WM_IME_NOTIFY, IMN_SETCOMPOSITIONFONT, 0);
1232 DeleteObject(data->textfont);
1233 data->textfont = NULL;
1235 data->textfont = CreateFontIndirectW(&data->font);
1239 /***********************************************************************
1240 * ImmSetCompositionStringA (IMM32.@)
1242 BOOL WINAPI ImmSetCompositionStringA(
1243 HIMC hIMC, DWORD dwIndex,
1244 LPCVOID lpComp, DWORD dwCompLen,
1245 LPCVOID lpRead, DWORD dwReadLen)
1249 WCHAR *CompBuffer = NULL;
1250 WCHAR *ReadBuffer = NULL;
1253 TRACE("(%p, %ld, %p, %ld, %p, %ld): stub\n",
1254 hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen);
1256 comp_len = MultiByteToWideChar(CP_ACP, 0, lpComp, dwCompLen, NULL, 0);
1259 CompBuffer = (WCHAR*)HeapAlloc(GetProcessHeap(),0,comp_len);
1260 MultiByteToWideChar(CP_ACP, 0, lpComp, dwCompLen, CompBuffer, comp_len);
1263 read_len = MultiByteToWideChar(CP_ACP, 0, lpRead, dwReadLen, NULL, 0);
1266 ReadBuffer = (WCHAR*)HeapAlloc(GetProcessHeap(),0,read_len);
1267 MultiByteToWideChar(CP_ACP, 0, lpRead, dwReadLen, ReadBuffer, read_len);
1270 rc = ImmSetCompositionStringW(hIMC, dwIndex, CompBuffer, comp_len,
1271 ReadBuffer, read_len);
1274 HeapFree(GetProcessHeap(), 0, CompBuffer);
1277 HeapFree(GetProcessHeap(), 0, ReadBuffer);
1282 /***********************************************************************
1283 * ImmSetCompositionStringW (IMM32.@)
1285 BOOL WINAPI ImmSetCompositionStringW(
1286 HIMC hIMC, DWORD dwIndex,
1287 LPCVOID lpComp, DWORD dwCompLen,
1288 LPCVOID lpRead, DWORD dwReadLen)
1293 TRACE("(%p, %ld, %p, %ld, %p, %ld): stub\n",
1294 hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen);
1297 if (hIMC != (HIMC)FROM_IME)
1298 FIXME("PROBLEM: This only sets the wine level string\n");
1302 * this sets the composition string in the imm32.dll level
1303 * of the composition buffer. we cannot manipulate the xim level
1304 * buffer, which means that once the xim level buffer changes again
1305 * any call to this function from the application will be lost
1308 if (lpRead && dwReadLen)
1309 FIXME("Reading string unimplemented\n");
1312 * app operating this api to also receive the message from xim
1315 if (dwIndex == SCS_SETSTR)
1317 flags = GCS_COMPSTR;
1319 if (root_context->dwCompStringLength)
1320 HeapFree(GetProcessHeap(),0,root_context->CompositionString);
1322 root_context->dwCompStringLength = dwCompLen;
1323 root_context->dwCompStringSize = dwCompLen;
1325 if (dwCompLen && lpComp)
1327 root_context->CompositionString = HeapAlloc(GetProcessHeap(), 0,
1329 memcpy(root_context->CompositionString,lpComp,dwCompLen);
1331 wParam = ((WCHAR*)lpComp)[0];
1332 flags |= GCS_COMPCLAUSE | GCS_COMPATTR;
1335 root_context->CompositionString = NULL;
1339 UpdateDataInDefaultIMEWindow(hwndDefault);
1341 ImmInternalPostIMEMessage(WM_IME_COMPOSITION, wParam, flags);
1346 /***********************************************************************
1347 * ImmSetCompositionWindow (IMM32.@)
1349 BOOL WINAPI ImmSetCompositionWindow(
1350 HIMC hIMC, LPCOMPOSITIONFORM lpCompForm)
1352 BOOL reshow = FALSE;
1353 InputContextData *data = (InputContextData*)hIMC;
1355 TRACE("(%p, %p)\n", hIMC, lpCompForm);
1356 TRACE("\t%lx, (%li,%li), (%li,%li - %li,%li)\n",lpCompForm->dwStyle,
1357 lpCompForm->ptCurrentPos.x, lpCompForm->ptCurrentPos.y, lpCompForm->rcArea.top,
1358 lpCompForm->rcArea.left, lpCompForm->rcArea.bottom, lpCompForm->rcArea.right);
1363 memcpy(&data->CompForm,lpCompForm,sizeof(COMPOSITIONFORM));
1365 if (IsWindowVisible(hwndDefault))
1368 ShowWindow(hwndDefault,SW_HIDE);
1374 ShowWindow(hwndDefault,SW_SHOWNOACTIVATE);
1376 SendMessageW(root_context->hwnd, WM_IME_NOTIFY,IMN_SETCOMPOSITIONWINDOW, 0);
1380 /***********************************************************************
1381 * ImmSetConversionStatus (IMM32.@)
1383 BOOL WINAPI ImmSetConversionStatus(
1384 HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence)
1386 FIXME("(%p, %ld, %ld): stub\n",
1387 hIMC, fdwConversion, fdwSentence
1389 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1393 /***********************************************************************
1394 * ImmSetOpenStatus (IMM32.@)
1396 BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen)
1398 InputContextData *data = (InputContextData*)hIMC;
1399 FIXME("Semi-Stub\n");
1401 if (hIMC == (HIMC)FROM_IME)
1404 ImmInternalPostIMEMessage(WM_IME_STARTCOMPOSITION, 0, 0);
1406 ImmInternalSetOpenStatus(fOpen);
1409 ImmInternalPostIMEMessage(WM_IME_ENDCOMPOSITION, 0, 0);
1417 if (fOpen != data->bInternalState)
1419 if (fOpen == FALSE && pX11DRV_ForceXIMReset)
1420 pX11DRV_ForceXIMReset(data->hwnd);
1423 ImmInternalPostIMEMessage(WM_IME_ENDCOMPOSITION,0,0);
1425 ImmInternalPostIMEMessage(WM_IME_STARTCOMPOSITION,0,0);
1427 ImmInternalSetOpenStatus(fOpen);
1428 ImmInternalSetOpenStatus(!fOpen);
1430 if (data->bOpen == FALSE)
1431 ImmInternalPostIMEMessage(WM_IME_ENDCOMPOSITION,0,0);
1433 ImmInternalPostIMEMessage(WM_IME_STARTCOMPOSITION,0,0);
1440 /***********************************************************************
1441 * ImmSetStatusWindowPos (IMM32.@)
1443 BOOL WINAPI ImmSetStatusWindowPos(HIMC hIMC, LPPOINT lpptPos)
1445 FIXME("(%p, %p): stub\n", hIMC, lpptPos);
1446 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1450 /***********************************************************************
1451 * ImmSimulateHotKey (IMM32.@)
1453 BOOL WINAPI ImmSimulateHotKey(HWND hWnd, DWORD dwHotKeyID)
1455 FIXME("(%p, %ld): stub\n", hWnd, dwHotKeyID);
1456 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1460 /***********************************************************************
1461 * ImmUnregisterWordA (IMM32.@)
1463 BOOL WINAPI ImmUnregisterWordA(
1464 HKL hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR lpszUnregister)
1466 FIXME("(%p, %s, %ld, %s): stub\n",
1467 hKL, debugstr_a(lpszReading), dwStyle, debugstr_a(lpszUnregister)
1469 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1473 /***********************************************************************
1474 * ImmUnregisterWordW (IMM32.@)
1476 BOOL WINAPI ImmUnregisterWordW(
1477 HKL hKL, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR lpszUnregister)
1479 FIXME("(%p, %s, %ld, %s): stub\n",
1480 hKL, debugstr_w(lpszReading), dwStyle, debugstr_w(lpszUnregister)
1482 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1488 * Internal functions to help with IME window management
1490 static void PaintDefaultIMEWnd(HWND hwnd)
1494 HDC hdc = BeginPaint(hwnd,&ps);
1495 GetClientRect(hwnd,&rect);
1497 if (root_context->dwCompStringLength && root_context->CompositionString)
1501 HFONT oldfont = NULL;
1503 if (root_context->textfont)
1504 oldfont = SelectObject(hdc,root_context->textfont);
1506 TextOutW(hdc, 0,0,(LPWSTR)root_context->CompositionString,
1507 root_context->dwCompStringLength / sizeof(WCHAR));
1509 GetTextExtentPoint32W(hdc, (LPWSTR)root_context->CompositionString,
1510 root_context->dwCompStringLength / sizeof(WCHAR),
1518 SelectObject(hdc,oldfont);
1520 FillRect(hdc,&rect, (HBRUSH) (COLOR_WINDOW+1));
1524 static void UpdateDataInDefaultIMEWindow(HWND hwnd)
1526 RedrawWindow(hwnd,NULL,NULL,RDW_ERASENOW|RDW_INVALIDATE);
1530 * The window proc for the default IME window
1532 static LRESULT WINAPI IME_WindowProc(HWND hwnd, UINT msg, WPARAM wParam,
1537 TRACE("Incoming Message 0x%x (0x%08x, 0x%08x)\n", msg, (UINT)wParam,
1543 PaintDefaultIMEWnd(hwnd);
1550 SetWindowTextA(hwnd,"Wine Ime Active");
1555 SetFocus((HWND)wParam);
1557 FIXME("Received focus, should never have focus\n");
1559 case WM_IME_COMPOSITION:
1560 TRACE("IME message %s, 0x%x, 0x%x (%i)\n",
1561 "WM_IME_COMPOSITION", (UINT)wParam, (UINT)lParam,
1562 root_context->bRead);
1563 if ((lParam & GCS_RESULTSTR) && (!root_context->bRead))
1564 IMM_PostResult(root_context);
1566 UpdateDataInDefaultIMEWindow(hwnd);
1568 case WM_IME_STARTCOMPOSITION:
1569 TRACE("IME message %s, 0x%x, 0x%x\n",
1570 "WM_IME_STARTCOMPOSITION", (UINT)wParam, (UINT)lParam);
1571 root_context->hwnd = GetFocus();
1572 ShowWindow(hwndDefault,SW_SHOWNOACTIVATE);
1574 case WM_IME_ENDCOMPOSITION:
1575 TRACE("IME message %s, 0x%x, 0x%x\n",
1576 "WM_IME_ENDCOMPOSITION", (UINT)wParam, (UINT)lParam);
1577 ShowWindow(hwndDefault,SW_HIDE);
1580 TRACE("IME message %s, 0x%x, 0x%x\n","WM_IME_SELECT",
1581 (UINT)wParam, (UINT)lParam);
1583 case WM_IME_CONTROL:
1584 TRACE("IME message %s, 0x%x, 0x%x\n","WM_IME_CONTROL",
1585 (UINT)wParam, (UINT)lParam);
1589 TRACE("!! IME NOTIFY\n");
1592 TRACE("Non-standard message 0x%x\n",msg);
1594 /* check the MSIME messages */
1595 if (msg == WM_MSIME_SERVICE)
1597 TRACE("IME message %s, 0x%x, 0x%x\n","WM_MSIME_SERVICE",
1598 (UINT)wParam, (UINT)lParam);
1601 else if (msg == WM_MSIME_RECONVERTOPTIONS)
1603 TRACE("IME message %s, 0x%x, 0x%x\n","WM_MSIME_RECONVERTOPTIONS",
1604 (UINT)wParam, (UINT)lParam);
1606 else if (msg == WM_MSIME_MOUSE)
1608 TRACE("IME message %s, 0x%x, 0x%x\n","WM_MSIME_MOUSE",
1609 (UINT)wParam, (UINT)lParam);
1611 else if (msg == WM_MSIME_RECONVERTREQUEST)
1613 TRACE("IME message %s, 0x%x, 0x%x\n","WM_MSIME_RECONVERTREQUEST",
1614 (UINT)wParam, (UINT)lParam);
1616 else if (msg == WM_MSIME_RECONVERT)
1618 TRACE("IME message %s, 0x%x, 0x%x\n","WM_MSIME_RECONVERT",
1619 (UINT)wParam, (UINT)lParam);
1621 else if (msg == WM_MSIME_QUERYPOSITION)
1623 TRACE("IME message %s, 0x%x, 0x%x\n","WM_MSIME_QUERYPOSITION",
1624 (UINT)wParam, (UINT)lParam);
1626 else if (msg == WM_MSIME_DOCUMENTFEED)
1628 TRACE("IME message %s, 0x%x, 0x%x\n","WM_MSIME_DOCUMENTFEED",
1629 (UINT)wParam, (UINT)lParam);
1631 /* DefWndProc if not an IME message */
1632 else if (!rc && !((msg >= WM_IME_STARTCOMPOSITION && msg <= WM_IME_KEYLAST) ||
1633 (msg >= WM_IME_SETCONTEXT && msg <= WM_IME_KEYUP)))
1634 rc = DefWindowProcW(hwnd,msg,wParam,lParam);