emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 回复: 回复: 回复: [PATCH] Add IME status change support on windows nativel


From: Eli Zaretskii
Subject: Re: 回复: 回复: 回复: [PATCH] Add IME status change support on windows natively
Date: Mon, 13 Apr 2020 10:05:30 +0300

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]