JDK-6494032 : REG:Dialogs minimized to taskbar (through 'Show Desktop') are not restored when ALT+TABing, Win32
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-11-15
  • Updated: 2011-03-07
  • Resolved: 2011-03-07
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 6 JDK 7
6u12Resolved 7 b14Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
I am creating a JDialog from a JOptionPane and setting it as modeless. I am opening 2 such dialogs. Then I am opening an App modal JDialog. App modal dialog blocks all the windows.

Now on winXP, I am clicking on 'Show Desktop' icon. Everything is minimized to taskbar. Now I am pressing ALT+TAB and trying to select the java icons shown, assuming that the java dialogs will be restored back to the screen. But none of the dialogs get restored, until I click the taskbar icon. This is reproducible only on Mustang and not reproducible on Tiger-FCS. Reproducible only on Win32 and not on XToolkit.

To reproduce, run the attached test. Click on JOptionPane button. A dialog will be shown at the center. Now click on the JDialog button. A modal dialog will be opened. Click 'Show Desktop'. Now press ALT+TAB and select the java icon from the list shown. Check if java windows are restored back. If not, the bug is reproduced.

Comments
SUGGESTED FIX *** /tmp/geta29428 2007-04-06 12:30:33.000000000 +0400 --- awt_Dialog.cpp 2007-04-05 15:04:18.000000000 +0400 *************** *** 216,231 **** ::ShowWindow(hWnd, SW_RESTORE); } HWND topMostBlocker = blocker; while (::IsWindow(blocker)) { topMostBlocker = blocker; ! // fix for 6270632 - continued ! if (::IsIconic(topMostBlocker)) { ! ::ShowWindow(topMostBlocker, SW_RESTORE); } blocker = AwtWindow::GetModalBlocker(blocker); } if (topMostBlocker != NULL) { ! if (topMostBlocker != AwtToolkit::GetInstance().GetHWnd()) { ::SetForegroundWindow(topMostBlocker); } return 1; --- 216,238 ---- ::ShowWindow(hWnd, SW_RESTORE); } HWND topMostBlocker = blocker; + HWND toolkitHWnd = AwtToolkit::GetInstance().GetHWnd(); while (::IsWindow(blocker)) { topMostBlocker = blocker; ! // fix for 6494032: restore the blocker if it was minimized ! // together with its parent frame; in such cases the check ! // ::IsIconic() for the blocker is returns false, so we use ! // ::IsWindowVisible() instead ! if (!::IsWindowVisible(topMostBlocker) && ! (topMostBlocker != toolkitHWnd)) ! { ! ::ShowWindow(topMostBlocker, SW_SHOWNA); } blocker = AwtWindow::GetModalBlocker(blocker); } if (topMostBlocker != NULL) { ! if (topMostBlocker != toolkitHWnd) { ! ::BringWindowToTop(topMostBlocker); ::SetForegroundWindow(topMostBlocker); } return 1;
06-04-2007

EVALUATION Even if a dialog is minimized together with its parent frame, we still may restore it with the call to ::ShowWindow(dialog, SW_SHOW). The only problem is how we can distinguish this case. ::IsIconic(dialog) returns false, as the dialog is actually not minimized, only its parent is. However, I have found that ::IsWindowVisible(dialog) returns false, and this can be used as a condition to the ::ShowWindow. An interesting fact is that this approach is even more stable and reliable that the fix for 6270632, i. e. I can safely replace ::IsIconic() with ::IsWindowVisible(). See the suggested fix for details.
06-04-2007

EVALUATION The problem can be reproduced only for the windows with invisible parent (like JOptionPane in the test). If their parents were visible, the windows would be restored with ALT+TAB correctly.
05-04-2007

EVALUATION This bug is tightly related to 6270632. When a blocked window is about to be activated, its blocker (modal dialog) is raised and made an active window instead. In the fix for 6270632 additional action for the modal dialog was added: if the dialog is iconified at the time of window activation, it is restored. This CR shows that restoring a modal dialog is not enough. If the dialog's parent is iconified, then the dialog is iconified also, even if we call ::ShowWindow(dialog, SW_RESTORE). This is what happens in the test. If we change a parent for the dialog in the test from 'this' to 'null', the bug disappears. I think this problem should be fixed in another way than with simple restoring all the dialog's parents. We should either forbid all the blocked windows to be iconified or something else like this.
21-11-2006

EVALUATION When running the test I noticed that only 2 windows from 3 in the Java application were visible in the windows list: the frame and one of the dialogs (option pane). I suspect this happens because the option pane's owner window is invisible.
16-11-2006