Closed Bug 466487 Opened 16 years ago Closed 14 years ago

ATOK (Japanese IME) fails to eat key message

Categories

(Core :: Widget: Win32, defect)

x86
Windows Vista
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a5

People

(Reporter: masayuki, Assigned: masayuki)

Details

(Keywords: inputmethod, intl)

Attachments

(2 files, 6 obsolete files)

Attached patch Patch v1.0 (obsolete) — Splinter Review
I'm using ATOK which is Japanese IME of a third party. When I turn on the IME and type keys for Japanese text inputting, sometimes (in most cases, the system resource is busy) the first key inputs ASCII character directly (not via IME). I checked message queue of the both cases (normal case, and failure case). On normal case, the first key doesn't input text directly, so, there are not WM_KEYDOWN/WM_KEYUP/WM_CHAR messages for the key. Instead of them, there are only IME related messages.

Maybe, ATOK eats the key messages when IME is opened. However, we eat the messages earlier than ATOK. We give priority to key messages, IME messages and mouse messages. So, this hack is bad for some middle wares, probably.

I think we should not use such hack. However, I suggest the following patch which doesn't give priority to the key/IME messages when the keyboard local is Japanese. This is safer, and this doesn't regress the response performance for other locales.
Attachment #349761 - Flags: review?(emaijala)
Attached patch Patch v2.0 (obsolete) — Splinter Review
Kimura-san hate my previous patch. Because that may hide some bugs/regressions from non-Japanese locale users. I agree to it. I hope the cause of this bug will be removed completely.
Attachment #349761 - Attachment is obsolete: true
Attachment #350116 - Flags: superreview?(roc)
Attachment #350116 - Flags: review?(emaijala)
Attachment #349761 - Flags: review?(emaijala)
Attached patch Patch v2.0 (obsolete) — Splinter Review
oops, sorry, I posted another bug's patch.
Attachment #350116 - Attachment is obsolete: true
Attachment #350117 - Flags: superreview?(roc)
Attachment #350117 - Flags: review?(emaijala)
Attachment #350116 - Flags: superreview?(roc)
Attachment #350116 - Flags: review?(emaijala)
Attachment #350117 - Flags: superreview?(roc)
Attachment #350117 - Flags: review?(emaijala)
Attachment #350117 - Flags: review-
Comment on attachment 350117 [details] [diff] [review]
Patch v2.0

Ewww, this is scary ad we've been here before. Unless this patch has been extensively tested and something else had changed in the mean time, this change would cause trouble. As far as I remember, this change would kill responsiveness at least in case of a some Flash applets but there was probably more.
Ere:

What problems were there? The result of my patch should be same as standard win32 applications. The cause of the problem is really here??
At least bug 378830.
Attached patch Patch v3.0 (obsolete) — Splinter Review
This is an experimental patch. This patch tries to prevent the optimization only when IME is opening.
Attachment #350117 - Attachment is obsolete: true
Attached patch Patch v3.1 (obsolete) — Splinter Review
fix a nit.
Attachment #447720 - Attachment is obsolete: true
Attached patch Patch v4.0 (obsolete) — Splinter Review
better approach.
Attachment #447721 - Attachment is obsolete: true
Comment on attachment 447743 [details] [diff] [review]
Patch v4.0

Ah, this is wrong. The wParam isn't VK_PROCESSKEY here.
Attachment #447743 - Flags: review-
Attached patch Patch v5.0Splinter Review
This works fine for me.

When I press 全角/半角 key (with ATOK, and it's closed) and press 'A', in most cases, the messages are received as following order:

WM_KEYUP VK_OEM_AUTO
WM_KEYDOWN VK_PROCESSKEY
WM_IME_NOTIFY IMN_PRIVATE
WM_IME_NOTIFY IMN_PRIVATE
WM_IME_NOTIFY IMN_PRIVATE
WM_IME_NOTIFY IMN_SETOPENSTATUS
WM_KEYDOWN VK_PROCESSKEY...
WM_IME_STARTCOMPOSITION

However, if system is busy, sometimes the messages are received as following order:

WM_KEYUP VK_OEM_AUTO
WM_KEYDOWN VK_PROCESSKEY
WM_IME_NOTIFY IMN_PRIVATE
WM_KEYDOWN VK_A
WM_CHAR 'a'
WM_KEYUP VK_A
WM_IME_NOTIFY IMN_PRIVATE
WM_IME_NOTIFY IMN_PRIVATE
WM_IME_NOTIFY IMN_SETOPENSTATUS

So, when ATOK works slowly, the 'A' key messages are sent during ATOK being opening. Therefore, if we can prevent the key/IME message order optimization during IME being opening, we can fix this bug.

We can know the start timing by the first WM_KEYDOWN with VK_PROCESSKEY. If the message comes when IME has been closed (i.e., ImmGetOpenStatus() returns FALSE), the key message should be a trigger of opening IME because the message should be received only when IME has been opened.

And we can know the end timing by the WM_IME_NOTIFY with IMN_SETOPENSTATUS. And also, if we receives unexpected IME related messages and non-IME processed key message, we can see the WM_KEYDOWN with VK_PROCESSKEY was sent for unknown purpose. So, when these messages are received, we should restart the message order optimization.
Attachment #447743 - Attachment is obsolete: true
Attachment #447981 - Flags: review?(jmathies)
Comment on attachment 447981 [details] [diff] [review]
Patch v5.0

I can't manually test this myself, but I assume you've worked it through.
Attachment #447981 - Flags: review?(jmathies) → review+
Thank you, Jim. This patch is a little tricky. I believe this approach is safest. Even if another IME sends WM_KEYDOWN with WM_PROCESSKEY when it's not opened, this patch stops only the optimizing, doesn't change the behavior. And this patch is sensitive for the unexpected IME messages. So, with such IMEs, this patch restarts the optimization immediately.

The worst story is, if another application (non-IME) sends WM_KEYDOWN with WM_PROCESSKEY to our window, we stop optimization fortunately on non-IME users. However, there are not such needs.

I'll land this tomorrow.
Attached patch Patch v5.0.1Splinter Review
fix the switch-case indentation for the new coding style.
Attachment #448670 - Flags: review+
http://hg.mozilla.org/mozilla-central/rev/5e3e8590b6e5
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: