Windows: handle multiple transient children when closing windows
On Windows, we must update the transient children of a window that's about to be destroyed or its transient children will be destroyed as well. This is already being done in the case of a single transient child, but there are still problems when there are more than one. Change-Id: Ib0de6767bf43dca508ecdb87cbdfedb59e9146e8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
ee6164942d
commit
2e496e9322
@ -1161,23 +1161,19 @@ void QWindowsWindow::fireExpose(const QRegion ®ion, bool force)
|
|||||||
QWindowSystemInterface::handleExposeEvent(window(), region);
|
QWindowSystemInterface::handleExposeEvent(window(), region);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QWindow *findTransientChild(const QWindow *parent)
|
|
||||||
{
|
|
||||||
foreach (QWindow *w, QGuiApplication::topLevelWindows())
|
|
||||||
if (w->transientParent() == parent)
|
|
||||||
return w;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QWindowsWindow::destroyWindow()
|
void QWindowsWindow::destroyWindow()
|
||||||
{
|
{
|
||||||
qCDebug(lcQpaWindows) << __FUNCTION__ << this << window() << m_data.hwnd;
|
qCDebug(lcQpaWindows) << __FUNCTION__ << this << window() << m_data.hwnd;
|
||||||
if (m_data.hwnd) { // Stop event dispatching before Window is destroyed.
|
if (m_data.hwnd) { // Stop event dispatching before Window is destroyed.
|
||||||
setFlag(WithinDestroy);
|
setFlag(WithinDestroy);
|
||||||
// Clear any transient child relationships as Windows will otherwise destroy them (QTBUG-35499, QTBUG-36666)
|
// Clear any transient child relationships as Windows will otherwise destroy them (QTBUG-35499, QTBUG-36666)
|
||||||
if (QWindow *transientChild = findTransientChild(window()))
|
const auto tlw = QGuiApplication::topLevelWindows();
|
||||||
if (QWindowsWindow *tw = QWindowsWindow::windowsWindowOf(transientChild))
|
for (QWindow *w : tlw) {
|
||||||
tw->updateTransientParent();
|
if (w->transientParent() == window()) {
|
||||||
|
if (QWindowsWindow *tw = QWindowsWindow::windowsWindowOf(w))
|
||||||
|
tw->updateTransientParent();
|
||||||
|
}
|
||||||
|
}
|
||||||
QWindowsContext *context = QWindowsContext::instance();
|
QWindowsContext *context = QWindowsContext::instance();
|
||||||
if (context->windowUnderMouse() == window())
|
if (context->windowUnderMouse() == window())
|
||||||
context->clearWindowUnderMouse();
|
context->clearWindowUnderMouse();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user