Closed Bug 314130 Opened 19 years ago Closed 18 years ago

input numbers twice when using Unispim IME at chinese input mode

Categories

(Core :: Widget: Win32, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: robintj, Assigned: masayuki)

Details

(5 keywords)

Attachments

(6 files, 3 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8) Gecko/20051025 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8) Gecko/20051025 Firefox/1.5

When using Chinese Input Method: Unispim IME (also known as ZiGuang PinIn and 紫光拼音输入法) at FireFox 1.5 Beta or RC1, and in chinese input mode, I input ONE 0...9 number, then I got the number twice at the FireFox input area. 

But in FireFox 1.0.x, this bug dose not exist. 

BTW: this bug also exists at ThunderBird 1.5 beta and RC1.

Reproducible: Always

Steps to Reproduce:
1.Run the Unispim IME, and set it running at chinese input mode
2.Let type focus into any input area, such as Location bar
3.type "1"
4.in the Location bar, we get twice "1"

Actual Results:  
we get twice "1"

Expected Results:  
we should get only one "1"

this bug also exists at ThunderBird 1.5 beta and RC1.

So I guess the bug is in the Gecko Engine?
Web page of unispim is: 

http://www.thunisoft.com/unispim/
Bot only numbers but also interpunctions. Interpunctions are also duplicated while activing Unispim IME.
This problem is very troublesome to many Firefox lovers in mainland China, because unispim Chinese input method is much widely used in China.

After Firefox 1.5 was released, many chinese users  are complaining about it on local forum. This problem is preventing some unskilled people from switching their browsers to Firefox. So I strongly suggest that mozilla.org pay more attention on this bug and finally fix it.
-> Event Handling? Not sure where to put this one, but it seems like a bug with sufficient reporters to confirm.
Status: UNCONFIRMED → NEW
Component: General → Event Handling
Ever confirmed: true
Product: Firefox → Core
Version: unspecified → 1.8 Branch
Assignee: nobody → events
QA Contact: general → ian
here is more details on this subject:
http://forums.mozillazine.org/viewtopic.php?t=341183
I fixed the issue today. The cause of this issue is that unispim chinese input method generates a meanless WM_KEYDOWN/WM_KEYUP message pair for keys when it was activated. Most of these keys are handled by input method except digit characters.  In recent versions of Firefox/Seamonkey, they create a NS_KEY_PRESS event for any asciiKey. 

The fix is very simple. See diff output below.

bash-2.05b$ diff widget/src/windows/nsWindow.cpp widget/src/windows/nsWindow.cpp.orig
3586c3586
<   if (asciiKey && !(gotMsg && msg.message == WM_KEYUP))
---
>   if (asciiKey)

Hope somebody having commit provileges can merge it into mainstream. 
(In reply to comment #8)
Hi, Holly
  Two comment for you:
1.
> bash-2.05b$ diff widget/src/windows/nsWindow.cpp
> widget/src/windows/nsWindow.cpp.orig
It should be better if you use: diff -u widget/src/windows/nsWindow.cpp.orig widget/src/windows/nsWindow.cpp
2. Did you try other IMEs after apply your change?   
(In reply to comment #9)

1) OK. 

bash-2.05b$ diff -u widget/src/windows/nsWindow.cpp widget/src/windows/nsWindow.cpp.orig
--- widget/src/windows/nsWindow.cpp     2006-02-10 11:22:20.000000000 +0800
+++ widget/src/windows/nsWindow.cpp.orig        2006-02-10 11:24:30.000000000 +0800
@@ -3578,7 +3578,7 @@
       }
   }

-  if (asciiKey && !(gotMsg && msg.message == WM_KEYUP))
+  if (asciiKey)
     DispatchKeyEvent(NS_KEY_PRESS, asciiKey, 0, aKeyData, extraFlags);
   else
     DispatchKeyEvent(NS_KEY_PRESS, 0, virtualKeyCode, aKeyData, extraFlags);


2) I haven't test other IMEs as I don't have them in my windows box. I think it is better that other users can test it. In theory the patch won't conflict with other IMEs since it just prevents event handler from creating a NS_KEY_PRESS event incorrectly from an abnormal WM_KEYDOWN/WM_KEYUP pair without WM_CHAR for asciiKey. 

3) I compiled two binaries for FireFox 1.5.0.1 and SeaMonkey 1.0. Any user has interests can download them and have a try.

For SeaMonkey 1.0:  http://www.jsfsoft.com/temp/gkwidget.zip
    
    Unzip it and put the uncompressed file gkwidget.dll into your _SystemVolume_\Program Files\Common Files\mozilla.org\GRE\1.8.0.1_xxxx\components to overwrite old file with same name, where the _SystemVolume_ is disk that you installed your windows system.

For FireFox 1.5.0.1:  http://www.jsfsoft.com/temp/firefox.zip
    
    Unzip it and put the uncompressed file firefox.exe into your FireFox installation directory to overwrite your original firefox.exe. 

I have test the binary firefox file that compiled by Holly.Lee, it was fine. The problem really desapperaed. 

You've done a great job, Holly, Thank you.

I also made a test on microsoft pinyin imput method, it worked well, just as Lee estimated.
But a new problem appears.

The extension Tab preview now stops to work. Appearently it's related to the new   modification made by Lee. I feel it's very strange, but can not figure out why.
(In reply to comment #12)
> But a new problem appears.
> 
> The extension Tab preview now stops to work. Appearently it's related to the
> new   modification made by Lee. I feel it's very strange, but can not figure
> out why.
> 

What is "extension Tab preview"? If so, I may put more codes into patch to distingulish message sending windows so that this patch can be a special work around for unispim IME. It is easy, too.
(In reply to comment #13)
> (In reply to comment #12)
> > But a new problem appears.
> > 
> > The extension Tab preview now stops to work. Appearently it's related to the
> > new   modification made by Lee. I feel it's very strange, but can not figure
> > out why.
> > 
> 
> What is "extension Tab preview"? If so, I may put more codes into patch to
> distingulish message sending windows so that this patch can be a special work
> around for unispim IME. It is easy, too.
> 

Oh I found it. In the page of this extension, it mentioned "Please note that if you build your own Firefox from source, you'll need to have --enable-canvas in your build configuration". I just didn't add this build configuration into my compilation. It is not the issue of patch :-)

I will make a new compilation next week.
You can use about:buildconfig to find the offical release build config. But please be sure to remove --enable-official-branding if you don't have the permit to use the firofx brand.
Updated.

Now firefox.zip was compiled as same config as its official distribution excluding --enable-official-branding. The tab preview extension works fine.

I reinstalled TAB PREVIEW, it works. Wonderful. I also tested TAB CATALOG, which also used canvas, it also works fine. Now I think Lee's modification contains no problem.
Holly:

We need to fix on Trunk in first time, and if the patch doesn't have any regressions, we can fix the bug on 1.8.x branch too. You should create the patch for Trunk and you should attach the patch as attachment.(use |cvs diff -u8p|)
This is patch on trunk for Chinese unispim IME compatibility.
Comment on attachment 217530 [details] [diff] [review]
Patch for Chinese unispim IME compatibility

> +  if (numOfUniChars && !(gotMsg && msg.message == WM_KEYUP))

I think that this patch has a large risk. I think that we should check more conditions if we use this way.

But I have a question. This bug happen in composition? or not so?
# OnKeyDown is not called while compositioning...
Keywords: intl
Version: 1.8 Branch → Trunk
Attached patch test patchSplinter Review
Holly:

Would you test this patch? I think that this fixes the bug and the risk is lower than your patch.

I think that the switch statement assumes that is the Ctrl or Alt key is pressed always, but your case isn't so. We may not need to rise event in this case.
(In reply to comment #20)
> (From update of attachment 217530 [details] [diff] [review] [edit])
> > +  if (numOfUniChars && !(gotMsg && msg.message == WM_KEYUP))
> 
> I think that this patch has a large risk. I think that we should check more
> conditions if we use this way.
> 
The reason that I patched codes this way is that I don't know anything about Japanese IME and don't want to modify codes of their special processing. Therefore I just filtered one special case (a WM_KEYUP followed WM_KEYDOWN).

> But I have a question. This bug happen in composition? or not so?
> # OnKeyDown is not called while compositioning...
> 
You are right. It is not in composition mode. 
Comment on attachment 217692 [details] [diff] [review]
test patch

Kimura-san tested this patch and he confirmed this patch fixes this bug.
We should go this.
Attachment #217692 - Flags: review?(emaijala)
Assignee: events → masayuki
Status: NEW → ASSIGNED
Component: Event Handling → Widget: Win32
Keywords: regression
(In reply to comment #22)
> (In reply to comment #20)
> > (From update of attachment 217530 [details] [diff] [review] [edit] [edit])
> > > +  if (numOfUniChars && !(gotMsg && msg.message == WM_KEYUP))
> > 
> > I think that this patch has a large risk. I think that we should check more
> > conditions if we use this way.
> > 
> The reason that I patched codes this way is that I don't know anything about
> Japanese IME and don't want to modify codes of their special processing.
> Therefore I just filtered one special case (a WM_KEYUP followed WM_KEYDOWN).

There are many input assistant applications on the world, I think that your patch may break the messeages from some applications. (Of course, my patch may have same risk.) Therefore, we should fix some difference from Fx1.0(Gecko1.7), my patch do so.

On Fx1.0(Gecko1.7), we didn't dispatch KeyPress event when Ctrl and Alt keys are not pressed and next message is not WM_(SYS|DEAD)CHAR. I think that we should suppress to dispatch event at this time.
Comment on attachment 217692 [details] [diff] [review]
test patch

I'm a bit hesitant, but let's test it.
Attachment #217692 - Flags: review?(emaijala) → review+
Comment on attachment 217692 [details] [diff] [review]
test patch

Thanks, Ere.

Roc:
Please sr this. See comment 24 for the detail.
Attachment #217692 - Flags: superreview?(roc)
Attachment #217692 - Flags: superreview?(roc) → superreview+
checked-in, thanks.

Holly:

Could you test this fix on Trunk nigtly build?
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Whiteboard: Pending to request approval1.8.1
sorry
1.6a1 has this bug
(In reply to comment #30)
> sorry
> 1.6a1 has this bug
> 

The latest trunk should be 3.0a1 now.
nobody verify this fix on latest trunk, I cannot go to next step.
the bug exists in 3.0a1 
(In reply to comment #33)
> the bug exists in 3.0a1 

What is your build ID? Would you tell me what key was pressed in its time?
Ah, are you using numpad?
(In reply to comment #35)
> Ah, are you using numpad?
> 
yes, when I use numpad and input numbers, the bug exists
when i use keybroad to input number, it works well

O.K. thank you for your test.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attached patch checking numpad key (obsolete) — Splinter Review
Attachment #221790 - Flags: superreview?(roc)
Attachment #221790 - Flags: review?(emaijala)
Status: REOPENED → ASSIGNED
I downloaded the latest trunk from http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/
I think the bug is fixed in this trunk, and the numpad key is well too
Thanks all 
(In reply to comment #39)
> I downloaded the latest trunk from
> http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/
> I think the bug is fixed in this trunk, and the numpad key is well too

The new patch doesn't check in to trunk, yet.
Comment on attachment 221790 [details] [diff] [review]
checking numpad key

The first test is wrong, it should be >=. Also, could you use the constants (VK_NUMPAD0 etc.)?
Attachment #221790 - Flags: review?(emaijala) → review-
> The first test is wrong, it should be >=.

What is this comment? The previous patch has following conditions.

0x60 <= aVirtualKey && aVirtualKey <= 0x6F

aVirtualKey is between 0x60 and 0x6F, of course, it includes both numbers.
Attachment #221790 - Attachment is obsolete: true
Attachment #222719 - Flags: review?(emaijala)
Attachment #221790 - Flags: superreview?(roc)
Comment on attachment 222719 [details] [diff] [review]
checking numpad key rv2.0

Yeah, my bad. Too early in the morning or something, sorry about that.
Attachment #222719 - Flags: review?(emaijala) → review+
Comment on attachment 222719 [details] [diff] [review]
checking numpad key rv2.0

O.K. Thank you, Ere.
Attachment #222719 - Flags: superreview?(roc)
Attachment #222719 - Flags: superreview?(roc) → superreview+
checked-in, thank you.

redkalk:

Could you test this patch on trunk build?
If you will verify it, I'll start to work for 1.8 branch too.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago18 years ago
Resolution: --- → FIXED
Whiteboard: Pending to request approval1.8.1 → Pending to request approval1.8.1 until a tester verify this on Trunk
(In reply to comment #45)
> checked-in, thank you.
> redkalk:
> Could you test this patch on trunk build?
> If you will verify it, I'll start to work for 1.8 branch too.
I didn't find any problem in the lastest trunk.
Attached patch Patch rv1.0 for 1.8 branch (obsolete) — Splinter Review
Ere:

I think that this patch means same logic of trunk. Would you review this?
Attachment #224065 - Flags: review?(emaijala)
Attachment #224065 - Flags: approval-branch-1.8.1?(emaijala)
Whiteboard: Pending to request approval1.8.1 until a tester verify this on Trunk
(In reply to comment #46)
> (In reply to comment #45)
> > checked-in, thank you.
> > redkalk:
> > Could you test this patch on trunk build?
> > If you will verify it, I'll start to work for 1.8 branch too.
> I didn't find any problem in the lastest trunk.
> 

Thank you redkalk. When I'll check in the new patch to 1.8 branch, please test it on nightly build too.

thanks.
-> v. (per comment 46)
Status: RESOLVED → VERIFIED
Comment on attachment 224065 [details] [diff] [review]
Patch rv1.0 for 1.8 branch

Fix the comment to say "...we should not the send KeyPress event.". I can't test this, but it seems ok, so give it go.
Attachment #224065 - Flags: review?(emaijala)
Attachment #224065 - Flags: review+
Attachment #224065 - Flags: approval-branch-1.8.1?(emaijala)
Attachment #224065 - Flags: approval-branch-1.8.1+
Thank you, Ere.

Roc: Would you sr this?
Attachment #224065 - Attachment is obsolete: true
Attachment #224339 - Flags: superreview?(roc)
Attachment #224339 - Flags: review+
Attachment #224339 - Flags: approval-branch-1.8.1+
Attachment #224339 - Flags: superreview?(roc) → superreview+
checked-in to 1.8 branch.

redkalk:

Please test the fix on 1.8 branch on after tomorrow build.
If it's verified on 1.8 branch too and if we don't have any regression report until 1 week, should we land this to 1.8.0 branch too? I think that this bug is very serious regression for Chinese people, right?
Keywords: fixed1.8.1
Whiteboard: Should we land on 1.8.0.x too?
I download the files from here
http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla1.8/
and it works well
thank you
Whiteboard: Should we land on 1.8.0.x too? → pending to request approval 1.8.0.x until 6/13
I think that we should fix this for Chinese people. Because I can look this bug is very serious regression for the people.
Flags: blocking1.8.0.5?
Flags: blocking1.8.0.5? → blocking1.8.0.5+
Comment on attachment 224339 [details] [diff] [review]
Patch rv1.1 for 1.8 branch

I cannot find any regressions by this patch in this week. I think that this bug is very serious for Chinese people. We should go to stable branch too.
Attachment #224339 - Flags: approval1.8.0.5?
Whiteboard: pending to request approval 1.8.0.x until 6/13
Comment on attachment 224339 [details] [diff] [review]
Patch rv1.1 for 1.8 branch

approved for 1.8.0 branch, a=dveditz for drivers
Attachment #224339 - Flags: approval1.8.0.5? → approval1.8.0.5+
checked-in to 1.8.0 branch too.

redkalk:

Would you check this fix on 1.8.0 branch?
http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla1.8.0/
# after 15-Jun build.
Keywords: fixed1.8.0.5
I downloaded the nightly build (Jun 15) from
http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla1.8.0/
I believe this bug is fixed.

Thanks all!
Thank you Patton for your testing.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: