Hi, Eli,

I modified the code processing WM_EMACS_IME_STATUS,  no need to get status of IME, just change IME status by the argument. If the user want to get status of IME to control IME status, he can write some lisp to do it.

and I modifed w32-get-ime-open-status(), get hwnd from FRAME_W32_WINDOW (SELECTED_FRAME ()).


------------------ 原始邮件 ------------------
发件人: "Eli Zaretskii"<eliz@gnu.org>;
发送时间: 2020年4月13日(星期一) 下午5:33
收件人: "Albert"<georgealbert@qq.com>;
抄送: "emacs-devel"<emacs-devel@gnu.org>;
主题: Re: [PATCH] Add IME status change support on windows natively

> From: "Albert" <georgealbert@qq.com>
> Cc: "emacs-devel" <emacs-devel@gnu.org>
> Date: Mon, 13 Apr 2020 17:22:35 +0800
>
> I modifed the code following your instruction.  I added some more comments on functions. Test is done, IME
> status changes as expected.
>
> I used GetFocus() in w32_msg_pump() now.

Thanks.

> But I can't invoke GetFocus() in w32-get-ime-open-status(), because w32-get-ime-open-status() is invoked
> in lisp thread. I just use w32_system_caret_hwnd instead, if get_ime_context_fn(w32-get-ime-open-status)
> returns NULL, w32-get-ime-open-status() return nil.

Do we actually need w32-get-ime-open-status?  Maybe we should simply
delete that function?  When will it be useful?

If we do need to use it, does it work to use this to find a suitable
window handle:

  HWND current_window = FRAME_W32_WINDOW (SELECTED_FRAME ());

> Attachement is the modifed patch.

Thanks.