Subject: bug#11732: 24.1; Microsoft IME Japanese input problem

From: Fujii Hironori <[email-masked]>
Date: Thu, 19 Feb 2015 11:03:58 +0900

Thank your for reviewing the patch, Eli.

On Thu, Feb 19, 2015 at 12:17 AM, Eli Zaretskii <[email-masked]> wrote:
>> Date: Tue, 17 Feb 2015 19:26:41 +0900
>> From: Fujii Hironori <[email-masked]>
>>
>> WM_IME_STARTCOMPOSITION should be passed to DefWindowProc.
>
> Thanks, but can you explain the details?
>
> I can understand why we should defer to DefWindowProc if we refrain
> from processing this message, for some reason.  But this last part of
> your patch:
>
>> @@ -3318,17 +3318,17 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
>>
>>         /* Punt if the window was deleted behind our back.  */
>>         if (!BUFFERP (w->contents))
>> -         break;
>> +         goto dflt;
>>
>>         context = get_ime_context_fn (hwnd);
>>
>>         if (!context)
>> -         break;
>> +         goto dflt;
>>
>>         set_ime_composition_window_fn (context, &form);
>>         release_ime_context_fn (hwnd, context);
>>       }
>> -      break;
>> +      goto dflt;
>>
>>      case WM_IME_ENDCOMPOSITION:
>>        ignore_ime_char = 0;
>
> Passes the message to DefWindowProc even if we succeeded to handle
> WM_IME_STARTCOMPOSITION by calling ImmSetCompositionWindow.  Why is
> that needed?

If Emacs processes WM_IME_STARTCOMPOSITION itself,
default composition window won't be shown.

Please see the document for the detail.

https://msdn.microsoft.com/en-us/library/windows/desktop/dd374143%28v=vs.85%29.aspx

| Remarks
|
| This message is a notification to an IME window to open its
| composition window. An application should process this message if it
| displays composition characters itself.
|
| If an application has created an IME window, it should pass this
| message to that window. The DefWindowProc function processes the
| message by passing it to the default IME window.