unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#44641: [PATCH] Ignore modifiers when processing WM_IME_CHAR messages
@ 2020-11-14 16:58 tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2020-11-14 17:24 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-11-14 16:58 UTC (permalink / raw)
  To: 44641

[-- Attachment #1: Type: text/plain, Size: 996 bytes --]

Current Emacs for Windows recognizes modifier keys even when inputting
with IME. Some IMEs use modifier keys to input characters, so this
causes inconvenient for such IME users.

Example: Microsoft IME (Japanese input method)
If I type Ctrl+m to input こんにちは, I get C-こ C-ん C-に C-ち C-は
in Emacs.

This patch ignores modifier keys when processing WM_IME_CHAR
messages. This patch is not intended to introduce Windows specific
behavior; X build already ignores modifier keys when processing inputs
via XIM.

src/xterm.c:
...
              nbytes = XmbLookupString (FRAME_XIC (f),
                                        &xkey, (char *) copy_bufptr,
                                        copy_bufsiz, &keysym,
                                        &status_return);
...
              else if (status_return == XLookupChars)
                {
                  keysym = NoSymbol;
                  modifiers = 0;
                }
...

--
tsuucat


[-- Attachment #2: 0001-Ignore-modifiers-when-processing-WM_IME_CHAR-message.patch --]
[-- Type: application/octet-stream, Size: 923 bytes --]

From 431f3d821cfef8fad30d39e0b4e7a31be9d02872 Mon Sep 17 00:00:00 2001
From: Masahiro Nakamura <tsuucat@icloud.com>
Date: Sat, 14 Nov 2020 17:55:16 +0900
Subject: [PATCH] Ignore modifiers when processing WM_IME_CHAR messages

* src/w32fns.c (w32_wnd_proc): Ignore modifiers when processing
WM_IME_CHAR messages.
---
 src/w32fns.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/w32fns.c b/src/w32fns.c
index 7bb96891d0..802ee031e8 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -4448,7 +4448,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 	  int size, i;
 	  W32Msg wmsg;
 	  HIMC context = get_ime_context_fn (hwnd);
-	  wmsg.dwModifiers = w32_get_key_modifiers (wParam, lParam);
+	  wmsg.dwModifiers = 0;
 	  /* Get buffer size.  */
 	  size = get_composition_string_fn (context, GCS_RESULTSTR, NULL, 0);
 	  buffer = alloca (size);
-- 
2.27.0


[-- Attachment #3: Type: text/plain, Size: 1 bytes --]

 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#44641: [PATCH] Ignore modifiers when processing WM_IME_CHAR messages
  2020-11-14 16:58 bug#44641: [PATCH] Ignore modifiers when processing WM_IME_CHAR messages tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2020-11-14 17:24 ` Eli Zaretskii
  2020-11-16  3:07   ` tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2020-11-14 17:24 UTC (permalink / raw)
  To: tsuucat; +Cc: 44641

> Date: Sun, 15 Nov 2020 01:58:34 +0900
> From: tsuucat via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Current Emacs for Windows recognizes modifier keys even when inputting
> with IME. Some IMEs use modifier keys to input characters, so this
> causes inconvenient for such IME users.

You say "some IMEs", so I wonder whether ignoring modifier keys for
WM_IME_CHAR is always the right thing.  Do you know for sure? is that
documented somewhere?  (I'm not an expert on MS-Windows IMEs.)

Thanks.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#44641: [PATCH] Ignore modifiers when processing WM_IME_CHAR messages
  2020-11-14 17:24 ` Eli Zaretskii
@ 2020-11-16  3:07   ` tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2020-11-21  8:18     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-11-16  3:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 44641


>> Current Emacs for Windows recognizes modifier keys even when inputting
>> with IME. Some IMEs use modifier keys to input characters, so this
>> causes inconvenient for such IME users.
> 
> You say "some IMEs", so I wonder whether ignoring modifier keys for
> WM_IME_CHAR is always the right thing.  Do you know for sure? is that
> documented somewhere?  (I'm not an expert on MS-Windows IMEs.)

I believe this change will not affect other IME users. Other IME users
simply don't use modifier keys to input multibyte characters. For
example, Chinese IME users type Space to select and input the
candidate, but typing Ctrl+Space doesn't mean users select and input
the candidate (= WM_IME_CHAR messages will not happen). 

Some Japanese IME users type Ctrl+m or Ctrl+n to select and input the
candidate and they want to send Ctrl to IME not to Emacs.

I don't have just the right documentation but this change just follows
the way X build Emacs does. 

--
tsuucat





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#44641: [PATCH] Ignore modifiers when processing WM_IME_CHAR messages
  2020-11-16  3:07   ` tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2020-11-21  8:18     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2020-11-21  8:18 UTC (permalink / raw)
  To: tsuucat; +Cc: 44641-done

> From: tsuucat <tsuucat@icloud.com>
> Date: Mon, 16 Nov 2020 12:07:26 +0900
> Cc: 44641@debbugs.gnu.org
> 
> 
> >> Current Emacs for Windows recognizes modifier keys even when inputting
> >> with IME. Some IMEs use modifier keys to input characters, so this
> >> causes inconvenient for such IME users.
> > 
> > You say "some IMEs", so I wonder whether ignoring modifier keys for
> > WM_IME_CHAR is always the right thing.  Do you know for sure? is that
> > documented somewhere?  (I'm not an expert on MS-Windows IMEs.)
> 
> I believe this change will not affect other IME users. Other IME users
> simply don't use modifier keys to input multibyte characters. For
> example, Chinese IME users type Space to select and input the
> candidate, but typing Ctrl+Space doesn't mean users select and input
> the candidate (= WM_IME_CHAR messages will not happen). 
> 
> Some Japanese IME users type Ctrl+m or Ctrl+n to select and input the
> candidate and they want to send Ctrl to IME not to Emacs.
> 
> I don't have just the right documentation but this change just follows
> the way X build Emacs does. 

OK, thanks.  I installed your changes on the emacs-27 branch, but I
also added a variable, w32-ignore-modifiers-on-IME-input, that allows
to get back the old behavior, in case the new behavior adversely
effects some use cases.

With that, I'm closing this bug report.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-21  8:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-14 16:58 bug#44641: [PATCH] Ignore modifiers when processing WM_IME_CHAR messages tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-11-14 17:24 ` Eli Zaretskii
2020-11-16  3:07   ` tsuucat via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-11-21  8:18     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).