diff options
author | Vyacheslav Moklev <slavam2605@bk.ru> | 2019-03-06 13:16:18 +0300 |
---|---|---|
committer | Vyacheslav Moklev <slavam2605@bk.ru> | 2019-03-06 13:18:57 +0300 |
commit | 44dea71e3388ef92ed28e7edaaadac1b9a2336c8 (patch) | |
tree | 508f387aba743f899a2a3050fbb43d1fbce370b9 /src/windows | |
parent | 1afb250037a2349fd4caf8f2b09f3eace447d3ba (diff) | |
download | jdk8u_jdk-44dea71e3388ef92ed28e7edaaadac1b9a2336c8.tar.gz |
JBR-1257 CommonItemDialog modal window has no owner
Ported from JDK11
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)); |