JDK-7071248 : IME composition window does not disappear when file dialog is closed : Japanese WinXP
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows
  • CPU: generic
  • Submitted: 2011-07-26
  • Updated: 2014-10-14
  • Resolved: 2011-10-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u2Fixed 8 b06Fixed
Related Reports
Relates :  
Relates :  
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
EVALUATION Suggested fix works well with the changes made only in awt_FileDialog.cpp
25-08-2011

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, --
26-07-2011