aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVyacheslav Moklev <slavam2605@bk.ru>2019-03-04 15:32:13 +0300
committerVyacheslav Moklev <slavam2605@bk.ru>2019-03-06 12:00:56 +0300
commite0c79eb54f676ceb9ec0e250b1cf74cce986fb8a (patch)
tree09934c0496f2d4847a2e5ec1194174532804e6c7
parent6ad54fb1ea932523e20aae8ebc01b808da78093c (diff)
downloadJetBrainsRuntime-e0c79eb54f676ceb9ec0e250b1cf74cce986fb8a.tar.gz
JBR-1257 CommonItemDialog modal window has no owner
Fix modality for Common Item Dialog
-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));