diff options
Diffstat (limited to 'src/windows')
-rw-r--r-- | src/windows/native/sun/windows/awt_FileDialog.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/windows/native/sun/windows/awt_FileDialog.cpp b/src/windows/native/sun/windows/awt_FileDialog.cpp index 3c797c1ea4..42bf9ec398 100644 --- a/src/windows/native/sun/windows/awt_FileDialog.cpp +++ b/src/windows/native/sun/windows/awt_FileDialog.cpp @@ -617,7 +617,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" "); @@ -657,18 +664,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; @@ -732,7 +728,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)); @@ -745,7 +741,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)); |