emacs-devel
[Top][All Lists]
Advanced

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

?????? [PATCH] Add IME status change support on windows natively


From: Albert
Subject: ?????? [PATCH] Add IME status change support on windows natively
Date: Mon, 13 Apr 2020 22:52:30 +0800

Hi, Eli,

commit 61da72 is different from commit c6ecda. We don't need to get IME status before setting IME status. If IME is the same status when setting it in the same status, IME will ignore the status changing. Emacs can be a litttle bit faster if get_ime_open_status_fn() is not invoked.

And IME somtimes doesn't fully comply with Microsoft IME api, RIME for example. RIME which is a open source chinese ime doesn't return the status as Microsoft pinyin IME. When Microsoft pinyin IME is activated, if Microsoft pinyin is in english mode, w32-get-ime-open-status() return nil. If Microsoft pinyin is in chinese mode, w32-get-ime-open-status() return t.  We can press <SHIFT> to switch between two modes by default.

When RIME is activated, w32-get-ime-open-status() return t whenever IME is in english mode or chinese mode. 

I modified code in w32-get-ime-open-status(). w32-get-ime-open-status() can get the status from IME.

$ git diff master -- w32fns.c
diff --git a/src/w32fns.c b/src/w32fns.c
index dddf3dc571..124b795119 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -3459,10 +3459,8 @@ w32_msg_pump (deferred_msg * msg_buf)
                if (!context)
                  break;

-               BOOL new_status = (msg.wParam != 0);
-               BOOL ime_status = get_ime_open_status_fn (context);
-               if (new_status != ime_status)
-                 set_ime_open_status_fn (context, new_status);
+               BOOL wParam = (BOOL) msg.wParam;
+               set_ime_open_status_fn (context, wParam);
                release_ime_context_fn (focus_window, context);
                break;
              }
@@ -10261,7 +10259,7 @@ DEFUN ("w32-get-ime-open-status",
     {
       HWND current_window = FRAME_W32_WINDOW (sf);
       HIMC context = get_ime_context_fn (current_window);
-      if (!context)
+      if (context)
        {
          BOOL retval = get_ime_open_status_fn (context);
          release_ime_context_fn (current_window, context);


------------------ ???????? ------------------
??????: "Eli Zaretskii"<address@hidden>;
????????: 2020??4??13??(??????) ????9:44
??????: "Albert"<address@hidden>;
????: "emacs-devel"<address@hidden>;
????: Re: [PATCH] Add IME status change support on windows natively

> From: "Albert" <address@hidden>
> Date: Mon, 13 Apr 2020 21:15:16 +0800
> Cc: emacs-devel <address@hidden>
>
> Thanks for your help. I will follow the emacs coding standard in the future.

Thanks, please try the latest master branch, I've modified the code a
little.  In particular, w32-get-ime-open-status now returns nil or t,
not 0 or 1.

reply via email to

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