aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/java.desktop/windows/native/libawt/windows/awt_FileDialog.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/java.desktop/windows/native/libawt/windows/awt_FileDialog.cpp b/src/java.desktop/windows/native/libawt/windows/awt_FileDialog.cpp
index 64d1c49a31e..c85099e60c8 100644
--- a/src/java.desktop/windows/native/libawt/windows/awt_FileDialog.cpp
+++ b/src/java.desktop/windows/native/libawt/windows/awt_FileDialog.cpp
@@ -627,7 +627,14 @@ AwtFileDialog::Show(void *p)
}
// DASSERT(awtParent);
title = (jstring)(env)->GetObjectField(target, AwtDialog::titleID);
- HWND hwndOwner = awtParent ? awtParent->GetHWnd() : NULL;
+ /*
+ Fix for 6488834.
+ To disable Win32 native parent modality we have to set
+ hwndOwner field to either NULL or some hidden window. For
+ parentless dialogs we use NULL to show them in the taskbar,
+ and for all other dialogs AwtToolkit's HWND is used.
+ */
+ HWND hwndOwner = awtParent ? AwtToolkit::GetInstance().GetHWnd() : NULL;
if (title == NULL || env->GetStringLength(title)==0) {
title = JNU_NewStringPlatform(env, L" ");
@@ -667,18 +674,7 @@ AwtFileDialog::Show(void *p)
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFilter = s_fileFilterString;
ofn.nFilterIndex = 1;
- /*
- Fix for 6488834.
- To disable Win32 native parent modality we have to set
- hwndOwner field to either NULL or some hidden window. For
- parentless dialogs we use NULL to show them in the taskbar,
- and for all other dialogs AwtToolkit's HWND is used.
- */
- if (awtParent != NULL) {
- ofn.hwndOwner = AwtToolkit::GetInstance().GetHWnd();
- } else {
- ofn.hwndOwner = NULL;
- }
+ ofn.hwndOwner = hwndOwner;
ofn.lpstrFile = fileBuffer;
ofn.nMaxFile = bufferLimit;
ofn.lpstrTitle = titleBuffer;
@@ -742,7 +738,7 @@ AwtFileDialog::Show(void *p)
if (useCommonItemDialog && SUCCEEDED(OLE_HR)) {
if (mode == java_awt_FileDialog_LOAD) {
- result = SUCCEEDED(pfd->Show(NULL)) && data.result;
+ result = SUCCEEDED(pfd->Show(hwndOwner)) && data.result;
if (!result) {
OLE_NEXT_TRY
OLE_HRT(pfd->GetResult(&psiResult));
@@ -755,7 +751,7 @@ AwtFileDialog::Show(void *p)
result = SUCCEEDED(OLE_HR);
}
} else {
- result = SUCCEEDED(pfd->Show(NULL));
+ result = SUCCEEDED(pfd->Show(hwndOwner));
if (result) {
OLE_NEXT_TRY
OLE_HRT(pfd->GetResult(&psiResult));