summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2016-11-16 10:53:44 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-01-23 15:36:54 +0000
commit79352528a1726b4551ea4d9285dd2394dd0d43da (patch)
treedb7a5746b7dc7353af7c6baec5fd710cdcbdaf63 /src
parent45948967bd2442d27c7526ec6f74b0df3edbe40a (diff)
Windows QPA: Prevent usage of child windows as transient parent
When using foreign window integrations such as MFC/winmigrate, it is possible that a child window is found which can cause issues with modality. Loop up to top level. Task-number: QTSOLBUG-71 Task-number: QTBUG-57159 Change-Id: Ib36e0f8f4f6b1e22ba1240013871facef2c0c1ab Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 6894062d61..b5522c1f90 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1273,6 +1273,12 @@ void QWindowsWindow::updateTransientParent() const
if (const QWindowsWindow *tw = QWindowsWindow::windowsWindowOf(tp))
if (!tw->testFlag(WithinDestroy)) // Prevent destruction by parent window (QTBUG-35499, QTBUG-36666)
newTransientParent = tw->handle();
+
+ // QTSOLBUG-71: When using the MFC/winmigrate solution, it is possible that a child
+ // window is found, which can cause issues with modality. Loop up to top level.
+ while (newTransientParent && (GetWindowLongPtr(newTransientParent, GWL_STYLE) & WS_CHILD) != 0)
+ newTransientParent = GetParent(newTransientParent);
+
if (newTransientParent != oldTransientParent)
SetWindowLongPtr(m_data.hwnd, GWL_HWNDPARENT, LONG_PTR(newTransientParent));
}