United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6743433 IM candidate window is not shown until window is deactivated and reactivated again
6743433 : IM candidate window is not shown until window is deactivated and reactivated again

Details
Type:
Bug
Submit Date:
2008-09-01
Status:
Closed
Updated Date:
2011-05-18
Project Name:
JDK
Resolved Date:
2011-05-18
Component:
client-libs
OS:
windows_xp
Sub-Component:
java.awt
CPU:
x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
6u10,7
Fixed Versions:
7

Related Reports
Backport:
Backport:
Duplicate:
Relates:
Relates:

Sub Tasks

Description
Steps to reproduce:

1. Install Chenese (Taiwan) / Chinese (Traditional) Quick input method support
2. Run any Swing application with text area, for example, Notepad demo
3. Switch into Chinese and start typing into the text area
4. If you don't see IM candidate window while typing, the bug is reproduced
5. Deactivate window (click on the desktop)
6. Acivate window (click on the text area). Candidate window is shown

The problem is reproduced starting from 7.0-b02, so it may be related to 6359035. There is another change request about focus issues revealed by 6359035: 6542975 - but the fix for it doesn't solves this new problem with candidate window.

                                    

Comments
SUGGESTED FIX

@@ -3929,7 +3936,7 @@ void AwtComponent::OpenCandidateWindow(i
             SetCandidateWindow(iCandType, x-rc.left, y-rc.top);
     }
     if (m_bitsCandType != 0) {
-        DefWindowProc(WM_IME_NOTIFY, IMN_OPENCANDIDATE, m_bitsCandType);
+        ::DefWindowProc(GetHWnd(), WM_IME_NOTIFY, IMN_OPENCANDIDATE, m_bitsCandType);
     }
 }
                                     
2008-09-03
EVALUATION

To open the candidate window AWT goes through the following steps:

1. the system posts the WM_IME_NOTIFY (IMN_OPENCANDIDATE) message to the AWT top level
2. AWT's subclassing procedure consumes the message (AwtComponent::WmImeNotify)
3. calculates the position of the candidate window (AwtComponent::InquireCandidatePosition)
4. tries to pass the WM_IME_NOTIFY message to the next handler by the ::DefSubclassProc call (AwtComponent::OpenCandidateWindow)
5. finally, the last handler in the subclass chain should call the original window procedure for the AWT top level.

Most likely, ::DefSubclassProc fails to call ::DefWindowProc and the step 5 is missed. This happens because AWT calls ::DefSubclassProc in the context of the custom message (WM_AWT_OPENCANDIDATEWINDOW) instead of the WM_IME_NOTIFY message.

The IME's handlers of the WM_IME_NOTIFY message are first hanlders in the subclass chain. So AWT doesn't need to call ::DefSubclassProc and we may directly call the original window procedure by the ::DefWindowProc call
                                     
2008-09-03
EVALUATION

Interesting that the problem is not reproducible on Windows Vista. At the same time it is reproducible on Windows XP.
                                     
2008-09-01



Hardware and Software, Engineered to Work Together