Thanks. I'll try it.
------------------ ???????? ------------------
??????: "Eli Zaretskii"<address@hidden>;
????????: 2020??4??13??(??????) ????3:05
??????: "Albert"<address@hidden>;
????: "emacs-devel"<address@hidden>;
????: Re: ?????? ?????? ?????? [PATCH] Add IME status change support on windows natively
Here's what I propose.
Change w32-set-ime-open-status to do this:
DEFUN ("w32-set-ime-open-status",
Fw32_set_ime_open_status, Sw32_set_ime_open_status,
1, 1, 0,
doc: /* Set emacs IME open status on Windows. */)
(Lisp_Object status)
{
unsigned ime_status;
if (NILP (status))
ime_status = 0;
else
ime_status = 1;
PostThreadMessage (dwWindowsThreadId, WM_EMACS_IME_STATUS,
(WPARAM)ime_status, 0);
return Qnil;
}
Then in w32fns.c do this to handle the WM_EMACS_IME_STATUS message:
case WM_EMACS_IME_STATUS:
if (!set_ime_open_status_fn)
break;
else
{
HIMC context = get_ime_context_fn (w32_system_caret_hwnd);
if (!context)
break;
BOOL ime_status = get_ime_open_status_fn (context);
BOOL new_status = (wParam != 0);
if (ime_status != new_status)
set_ime_open_status_fn (context, new_status);
release_ime_context_fn (w32_system_caret_hwnd, context);
}
break;
Then you can get rid of the 2 static variables.
This is entirely untested, so please make sure it works as intended.