2 * The IME for interfacing with XIM
4 * Copyright 2008 CodeWeavers, Aric Stewart
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 * The normal flow for IMM/IME Processing is as follows.
24 * 1) The Keyboard Driver generates key messages which are first passed to
25 * the IMM and then to IME via ImeProcessKey. If the IME returns 0 then
26 * it does not want the key and the keyboard driver then generates the
27 * WM_KEYUP/WM_KEYDOWN messages. However if the IME is going to process the
28 * key it returns non-zero.
29 * 2) If the IME is going to process the key then the IMM calls ImeToAsciiEx to
30 * process the key. the IME modifies the HIMC structure to reflect the
31 * current state and generates any messages it needs the IMM to process.
32 * 3) IMM checks the messages and send them to the application in question. From
33 * here the IMM level deals with if the application is IME aware or not.
35 * This flow does not work well for the X11 driver and XIM.
36 * (It works fine for Mac)
37 * As such we will have to reroute step 1. Instead the x11drv driver will
38 * generate an XIM events and call directly into this IME implementation.
39 * As such we will have to use the alternative ImmGenerateMessage path to be
40 * generate the messages that we want the IMM layer to send to the application.
51 #include "wine/debug.h"
57 WINE_DEFAULT_DEBUG_CHANNEL(imm
);
59 #define FROM_X11 ((HIMC)0xcafe1337)
61 typedef struct _IMEPRIVATE
{
66 } IMEPRIVATE
, *LPIMEPRIVATE
;
68 typedef struct _tagTRANSMSG
{
72 } TRANSMSG
, *LPTRANSMSG
;
74 static const WCHAR UI_CLASS_NAME
[] = {'W','i','n','e','X','1','1','I','M','E',0};
76 static HIMC
*hSelectedFrom
= NULL
;
77 static INT hSelectedCount
= 0;
80 static UINT WM_MSIME_SERVICE
;
81 static UINT WM_MSIME_RECONVERTOPTIONS
;
82 static UINT WM_MSIME_MOUSE
;
83 static UINT WM_MSIME_RECONVERTREQUEST
;
84 static UINT WM_MSIME_RECONVERT
;
85 static UINT WM_MSIME_QUERYPOSITION
;
86 static UINT WM_MSIME_DOCUMENTFEED
;
88 static LRESULT WINAPI
IME_WindowProc(HWND hwnd
, UINT uMsg
, WPARAM wParam
,
91 static HIMC
RealIMC(HIMC hIMC
)
96 HWND wnd
= GetFocus();
97 HIMC winHimc
= ImmGetContext(wnd
);
98 for (i
= 0; i
< hSelectedCount
; i
++)
99 if (winHimc
== hSelectedFrom
[i
])
107 static LPINPUTCONTEXT
LockRealIMC(HIMC hIMC
)
109 HIMC real_imc
= RealIMC(hIMC
);
111 return ImmLockIMC(real_imc
);
116 static BOOL
UnlockRealIMC(HIMC hIMC
)
118 HIMC real_imc
= RealIMC(hIMC
);
120 return ImmUnlockIMC(real_imc
);
125 static BOOL WINAPI
register_classes( INIT_ONCE
*once
, void *param
, void **context
)
129 ZeroMemory(&wndClass
, sizeof(WNDCLASSW
));
130 wndClass
.style
= CS_GLOBALCLASS
| CS_IME
| CS_HREDRAW
| CS_VREDRAW
;
131 wndClass
.lpfnWndProc
= IME_WindowProc
;
132 wndClass
.cbClsExtra
= 0;
133 wndClass
.cbWndExtra
= 2 * sizeof(LONG_PTR
);
134 wndClass
.hInstance
= x11drv_module
;
135 wndClass
.hCursor
= LoadCursorW(NULL
, (LPWSTR
)IDC_ARROW
);
136 wndClass
.hIcon
= LoadIconW(NULL
, (LPWSTR
)IDI_APPLICATION
);
137 wndClass
.hbrBackground
= (HBRUSH
)(COLOR_WINDOW
+1);
138 wndClass
.lpszMenuName
= 0;
139 wndClass
.lpszClassName
= UI_CLASS_NAME
;
141 RegisterClassW(&wndClass
);
143 WM_MSIME_SERVICE
= RegisterWindowMessageA("MSIMEService");
144 WM_MSIME_RECONVERTOPTIONS
= RegisterWindowMessageA("MSIMEReconvertOptions");
145 WM_MSIME_MOUSE
= RegisterWindowMessageA("MSIMEMouseOperation");
146 WM_MSIME_RECONVERTREQUEST
= RegisterWindowMessageA("MSIMEReconvertRequest");
147 WM_MSIME_RECONVERT
= RegisterWindowMessageA("MSIMEReconvert");
148 WM_MSIME_QUERYPOSITION
= RegisterWindowMessageA("MSIMEQueryPosition");
149 WM_MSIME_DOCUMENTFEED
= RegisterWindowMessageA("MSIMEDocumentFeed");
153 static HIMCC
ImeCreateBlankCompStr(void)
156 LPCOMPOSITIONSTRING ptr
;
157 rc
= ImmCreateIMCC(sizeof(COMPOSITIONSTRING
));
158 ptr
= ImmLockIMCC(rc
);
159 memset(ptr
,0,sizeof(COMPOSITIONSTRING
));
160 ptr
->dwSize
= sizeof(COMPOSITIONSTRING
);
165 static int updateField(DWORD origLen
, DWORD origOffset
, DWORD currentOffset
,
166 LPBYTE target
, LPBYTE source
, DWORD
* lenParam
,
167 DWORD
* offsetParam
, BOOL wchars
)
169 if (origLen
> 0 && origOffset
> 0)
171 int truelen
= origLen
;
173 truelen
*= sizeof(WCHAR
);
175 memcpy(&target
[currentOffset
], &source
[origOffset
], truelen
);
178 *offsetParam
= currentOffset
;
179 currentOffset
+= truelen
;
181 return currentOffset
;
184 static HIMCC
updateCompStr(HIMCC old
, LPCWSTR compstr
, DWORD len
)
186 /* we need to make sure the CompStr, CompClaus and CompAttr fields are all
190 LPBYTE newdata
= NULL
;
191 LPBYTE olddata
= NULL
;
192 LPCOMPOSITIONSTRING new_one
;
193 LPCOMPOSITIONSTRING lpcs
= NULL
;
194 INT current_offset
= 0;
196 TRACE("%s, %i\n",debugstr_wn(compstr
,len
),len
);
198 if (old
== NULL
&& compstr
== NULL
&& len
== 0)
201 if (compstr
== NULL
&& len
!= 0)
203 ERR("compstr is NULL however we have a len! Please report\n");
209 olddata
= ImmLockIMCC(old
);
210 lpcs
= (LPCOMPOSITIONSTRING
)olddata
;
213 needed_size
= sizeof(COMPOSITIONSTRING
) + len
* sizeof(WCHAR
) +
214 len
+ sizeof(DWORD
) * 2;
218 needed_size
+= lpcs
->dwCompReadAttrLen
;
219 needed_size
+= lpcs
->dwCompReadClauseLen
;
220 needed_size
+= lpcs
->dwCompReadStrLen
* sizeof(DWORD
);
221 needed_size
+= lpcs
->dwResultReadClauseLen
;
222 needed_size
+= lpcs
->dwResultReadStrLen
* sizeof(DWORD
);
223 needed_size
+= lpcs
->dwResultClauseLen
;
224 needed_size
+= lpcs
->dwResultStrLen
* sizeof(DWORD
);
225 needed_size
+= lpcs
->dwPrivateSize
;
227 rc
= ImmCreateIMCC(needed_size
);
228 newdata
= ImmLockIMCC(rc
);
229 new_one
= (LPCOMPOSITIONSTRING
)newdata
;
231 new_one
->dwSize
= needed_size
;
232 current_offset
= sizeof(COMPOSITIONSTRING
);
235 current_offset
= updateField(lpcs
->dwCompReadAttrLen
,
236 lpcs
->dwCompReadAttrOffset
,
237 current_offset
, newdata
, olddata
,
238 &new_one
->dwCompReadAttrLen
,
239 &new_one
->dwCompReadAttrOffset
, FALSE
);
241 current_offset
= updateField(lpcs
->dwCompReadClauseLen
,
242 lpcs
->dwCompReadClauseOffset
,
243 current_offset
, newdata
, olddata
,
244 &new_one
->dwCompReadClauseLen
,
245 &new_one
->dwCompReadClauseOffset
, FALSE
);
247 current_offset
= updateField(lpcs
->dwCompReadStrLen
,
248 lpcs
->dwCompReadStrOffset
,
249 current_offset
, newdata
, olddata
,
250 &new_one
->dwCompReadStrLen
,
251 &new_one
->dwCompReadStrOffset
, TRUE
);
253 /* new CompAttr, CompClause, CompStr, dwCursorPos */
254 new_one
->dwDeltaStart
= 0;
256 current_offset
= updateField(lpcs
->dwResultReadClauseLen
,
257 lpcs
->dwResultReadClauseOffset
,
258 current_offset
, newdata
, olddata
,
259 &new_one
->dwResultReadClauseLen
,
260 &new_one
->dwResultReadClauseOffset
, FALSE
);
262 current_offset
= updateField(lpcs
->dwResultReadStrLen
,
263 lpcs
->dwResultReadStrOffset
,
264 current_offset
, newdata
, olddata
,
265 &new_one
->dwResultReadStrLen
,
266 &new_one
->dwResultReadStrOffset
, TRUE
);
268 current_offset
= updateField(lpcs
->dwResultClauseLen
,
269 lpcs
->dwResultClauseOffset
,
270 current_offset
, newdata
, olddata
,
271 &new_one
->dwResultClauseLen
,
272 &new_one
->dwResultClauseOffset
, FALSE
);
274 current_offset
= updateField(lpcs
->dwResultStrLen
,
275 lpcs
->dwResultStrOffset
,
276 current_offset
, newdata
, olddata
,
277 &new_one
->dwResultStrLen
,
278 &new_one
->dwResultStrOffset
, TRUE
);
280 current_offset
= updateField(lpcs
->dwPrivateSize
,
281 lpcs
->dwPrivateOffset
,
282 current_offset
, newdata
, olddata
,
283 &new_one
->dwPrivateSize
,
284 &new_one
->dwPrivateOffset
, FALSE
);
289 new_one
->dwCompAttrLen
= len
;
292 new_one
->dwCompAttrOffset
= current_offset
;
293 memset(&newdata
[current_offset
],ATTR_INPUT
,len
);
294 current_offset
+= len
;
300 new_one
->dwCompClauseLen
= sizeof(DWORD
) * 2;
301 new_one
->dwCompClauseOffset
= current_offset
;
302 *(DWORD
*)(&newdata
[current_offset
]) = 0;
303 current_offset
+= sizeof(DWORD
);
304 *(DWORD
*)(&newdata
[current_offset
]) = len
;
305 current_offset
+= sizeof(DWORD
);
309 new_one
->dwCompStrLen
= len
;
312 new_one
->dwCompStrOffset
= current_offset
;
313 memcpy(&newdata
[current_offset
],compstr
,len
*sizeof(WCHAR
));
317 new_one
->dwCursorPos
= len
;
326 static HIMCC
updateResultStr(HIMCC old
, LPWSTR resultstr
, DWORD len
)
328 /* we need to make sure the ResultStr and ResultClause fields are all
332 LPBYTE newdata
= NULL
;
333 LPBYTE olddata
= NULL
;
334 LPCOMPOSITIONSTRING new_one
;
335 LPCOMPOSITIONSTRING lpcs
= NULL
;
336 INT current_offset
= 0;
338 TRACE("%s, %i\n",debugstr_wn(resultstr
,len
),len
);
340 if (old
== NULL
&& resultstr
== NULL
&& len
== 0)
343 if (resultstr
== NULL
&& len
!= 0)
345 ERR("resultstr is NULL however we have a len! Please report\n");
351 olddata
= ImmLockIMCC(old
);
352 lpcs
= (LPCOMPOSITIONSTRING
)olddata
;
355 needed_size
= sizeof(COMPOSITIONSTRING
) + len
* sizeof(WCHAR
) +
360 needed_size
+= lpcs
->dwCompReadAttrLen
;
361 needed_size
+= lpcs
->dwCompReadClauseLen
;
362 needed_size
+= lpcs
->dwCompReadStrLen
* sizeof(DWORD
);
363 needed_size
+= lpcs
->dwCompAttrLen
;
364 needed_size
+= lpcs
->dwCompClauseLen
;
365 needed_size
+= lpcs
->dwCompStrLen
* sizeof(DWORD
);
366 needed_size
+= lpcs
->dwResultReadClauseLen
;
367 needed_size
+= lpcs
->dwResultReadStrLen
* sizeof(DWORD
);
368 needed_size
+= lpcs
->dwPrivateSize
;
370 rc
= ImmCreateIMCC(needed_size
);
371 newdata
= ImmLockIMCC(rc
);
372 new_one
= (LPCOMPOSITIONSTRING
)newdata
;
374 new_one
->dwSize
= needed_size
;
375 current_offset
= sizeof(COMPOSITIONSTRING
);
378 current_offset
= updateField(lpcs
->dwCompReadAttrLen
,
379 lpcs
->dwCompReadAttrOffset
,
380 current_offset
, newdata
, olddata
,
381 &new_one
->dwCompReadAttrLen
,
382 &new_one
->dwCompReadAttrOffset
, FALSE
);
384 current_offset
= updateField(lpcs
->dwCompReadClauseLen
,
385 lpcs
->dwCompReadClauseOffset
,
386 current_offset
, newdata
, olddata
,
387 &new_one
->dwCompReadClauseLen
,
388 &new_one
->dwCompReadClauseOffset
, FALSE
);
390 current_offset
= updateField(lpcs
->dwCompReadStrLen
,
391 lpcs
->dwCompReadStrOffset
,
392 current_offset
, newdata
, olddata
,
393 &new_one
->dwCompReadStrLen
,
394 &new_one
->dwCompReadStrOffset
, TRUE
);
396 current_offset
= updateField(lpcs
->dwCompAttrLen
,
397 lpcs
->dwCompAttrOffset
,
398 current_offset
, newdata
, olddata
,
399 &new_one
->dwCompAttrLen
,
400 &new_one
->dwCompAttrOffset
, FALSE
);
402 current_offset
= updateField(lpcs
->dwCompClauseLen
,
403 lpcs
->dwCompClauseOffset
,
404 current_offset
, newdata
, olddata
,
405 &new_one
->dwCompClauseLen
,
406 &new_one
->dwCompClauseOffset
, FALSE
);
408 current_offset
= updateField(lpcs
->dwCompStrLen
,
409 lpcs
->dwCompStrOffset
,
410 current_offset
, newdata
, olddata
,
411 &new_one
->dwCompStrLen
,
412 &new_one
->dwCompStrOffset
, TRUE
);
414 new_one
->dwCursorPos
= lpcs
->dwCursorPos
;
415 new_one
->dwDeltaStart
= 0;
417 current_offset
= updateField(lpcs
->dwResultReadClauseLen
,
418 lpcs
->dwResultReadClauseOffset
,
419 current_offset
, newdata
, olddata
,
420 &new_one
->dwResultReadClauseLen
,
421 &new_one
->dwResultReadClauseOffset
, FALSE
);
423 current_offset
= updateField(lpcs
->dwResultReadStrLen
,
424 lpcs
->dwResultReadStrOffset
,
425 current_offset
, newdata
, olddata
,
426 &new_one
->dwResultReadStrLen
,
427 &new_one
->dwResultReadStrOffset
, TRUE
);
429 /* new ResultClause , ResultStr */
431 current_offset
= updateField(lpcs
->dwPrivateSize
,
432 lpcs
->dwPrivateOffset
,
433 current_offset
, newdata
, olddata
,
434 &new_one
->dwPrivateSize
,
435 &new_one
->dwPrivateOffset
, FALSE
);
442 new_one
->dwResultClauseLen
= sizeof(DWORD
) * 2;
443 new_one
->dwResultClauseOffset
= current_offset
;
444 *(DWORD
*)(&newdata
[current_offset
]) = 0;
445 current_offset
+= sizeof(DWORD
);
446 *(DWORD
*)(&newdata
[current_offset
]) = len
;
447 current_offset
+= sizeof(DWORD
);
451 new_one
->dwResultStrLen
= len
;
454 new_one
->dwResultStrOffset
= current_offset
;
455 memcpy(&newdata
[current_offset
],resultstr
,len
*sizeof(WCHAR
));
464 static void GenerateIMEMessage(HIMC hIMC
, UINT msg
, WPARAM wParam
,
467 LPINPUTCONTEXT lpIMC
;
468 LPTRANSMSG lpTransMsg
;
470 lpIMC
= LockRealIMC(hIMC
);
474 lpIMC
->hMsgBuf
= ImmReSizeIMCC(lpIMC
->hMsgBuf
, (lpIMC
->dwNumMsgBuf
+ 1) *
479 lpTransMsg
= ImmLockIMCC(lpIMC
->hMsgBuf
);
483 lpTransMsg
+= lpIMC
->dwNumMsgBuf
;
484 lpTransMsg
->message
= msg
;
485 lpTransMsg
->wParam
= wParam
;
486 lpTransMsg
->lParam
= lParam
;
488 ImmUnlockIMCC(lpIMC
->hMsgBuf
);
489 lpIMC
->dwNumMsgBuf
++;
491 ImmGenerateMessage(RealIMC(hIMC
));
495 static void GenerateIMECHARMessages(HIMC hIMC
, LPWSTR String
, DWORD length
)
497 LPINPUTCONTEXT lpIMC
;
498 LPTRANSMSG lpTransMsg
;
504 lpIMC
= LockRealIMC(hIMC
);
508 lpIMC
->hMsgBuf
= ImmReSizeIMCC(lpIMC
->hMsgBuf
,
509 (lpIMC
->dwNumMsgBuf
+ length
) *
514 lpTransMsg
= ImmLockIMCC(lpIMC
->hMsgBuf
);
518 lpTransMsg
+= lpIMC
->dwNumMsgBuf
;
519 for (i
= 0; i
< length
; i
++)
521 lpTransMsg
->message
= WM_IME_CHAR
;
522 lpTransMsg
->wParam
= String
[i
];
523 lpTransMsg
->lParam
= 1;
527 ImmUnlockIMCC(lpIMC
->hMsgBuf
);
528 lpIMC
->dwNumMsgBuf
+=length
;
530 ImmGenerateMessage(RealIMC(hIMC
));
534 static BOOL
IME_RemoveFromSelected(HIMC hIMC
)
537 for (i
= 0; i
< hSelectedCount
; i
++)
538 if (hSelectedFrom
[i
] == hIMC
)
540 if (i
< hSelectedCount
- 1)
541 memmove(&hSelectedFrom
[i
], &hSelectedFrom
[i
+1], (hSelectedCount
- i
- 1)*sizeof(HIMC
));
548 static void IME_AddToSelected(HIMC hIMC
)
552 hSelectedFrom
= HeapReAlloc(GetProcessHeap(), 0, hSelectedFrom
, hSelectedCount
*sizeof(HIMC
));
554 hSelectedFrom
= HeapAlloc(GetProcessHeap(), 0, sizeof(HIMC
));
555 hSelectedFrom
[hSelectedCount
-1] = hIMC
;
558 BOOL WINAPI
ImeInquire(LPIMEINFO lpIMEInfo
, LPWSTR lpszUIClass
,
561 static INIT_ONCE init_once
= INIT_ONCE_STATIC_INIT
;
564 InitOnceExecuteOnce( &init_once
, register_classes
, NULL
, NULL
);
565 lpIMEInfo
->dwPrivateDataSize
= sizeof (IMEPRIVATE
);
566 lpIMEInfo
->fdwProperty
= IME_PROP_UNICODE
| IME_PROP_AT_CARET
;
567 lpIMEInfo
->fdwConversionCaps
= IME_CMODE_NATIVE
| IME_CMODE_FULLSHAPE
;
568 lpIMEInfo
->fdwSentenceCaps
= IME_SMODE_AUTOMATIC
;
569 lpIMEInfo
->fdwUICaps
= UI_CAP_2700
;
570 /* Tell App we cannot accept ImeSetCompositionString calls */
571 lpIMEInfo
->fdwSCSCaps
= 0;
572 lpIMEInfo
->fdwSelectCaps
= SELECT_CAP_CONVERSION
;
574 lstrcpyW(lpszUIClass
,UI_CLASS_NAME
);
579 BOOL WINAPI
ImeConfigure(HKL hKL
,HWND hWnd
, DWORD dwMode
, LPVOID lpData
)
581 FIXME("(%p, %p, %d, %p): stub\n", hKL
, hWnd
, dwMode
, lpData
);
582 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
586 DWORD WINAPI
ImeConversionList(HIMC hIMC
, LPCWSTR lpSource
,
587 LPCANDIDATELIST lpCandList
, DWORD dwBufLen
, UINT uFlag
)
590 FIXME("(%p, %s, %p, %d, %d): stub\n", hIMC
, debugstr_w(lpSource
),
591 lpCandList
, dwBufLen
, uFlag
);
592 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
596 BOOL WINAPI
ImeDestroy(UINT uForce
)
599 HeapFree(GetProcessHeap(),0,hSelectedFrom
);
600 hSelectedFrom
= NULL
;
605 LRESULT WINAPI
ImeEscape(HIMC hIMC
, UINT uSubFunc
, LPVOID lpData
)
607 FIXME("(%p, %d, %p): stub\n", hIMC
, uSubFunc
, lpData
);
608 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
612 BOOL WINAPI
ImeProcessKey(HIMC hIMC
, UINT vKey
, LPARAM lKeyData
, const LPBYTE lpbKeyState
)
614 /* See the comment at the head of this file */
615 TRACE("We do no processing via this route\n");
619 BOOL WINAPI
ImeSelect(HIMC hIMC
, BOOL fSelect
)
621 LPINPUTCONTEXT lpIMC
;
622 TRACE("%p %s\n",hIMC
,(fSelect
)?"TRUE":"FALSE");
624 if (hIMC
== FROM_X11
)
626 ERR("ImeSelect should never be called from X11\n");
635 return IME_RemoveFromSelected(hIMC
);
637 IME_AddToSelected(hIMC
);
639 /* Initialize our structures */
640 lpIMC
= LockRealIMC(hIMC
);
643 LPIMEPRIVATE myPrivate
;
644 myPrivate
= ImmLockIMCC(lpIMC
->hPrivate
);
645 myPrivate
->bInComposition
= FALSE
;
646 myPrivate
->bInternalState
= FALSE
;
647 myPrivate
->textfont
= NULL
;
648 myPrivate
->hwndDefault
= NULL
;
649 ImmUnlockIMCC(lpIMC
->hPrivate
);
656 BOOL WINAPI
ImeSetActiveContext(HIMC hIMC
,BOOL fFlag
)
658 FIXME("(%p, %x): stub\n", hIMC
, fFlag
);
662 UINT WINAPI
ImeToAsciiEx (UINT uVKey
, UINT uScanCode
, const LPBYTE lpbKeyState
,
663 LPDWORD lpdwTransKey
, UINT fuState
, HIMC hIMC
)
665 /* See the comment at the head of this file */
666 TRACE("We do no processing via this route\n");
670 BOOL WINAPI
NotifyIME(HIMC hIMC
, DWORD dwAction
, DWORD dwIndex
, DWORD dwValue
)
673 LPINPUTCONTEXT lpIMC
;
675 TRACE("%p %i %i %i\n",hIMC
,dwAction
,dwIndex
,dwValue
);
677 lpIMC
= LockRealIMC(hIMC
);
683 case NI_OPENCANDIDATE
: FIXME("NI_OPENCANDIDATE\n"); break;
684 case NI_CLOSECANDIDATE
: FIXME("NI_CLOSECANDIDATE\n"); break;
685 case NI_SELECTCANDIDATESTR
: FIXME("NI_SELECTCANDIDATESTR\n"); break;
686 case NI_CHANGECANDIDATELIST
: FIXME("NI_CHANGECANDIDATELIST\n"); break;
687 case NI_SETCANDIDATE_PAGESTART
: FIXME("NI_SETCANDIDATE_PAGESTART\n"); break;
688 case NI_SETCANDIDATE_PAGESIZE
: FIXME("NI_SETCANDIDATE_PAGESIZE\n"); break;
689 case NI_CONTEXTUPDATED
:
692 case IMC_SETCOMPOSITIONWINDOW
: FIXME("IMC_SETCOMPOSITIONWINDOW\n"); break;
693 case IMC_SETCONVERSIONMODE
: FIXME("IMC_SETCONVERSIONMODE\n"); break;
694 case IMC_SETSENTENCEMODE
: FIXME("IMC_SETSENTENCEMODE\n"); break;
695 case IMC_SETCANDIDATEPOS
: FIXME("IMC_SETCANDIDATEPOS\n"); break;
696 case IMC_SETCOMPOSITIONFONT
:
698 LPIMEPRIVATE myPrivate
;
699 TRACE("IMC_SETCOMPOSITIONFONT\n");
701 myPrivate
= ImmLockIMCC(lpIMC
->hPrivate
);
702 if (myPrivate
->textfont
)
704 DeleteObject(myPrivate
->textfont
);
705 myPrivate
->textfont
= NULL
;
707 myPrivate
->textfont
= CreateFontIndirectW(&lpIMC
->lfFont
.W
);
708 ImmUnlockIMCC(lpIMC
->hPrivate
);
711 case IMC_SETOPENSTATUS
:
712 TRACE("IMC_SETOPENSTATUS\n");
715 X11DRV_SetPreeditState(lpIMC
->hWnd
, lpIMC
->fOpen
);
718 LPIMEPRIVATE myPrivate
;
720 myPrivate
= ImmLockIMCC(lpIMC
->hPrivate
);
721 if (myPrivate
->bInComposition
)
723 X11DRV_ForceXIMReset(lpIMC
->hWnd
);
724 GenerateIMEMessage(hIMC
, WM_IME_ENDCOMPOSITION
, 0, 0);
725 myPrivate
->bInComposition
= FALSE
;
727 ImmUnlockIMCC(lpIMC
->hPrivate
);
731 default: FIXME("Unknown\n"); break;
734 case NI_COMPOSITIONSTR
:
742 LPCOMPOSITIONSTRING cs
= NULL
;
744 LPIMEPRIVATE myPrivate
;
746 TRACE("CPS_COMPLETE\n");
748 /* clear existing result */
749 newCompStr
= updateResultStr(lpIMC
->hCompStr
, NULL
, 0);
751 ImmDestroyIMCC(lpIMC
->hCompStr
);
752 lpIMC
->hCompStr
= newCompStr
;
756 cdata
= ImmLockIMCC(lpIMC
->hCompStr
);
757 cs
= (LPCOMPOSITIONSTRING
)cdata
;
758 cplen
= cs
->dwCompStrLen
;
759 cpstr
= (LPWSTR
)&(cdata
[cs
->dwCompStrOffset
]);
760 ImmUnlockIMCC(lpIMC
->hCompStr
);
764 WCHAR param
= cpstr
[0];
766 newCompStr
= updateResultStr(lpIMC
->hCompStr
, cpstr
, cplen
);
767 ImmDestroyIMCC(lpIMC
->hCompStr
);
768 lpIMC
->hCompStr
= newCompStr
;
769 newCompStr
= updateCompStr(lpIMC
->hCompStr
, NULL
, 0);
770 ImmDestroyIMCC(lpIMC
->hCompStr
);
771 lpIMC
->hCompStr
= newCompStr
;
773 GenerateIMEMessage(hIMC
, WM_IME_COMPOSITION
, 0,
776 GenerateIMEMessage(hIMC
, WM_IME_COMPOSITION
, param
,
777 GCS_RESULTSTR
|GCS_RESULTCLAUSE
);
780 GenerateIMEMessage(hIMC
,WM_IME_ENDCOMPOSITION
, 0, 0);
782 myPrivate
= ImmLockIMCC(lpIMC
->hPrivate
);
783 myPrivate
->bInComposition
= FALSE
;
784 ImmUnlockIMCC(lpIMC
->hPrivate
);
789 case CPS_CONVERT
: FIXME("CPS_CONVERT\n"); break;
790 case CPS_REVERT
: FIXME("CPS_REVERT\n"); break;
793 LPIMEPRIVATE myPrivate
;
795 TRACE("CPS_CANCEL\n");
797 X11DRV_ForceXIMReset(lpIMC
->hWnd
);
800 ImmDestroyIMCC(lpIMC
->hCompStr
);
801 lpIMC
->hCompStr
= ImeCreateBlankCompStr();
803 myPrivate
= ImmLockIMCC(lpIMC
->hPrivate
);
804 if (myPrivate
->bInComposition
)
806 GenerateIMEMessage(hIMC
, WM_IME_ENDCOMPOSITION
, 0, 0);
807 myPrivate
->bInComposition
= FALSE
;
809 ImmUnlockIMCC(lpIMC
->hPrivate
);
813 default: FIXME("Unknown\n"); break;
816 default: FIXME("Unknown Message\n"); break;
823 BOOL WINAPI
ImeRegisterWord(LPCWSTR lpszReading
, DWORD dwStyle
,
824 LPCWSTR lpszRegister
)
826 FIXME("(%s, %d, %s): stub\n", debugstr_w(lpszReading
), dwStyle
,
827 debugstr_w(lpszRegister
));
828 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
832 BOOL WINAPI
ImeUnregisterWord(LPCWSTR lpszReading
, DWORD dwStyle
,
833 LPCWSTR lpszUnregister
)
835 FIXME("(%s, %d, %s): stub\n", debugstr_w(lpszReading
), dwStyle
,
836 debugstr_w(lpszUnregister
));
837 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
841 UINT WINAPI
ImeGetRegisterWordStyle(UINT nItem
, LPSTYLEBUFW lpStyleBuf
)
843 FIXME("(%d, %p): stub\n", nItem
, lpStyleBuf
);
844 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
848 UINT WINAPI
ImeEnumRegisterWord(REGISTERWORDENUMPROCW lpfnEnumProc
,
849 LPCWSTR lpszReading
, DWORD dwStyle
,
850 LPCWSTR lpszRegister
, LPVOID lpData
)
852 FIXME("(%p, %s, %d, %s, %p): stub\n", lpfnEnumProc
,
853 debugstr_w(lpszReading
), dwStyle
, debugstr_w(lpszRegister
),
855 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
859 BOOL WINAPI
ImeSetCompositionString(HIMC hIMC
, DWORD dwIndex
, LPCVOID lpComp
,
860 DWORD dwCompLen
, LPCVOID lpRead
,
863 LPINPUTCONTEXT lpIMC
;
866 LPIMEPRIVATE myPrivate
;
868 TRACE("(%p, %d, %p, %d, %p, %d):\n",
869 hIMC
, dwIndex
, lpComp
, dwCompLen
, lpRead
, dwReadLen
);
872 if (hIMC
!= FROM_X11
)
873 FIXME("PROBLEM: This only sets the wine level string\n");
877 * this sets the composition string in the imm32.dll level
878 * of the composition buffer. we cannot manipulate the xim level
879 * buffer, which means that once the xim level buffer changes again
880 * any call to this function from the application will be lost
883 if (lpRead
&& dwReadLen
)
884 FIXME("Reading string unimplemented\n");
886 lpIMC
= LockRealIMC(hIMC
);
891 myPrivate
= ImmLockIMCC(lpIMC
->hPrivate
);
893 if (dwIndex
== SCS_SETSTR
)
897 if (!myPrivate
->bInComposition
)
899 GenerateIMEMessage(hIMC
, WM_IME_STARTCOMPOSITION
, 0, 0);
900 myPrivate
->bInComposition
= TRUE
;
905 if (dwCompLen
&& lpComp
)
907 newCompStr
= updateCompStr(lpIMC
->hCompStr
, (LPCWSTR
)lpComp
, dwCompLen
/ sizeof(WCHAR
));
908 ImmDestroyIMCC(lpIMC
->hCompStr
);
909 lpIMC
->hCompStr
= newCompStr
;
911 wParam
= ((const WCHAR
*)lpComp
)[0];
912 flags
|= GCS_COMPCLAUSE
| GCS_COMPATTR
| GCS_DELTASTART
;
916 newCompStr
= updateCompStr(lpIMC
->hCompStr
, NULL
, 0);
917 ImmDestroyIMCC(lpIMC
->hCompStr
);
918 lpIMC
->hCompStr
= newCompStr
;
922 GenerateIMEMessage(hIMC
, WM_IME_COMPOSITION
, wParam
, flags
);
923 ImmUnlockIMCC(lpIMC
->hPrivate
);
929 DWORD WINAPI
ImeGetImeMenuItems(HIMC hIMC
, DWORD dwFlags
, DWORD dwType
,
930 LPIMEMENUITEMINFOW lpImeParentMenu
, LPIMEMENUITEMINFOW lpImeMenu
,
933 FIXME("(%p, %x %x %p %p %x): stub\n", hIMC
, dwFlags
, dwType
,
934 lpImeParentMenu
, lpImeMenu
, dwSize
);
935 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
939 /* Interfaces to XIM and other parts of winex11drv */
941 void IME_SetOpenStatus(BOOL fOpen
)
945 imc
= RealIMC(FROM_X11
);
946 ImmSetOpenStatus(imc
, fOpen
);
949 void IME_SetCompositionStatus(BOOL fOpen
)
952 LPINPUTCONTEXT lpIMC
;
953 LPIMEPRIVATE myPrivate
;
955 imc
= RealIMC(FROM_X11
);
956 lpIMC
= ImmLockIMC(imc
);
960 myPrivate
= ImmLockIMCC(lpIMC
->hPrivate
);
962 if (fOpen
&& !myPrivate
->bInComposition
)
964 GenerateIMEMessage(imc
, WM_IME_STARTCOMPOSITION
, 0, 0);
966 else if (!fOpen
&& myPrivate
->bInComposition
)
968 ShowWindow(myPrivate
->hwndDefault
, SW_HIDE
);
969 ImmDestroyIMCC(lpIMC
->hCompStr
);
970 lpIMC
->hCompStr
= ImeCreateBlankCompStr();
971 GenerateIMEMessage(imc
, WM_IME_ENDCOMPOSITION
, 0, 0);
973 myPrivate
->bInComposition
= fOpen
;
975 ImmUnlockIMCC(lpIMC
->hPrivate
);
979 INT
IME_GetCursorPos(void)
981 LPINPUTCONTEXT lpIMC
;
983 LPCOMPOSITIONSTRING compstr
;
988 lpIMC
= LockRealIMC(FROM_X11
);
991 compstr
= ImmLockIMCC(lpIMC
->hCompStr
);
992 rc
= compstr
->dwCursorPos
;
993 ImmUnlockIMCC(lpIMC
->hCompStr
);
995 UnlockRealIMC(FROM_X11
);
999 void IME_SetCursorPos(DWORD pos
)
1001 LPINPUTCONTEXT lpIMC
;
1002 LPCOMPOSITIONSTRING compstr
;
1007 lpIMC
= LockRealIMC(FROM_X11
);
1011 compstr
= ImmLockIMCC(lpIMC
->hCompStr
);
1014 UnlockRealIMC(FROM_X11
);
1018 compstr
->dwCursorPos
= pos
;
1019 ImmUnlockIMCC(lpIMC
->hCompStr
);
1020 UnlockRealIMC(FROM_X11
);
1021 GenerateIMEMessage(FROM_X11
, WM_IME_COMPOSITION
, pos
, GCS_CURSORPOS
);
1025 void IME_UpdateAssociation(HWND focus
)
1027 ImmGetContext(focus
);
1029 if (!focus
|| !hSelectedFrom
)
1032 ImmAssociateContext(focus
,RealIMC(FROM_X11
));
1036 BOOL
IME_SetCompositionString(DWORD dwIndex
, LPCVOID lpComp
, DWORD dwCompLen
,
1037 LPCVOID lpRead
, DWORD dwReadLen
)
1039 return ImeSetCompositionString(FROM_X11
, dwIndex
, lpComp
, dwCompLen
,
1043 void IME_SetResultString(LPWSTR lpResult
, DWORD dwResultLen
)
1046 LPINPUTCONTEXT lpIMC
;
1048 LPIMEPRIVATE myPrivate
;
1050 imc
= RealIMC(FROM_X11
);
1051 lpIMC
= ImmLockIMC(imc
);
1055 newCompStr
= updateResultStr(lpIMC
->hCompStr
, lpResult
, dwResultLen
);
1056 ImmDestroyIMCC(lpIMC
->hCompStr
);
1057 lpIMC
->hCompStr
= newCompStr
;
1059 myPrivate
= ImmLockIMCC(lpIMC
->hPrivate
);
1060 if (!myPrivate
->bInComposition
)
1061 GenerateIMEMessage(imc
, WM_IME_STARTCOMPOSITION
, 0, 0);
1062 GenerateIMEMessage(imc
, WM_IME_COMPOSITION
, 0, GCS_RESULTSTR
);
1063 if (!myPrivate
->bInComposition
)
1064 GenerateIMEMessage(imc
, WM_IME_ENDCOMPOSITION
, 0, 0);
1065 ImmUnlockIMCC(lpIMC
->hPrivate
);
1071 * Internal functions to help with IME window management
1073 static void PaintDefaultIMEWnd(HIMC hIMC
, HWND hwnd
)
1078 LPCOMPOSITIONSTRING compstr
;
1079 LPBYTE compdata
= NULL
;
1081 MONITORINFO mon_info
;
1083 LPINPUTCONTEXT lpIMC
;
1085 lpIMC
= LockRealIMC(hIMC
);
1089 hdc
= BeginPaint(hwnd
,&ps
);
1091 GetClientRect(hwnd
,&rect
);
1092 FillRect(hdc
, &rect
, (HBRUSH
)(COLOR_WINDOW
+ 1));
1094 compdata
= ImmLockIMCC(lpIMC
->hCompStr
);
1095 compstr
= (LPCOMPOSITIONSTRING
)compdata
;
1097 if (compstr
->dwCompStrLen
&& compstr
->dwCompStrOffset
)
1101 HFONT oldfont
= NULL
;
1103 LPIMEPRIVATE myPrivate
;
1105 CompString
= (LPWSTR
)(compdata
+ compstr
->dwCompStrOffset
);
1106 myPrivate
= ImmLockIMCC(lpIMC
->hPrivate
);
1108 if (myPrivate
->textfont
)
1109 oldfont
= SelectObject(hdc
,myPrivate
->textfont
);
1111 ImmUnlockIMCC(lpIMC
->hPrivate
);
1113 GetTextExtentPoint32W(hdc
, CompString
, compstr
->dwCompStrLen
, &size
);
1119 * How this works based on tests on windows:
1120 * CFS_POINT: then we start our window at the point and grow it as large
1121 * as it needs to be for the string.
1122 * CFS_RECT: we still use the ptCurrentPos as a starting point and our
1123 * window is only as large as we need for the string, but we do not
1124 * grow such that our window exceeds the given rect. Wrapping if
1125 * needed and possible. If our ptCurrentPos is outside of our rect
1126 * then no window is displayed.
1127 * CFS_FORCE_POSITION: appears to behave just like CFS_POINT
1128 * maybe because the default MSIME does not do any IME adjusting.
1130 if (lpIMC
->cfCompForm
.dwStyle
!= CFS_DEFAULT
)
1132 POINT cpt
= lpIMC
->cfCompForm
.ptCurrentPos
;
1133 ClientToScreen(lpIMC
->hWnd
,&cpt
);
1136 rect
.right
= rect
.left
+ pt
.x
;
1137 rect
.bottom
= rect
.top
+ pt
.y
;
1138 monitor
= MonitorFromPoint(cpt
, MONITOR_DEFAULTTOPRIMARY
);
1140 else /* CFS_DEFAULT */
1142 /* Windows places the default IME window in the bottom left */
1143 HWND target
= lpIMC
->hWnd
;
1144 if (!target
) target
= GetFocus();
1146 GetWindowRect(target
,&rect
);
1147 rect
.top
= rect
.bottom
;
1148 rect
.right
= rect
.left
+ pt
.x
+ 20;
1149 rect
.bottom
= rect
.top
+ pt
.y
+ 20;
1151 monitor
= MonitorFromWindow(target
, MONITOR_DEFAULTTOPRIMARY
);
1154 if (lpIMC
->cfCompForm
.dwStyle
== CFS_RECT
)
1157 client
=lpIMC
->cfCompForm
.rcArea
;
1158 MapWindowPoints( lpIMC
->hWnd
, 0, (POINT
*)&client
, 2 );
1159 IntersectRect(&rect
,&rect
,&client
);
1160 /* TODO: Wrap the input if needed */
1163 if (lpIMC
->cfCompForm
.dwStyle
== CFS_DEFAULT
)
1165 /* make sure we are on the desktop */
1166 mon_info
.cbSize
= sizeof(mon_info
);
1167 GetMonitorInfoW(monitor
, &mon_info
);
1169 if (rect
.bottom
> mon_info
.rcWork
.bottom
)
1171 int shift
= rect
.bottom
- mon_info
.rcWork
.bottom
;
1173 rect
.bottom
-= shift
;
1177 rect
.right
-= rect
.left
;
1180 if (rect
.right
> mon_info
.rcWork
.right
)
1182 int shift
= rect
.right
- mon_info
.rcWork
.right
;
1184 rect
.right
-= shift
;
1188 SetWindowPos(hwnd
, HWND_TOPMOST
, rect
.left
, rect
.top
, rect
.right
- rect
.left
, rect
.bottom
- rect
.top
, SWP_NOACTIVATE
);
1190 TextOutW(hdc
, offX
,offY
, CompString
, compstr
->dwCompStrLen
);
1193 SelectObject(hdc
,oldfont
);
1196 ImmUnlockIMCC(lpIMC
->hCompStr
);
1199 UnlockRealIMC(hIMC
);
1202 static void UpdateDefaultIMEWindow(HIMC hIMC
, HWND hwnd
)
1204 LPCOMPOSITIONSTRING compstr
;
1205 LPINPUTCONTEXT lpIMC
;
1207 lpIMC
= LockRealIMC(hIMC
);
1211 if (lpIMC
->hCompStr
)
1212 compstr
= ImmLockIMCC(lpIMC
->hCompStr
);
1216 if (compstr
== NULL
|| compstr
->dwCompStrLen
== 0)
1217 ShowWindow(hwnd
,SW_HIDE
);
1220 ShowWindow(hwnd
,SW_SHOWNOACTIVATE
);
1221 RedrawWindow(hwnd
, NULL
, NULL
, RDW_ERASENOW
| RDW_INVALIDATE
);
1224 if (compstr
!= NULL
)
1225 ImmUnlockIMCC(lpIMC
->hCompStr
);
1227 lpIMC
->hWnd
= GetFocus();
1228 UnlockRealIMC(hIMC
);
1231 static void DefaultIMEComposition(HIMC hIMC
, HWND hwnd
, LPARAM lParam
)
1233 TRACE("IME message WM_IME_COMPOSITION 0x%lx\n", lParam
);
1234 if (lParam
& GCS_RESULTSTR
)
1236 LPCOMPOSITIONSTRING compstr
;
1240 LPINPUTCONTEXT lpIMC
;
1242 lpIMC
= LockRealIMC(hIMC
);
1246 TRACE("Posting result as IME_CHAR\n");
1247 compdata
= ImmLockIMCC(lpIMC
->hCompStr
);
1248 compstr
= (LPCOMPOSITIONSTRING
)compdata
;
1249 ResultStr
= (LPWSTR
)(compdata
+ compstr
->dwResultStrOffset
);
1250 GenerateIMECHARMessages(hIMC
, ResultStr
, compstr
->dwResultStrLen
);
1251 ImmUnlockIMCC(lpIMC
->hCompStr
);
1253 /* clear the buffer */
1254 newCompStr
= updateResultStr(lpIMC
->hCompStr
, NULL
, 0);
1255 ImmDestroyIMCC(lpIMC
->hCompStr
);
1256 lpIMC
->hCompStr
= newCompStr
;
1257 UnlockRealIMC(hIMC
);
1260 UpdateDefaultIMEWindow(hIMC
, hwnd
);
1263 static void DefaultIMEStartComposition(HIMC hIMC
, HWND hwnd
)
1265 TRACE("IME message WM_IME_STARTCOMPOSITION\n");
1266 UpdateDefaultIMEWindow(hIMC
, hwnd
);
1269 static LRESULT
ImeHandleNotify(HIMC hIMC
, HWND hwnd
, UINT msg
, WPARAM wParam
,
1274 case IMN_OPENSTATUSWINDOW
:
1275 FIXME("WM_IME_NOTIFY:IMN_OPENSTATUSWINDOW\n");
1277 case IMN_CLOSESTATUSWINDOW
:
1278 FIXME("WM_IME_NOTIFY:IMN_CLOSESTATUSWINDOW\n");
1280 case IMN_OPENCANDIDATE
:
1281 FIXME("WM_IME_NOTIFY:IMN_OPENCANDIDATE\n");
1283 case IMN_CHANGECANDIDATE
:
1284 FIXME("WM_IME_NOTIFY:IMN_CHANGECANDIDATE\n");
1286 case IMN_CLOSECANDIDATE
:
1287 FIXME("WM_IME_NOTIFY:IMN_CLOSECANDIDATE\n");
1289 case IMN_SETCONVERSIONMODE
:
1290 FIXME("WM_IME_NOTIFY:IMN_SETCONVERSIONMODE\n");
1292 case IMN_SETSENTENCEMODE
:
1293 FIXME("WM_IME_NOTIFY:IMN_SETSENTENCEMODE\n");
1295 case IMN_SETOPENSTATUS
:
1296 TRACE("WM_IME_NOTIFY:IMN_SETOPENSTATUS\n");
1298 case IMN_SETCANDIDATEPOS
:
1299 FIXME("WM_IME_NOTIFY:IMN_SETCANDIDATEPOS\n");
1301 case IMN_SETCOMPOSITIONFONT
:
1302 FIXME("WM_IME_NOTIFY:IMN_SETCOMPOSITIONFONT\n");
1304 case IMN_SETCOMPOSITIONWINDOW
:
1305 FIXME("WM_IME_NOTIFY:IMN_SETCOMPOSITIONWINDOW\n");
1308 FIXME("WM_IME_NOTIFY:IMN_GUIDELINE\n");
1310 case IMN_SETSTATUSWINDOWPOS
:
1311 FIXME("WM_IME_NOTIFY:IMN_SETSTATUSWINDOWPOS\n");
1314 FIXME("WM_IME_NOTIFY:<Unknown 0x%lx>\n",wParam
);
1320 static LRESULT WINAPI
IME_WindowProc(HWND hwnd
, UINT msg
, WPARAM wParam
,
1326 TRACE("Incoming Message 0x%x (0x%08lx, 0x%08lx)\n", msg
, wParam
, lParam
);
1329 * Each UI window contains the current Input Context.
1330 * This Input Context can be obtained by calling GetWindowLong
1331 * with IMMGWL_IMC when the UI window receives a WM_IME_xxx message.
1332 * The UI window can refer to this Input Context and handles the
1336 hIMC
= (HIMC
)GetWindowLongPtrW(hwnd
,IMMGWL_IMC
);
1338 hIMC
= RealIMC(FROM_X11
);
1340 /* if we have no hIMC there are many messages we cannot process */
1344 case WM_IME_STARTCOMPOSITION
:
1345 case WM_IME_ENDCOMPOSITION
:
1346 case WM_IME_COMPOSITION
:
1348 case WM_IME_CONTROL
:
1349 case WM_IME_COMPOSITIONFULL
:
1362 LPIMEPRIVATE myPrivate
;
1363 LPINPUTCONTEXT lpIMC
;
1365 SetWindowTextA(hwnd
,"Wine Ime Active");
1367 lpIMC
= LockRealIMC(hIMC
);
1370 myPrivate
= ImmLockIMCC(lpIMC
->hPrivate
);
1371 myPrivate
->hwndDefault
= hwnd
;
1372 ImmUnlockIMCC(lpIMC
->hPrivate
);
1374 UnlockRealIMC(hIMC
);
1379 PaintDefaultIMEWnd(hIMC
, hwnd
);
1387 SetFocus((HWND
)wParam
);
1389 FIXME("Received focus, should never have focus\n");
1391 case WM_IME_COMPOSITION
:
1392 DefaultIMEComposition(hIMC
, hwnd
, lParam
);
1394 case WM_IME_STARTCOMPOSITION
:
1395 DefaultIMEStartComposition(hIMC
, hwnd
);
1397 case WM_IME_ENDCOMPOSITION
:
1398 TRACE("IME message %s, 0x%lx, 0x%lx\n",
1399 "WM_IME_ENDCOMPOSITION", wParam
, lParam
);
1400 ShowWindow(hwnd
,SW_HIDE
);
1403 TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_IME_SELECT", wParam
, lParam
);
1405 case WM_IME_CONTROL
:
1406 TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_IME_CONTROL", wParam
, lParam
);
1410 rc
= ImeHandleNotify(hIMC
,hwnd
,msg
,wParam
,lParam
);
1413 TRACE("Non-standard message 0x%x\n",msg
);
1415 /* check the MSIME messages */
1416 if (msg
== WM_MSIME_SERVICE
)
1418 TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_SERVICE", wParam
, lParam
);
1421 else if (msg
== WM_MSIME_RECONVERTOPTIONS
)
1423 TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_RECONVERTOPTIONS", wParam
, lParam
);
1425 else if (msg
== WM_MSIME_MOUSE
)
1427 TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_MOUSE", wParam
, lParam
);
1429 else if (msg
== WM_MSIME_RECONVERTREQUEST
)
1431 TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_RECONVERTREQUEST", wParam
, lParam
);
1433 else if (msg
== WM_MSIME_RECONVERT
)
1435 TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_RECONVERT", wParam
, lParam
);
1437 else if (msg
== WM_MSIME_QUERYPOSITION
)
1439 TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_QUERYPOSITION", wParam
, lParam
);
1441 else if (msg
== WM_MSIME_DOCUMENTFEED
)
1443 TRACE("IME message %s, 0x%lx, 0x%lx\n","WM_MSIME_DOCUMENTFEED", wParam
, lParam
);
1445 /* DefWndProc if not an IME message */
1446 if (!rc
&& !((msg
>= WM_IME_STARTCOMPOSITION
&& msg
<= WM_IME_KEYLAST
) ||
1447 (msg
>= WM_IME_SETCONTEXT
&& msg
<= WM_IME_KEYUP
)))
1448 rc
= DefWindowProcW(hwnd
,msg
,wParam
,lParam
);