From d25d11e6e2fd08f117825a06f1bdf3928d057fb8 Mon Sep 17 00:00:00 2001 From: Mauro Persano Date: Mon, 23 Jul 2018 12:41:08 -0300 Subject: Windows QPA: fix transientParentHwnd QWindowsWindow::updateTransientParent retrieves the handle of the topmost owner window, not that of the immediate owner window (which corresponds to the handle of transient parent window). Task-number: QTBUG-69620 Change-Id: I1433098e8e93832d97508ee1782f88ccc000ee3a Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowswindow.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 45788fec15..528927b0fb 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1382,16 +1382,6 @@ QPoint QWindowsWindow::mapFromGlobal(const QPoint &pos) const return m_data.hwnd ? QWindowsGeometryHint::mapFromGlobal(m_data.hwnd, pos) : pos; } -static inline HWND transientParentHwnd(HWND hwnd) -{ - if (GetAncestor(hwnd, GA_PARENT) == GetDesktopWindow()) { - const HWND rootOwnerHwnd = GetAncestor(hwnd, GA_ROOTOWNER); - if (rootOwnerHwnd != hwnd) // May return itself for toplevels. - return rootOwnerHwnd; - } - return 0; -} - // Update the transient parent for a toplevel window. The concept does not // really exist on Windows, the relationship is set by passing a parent along with !WS_CHILD // to window creation or by setting the parent using GWL_HWNDPARENT (as opposed to @@ -1406,7 +1396,7 @@ void QWindowsWindow::updateTransientParent() const if (window()->type() == Qt::Popup) return; // QTBUG-34503, // a popup stays on top, no parent, see also WindowCreationData::fromWindow(). // Update transient parent. - const HWND oldTransientParent = transientParentHwnd(m_data.hwnd); + const HWND oldTransientParent = GetWindow(m_data.hwnd, GW_OWNER); HWND newTransientParent = 0; if (const QWindow *tp = window()->transientParent()) if (const QWindowsWindow *tw = QWindowsWindow::windowsWindowOf(tp)) -- cgit v1.2.3