I am pretty sure that these are done via SendMessage when I checked with
Spy++. Additional a number of the applications I am working with hang
when the WM_IME_NOTIFY is sent out of order.
-aric
Byeong-Sik Jeon wrote:
> We have to call PostMessage to send WM_IME_NOTIFY message.
> To send WM_IME_CONTROL, we use SendMessage, but WM_IME_NOTIFY is not...
>
> changelog:
> Use the PostMessageW for WM_IME_NOTIFY message.
> ---
> dlls/imm32/imm.c | 25 ++++++++-----------------
> 1 files changed, 8 insertions(+), 17 deletions(-)
>
>
> ------------------------------------------------------------------------
>
> diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c
> index 02a362e..034d4ea 100644
> --- a/dlls/imm32/imm.c
> +++ b/dlls/imm32/imm.c
> @@ -77,8 +77,8 @@ static UINT WM_MSIME_DOCUMENTFEED;
> */
> static LRESULT WINAPI IME_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
> LPARAM lParam);
> +static LRESULT ImmInternalPostIMEMessage(UINT, WPARAM, LPARAM);
> static void UpdateDataInDefaultIMEWindow(HWND hwnd);
> -static void ImmInternalPostIMEMessage(UINT, WPARAM, LPARAM);
> static void ImmInternalSetOpenStatus(BOOL fOpen);
>
> static VOID IMM_PostResult(InputContextData *data)
> @@ -160,16 +160,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpReserved)
> }
>
> /* for posting messages as the IME */
> -static void ImmInternalPostIMEMessage(UINT msg, WPARAM wParam, LPARAM lParam)
> -{
> - HWND target = GetFocus();
> - if (!target)
> - PostMessageW(root_context->hwnd,msg,wParam,lParam);
> - else
> - PostMessageW(target, msg, wParam, lParam);
> -}
> -
> -static LRESULT ImmInternalSendIMENotify(WPARAM notify, LPARAM lParam)
> +static LRESULT ImmInternalPostIMEMessage(UINT msg, WPARAM wParam, LPARAM lParam)
> {
> HWND target;
>
> @@ -177,7 +168,7 @@ static LRESULT ImmInternalSendIMENotify(WPARAM notify, LPARAM lParam)
> if (!target) target = GetFocus();
>
> if (target)
> - return SendMessageW(target, WM_IME_NOTIFY, notify, lParam);
> + return PostMessageW(target, msg, wParam, lParam);
>
> return 0;
> }
> @@ -214,7 +205,7 @@ static void ImmInternalSetOpenStatus(BOOL fOpen)
> else
> ShowWindow(hwndDefault, SW_SHOWNOACTIVATE);
>
> - ImmInternalSendIMENotify(IMN_SETOPENSTATUS, 0);
> + ImmInternalPostIMEMessage(WM_IME_NOTIFY, IMN_SETOPENSTATUS, 0);
> }
>
>
> @@ -1243,7 +1234,7 @@ BOOL WINAPI ImmSetCompositionFontA(HIMC hIMC, LPLOGFONTA lplf)
> MultiByteToWideChar(CP_ACP, 0, lplf->lfFaceName, -1, data->font.lfFaceName,
> LF_FACESIZE);
>
> - ImmInternalSendIMENotify(IMN_SETCOMPOSITIONFONT, 0);
> + ImmInternalPostIMEMessage(WM_IME_NOTIFY, IMN_SETCOMPOSITIONFONT, 0);
>
> if (data->textfont)
> {
> @@ -1267,7 +1258,7 @@ BOOL WINAPI ImmSetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf)
> return FALSE;
>
> memcpy(&data->font,lplf,sizeof(LOGFONTW));
> - ImmInternalSendIMENotify(IMN_SETCOMPOSITIONFONT, 0);
> + ImmInternalPostIMEMessage(WM_IME_NOTIFY, IMN_SETCOMPOSITIONFONT, 0);
>
> if (data->textfont)
> {
> @@ -1418,7 +1409,7 @@ BOOL WINAPI ImmSetCompositionWindow(
> if (reshow)
> ShowWindow(hwndDefault,SW_SHOWNOACTIVATE);
>
> - ImmInternalSendIMENotify(IMN_SETCOMPOSITIONWINDOW, 0);
> + ImmInternalPostIMEMessage(WM_IME_NOTIFY, IMN_SETCOMPOSITIONWINDOW, 0);
> return TRUE;
> }
>
> @@ -1447,7 +1438,7 @@ BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen)
> if (hIMC == (HIMC)FROM_IME)
> {
> ImmInternalSetOpenStatus(fOpen);
> - ImmInternalSendIMENotify(IMN_SETOPENSTATUS, 0);
> + ImmInternalPostIMEMessage(WM_IME_NOTIFY, IMN_SETOPENSTATUS, 0);
> return TRUE;
> }
>