United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7071248 IME composition window does not disappear when file dialog is closed : Japanese WinXP
JDK-7071248 : IME composition window does not disappear when file dialog is closed : Japanese WinXP

Details
Type:
Bug
Submit Date:
2011-07-26
Status:
Closed
Updated Date:
2011-10-17
Project Name:
JDK
Resolved Date:
2011-10-17
Component:
client-libs
OS:
windows
Sub-Component:
java.awt
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:
Relates:
Relates:

Sub Tasks

Description
SYNOPSIS
--------
IME composition window does not disappear when file dialog is closed

OPERATING SYSTEM
----------------
Windows XP SP3 (Japanese)

FULL JDK VERSION
----------------
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode)

PROBLEM DESCRIPTION
-------------------
Cannot select item on JPopupMenu by mouse on JOptionPane. This situation happens after showing JPopupMenu on base window.

This seems to be is a regression caused by the fix for CR 7026055.

REPRODUCTION INSTRUCTIONS
-------------------------
This test instruction requires Windows XP SP3 (Japanese)

1. Compile and run FileDialogTest1
2. Press "Open FileDialog" button
3. Move input focus to "File name", type "abc"
4. Turn on IME, type "ai", then press Space key twice
5. IME cadidate window is displayed
6. Press Cancel button on FileDialog
7. FileDialog is closed, but IME composition and candidate window are
   still displayed (IME related window should not be displayed at this
   time <== PROBLEM)
8. Press "Open FileDialog" button again
9. FileDialog is displayed with IME composition and candidate, but
   "abc" is missing (IME composition string should be canceled like
   "abc" <== PROBLEM)


TESTCASE
--------
import java.awt.*;
import java.awt.event.*;

public class FileDialogTest1 extends Frame implements ActionListener {
    FileDialogTest1(){
        Button btn = new Button('Open FileDialog');
        add(btn);
        btn.addActionListener(this);
        addWindowListener(new WindowAdapter(){
                              public void windowClosing(WindowEvent e){
                                  System.exit(0);
                              }
                          });
    }

    public void actionPerformed(ActionEvent e){
        FileDialog fd = new FileDialog(this);
        fd.setVisible(true);
    }
    public static void main(String[] args){
        FileDialogTest1 ft = new FileDialogTest1();
        ft.setSize(new Dimension(300,50));
        ft.setVisible(true);
    }
}

SUGGESTED FIX from LICENSEE
---------------------------
See Suggested Fix.
In attached TESTCASE,

The line:
Button btn = new Button('Open FileDialog');
should be changed to:
Button btn = new Button("Open FileDialog");
Otherwise, it won't compile.

                                    

Comments
SUGGESTED FIX

From Licensee:
--
We have backed out the fix for 7026055 and applied a new fix that addresses 7026055, this new CR, and CR 7061057 (another regression caused by the original 7026055 fix. Here is that new fix:

--- jdk/src/windows/native/sun/windows/awt_Component.cpp.orig        2011-07-26 20:53:04.000000000 +0900
+++ jdk/src/windows/native/sun/windows/awt_Component.cpp        2011-07-26 20:54:31.000000000 +0900
@@ -548,6 +548,8 @@ AwtComponent::CreateHWnd(JNIEnv *env, LP
 
     m_hwnd = hwnd;
 
+    ::ImmAssociateContext(m_hwnd, NULL);
+
     SetDrawState((jint)JAWT_LOCK_SURFACE_CHANGED |
         (jint)JAWT_LOCK_BOUNDS_CHANGED |
         (jint)JAWT_LOCK_CLIP_CHANGED);

--- jdk/src/windows/native/sun/windows/awt_FileDialog.cpp.orig        2011-07-26 20:53:33.000000000 +0900
+++ jdk/src/windows/native/sun/windows/awt_FileDialog.cpp        2011-07-26 20:56:01.000000000 +0900
@@ -153,6 +153,11 @@ FileDialogHookProc(HWND hdlg, UINT uiMsg
             break;
         }
         case WM_DESTROY: {
+            HIMC hIMC = ImmGetContext(hdlg);
+            if (hIMC != NULL) {
+                ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_CANCEL, 0);
+                ImmReleaseContext(hdlg, hIMC);
+            }
             WNDPROC lpfnWndProc = (WNDPROC)(::GetProp(parent, NativeDialogWndProcProp));
             ComCtl32Util::GetInstance().UnsubclassHWND(parent,
                                                        FileDialogWndProc,
--
                                     
2011-07-26
EVALUATION

Suggested fix works well with the changes made only in awt_FileDialog.cpp
                                     
2011-08-25



Hardware and Software, Engineered to Work Together