diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2013-03-19 11:41:41 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-21 07:41:41 +0100 |
commit | 750899660a302558cca5f507373773163d90d195 (patch) | |
tree | 19062e287ab1dc84ccc1073a142eb38afbfc5993 /src | |
parent | f1e681bed21e131864fe1e1c91679f7a56b06823 (diff) |
window should not be resizable while its transient popup is open
If a popup is transient for another window, the other window should
not be resizable while the popup is open. (Resizing didn't close the
popup, either.) The popup is emulated with an NSPanel rather than
being a native popup, so we don't get this behavior for free.
Task-number: QTBUG-30266
Change-Id: I49d04a095b428d169fe36ae1768c889578c3c054
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 9466b68bec..a346dc9d4d 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -261,6 +261,9 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect) void QCocoaWindow::setVisible(bool visible) { QCocoaAutoReleasePool pool; + QCocoaWindow *parentCocoaWindow = 0; + if (window()->transientParent()) + parentCocoaWindow = static_cast<QCocoaWindow *>(window()->transientParent()->handle()); #ifdef QT_COCOA_ENABLE_WINDOW_DEBUG qDebug() << "QCocoaWindow::setVisible" << window() << visible; #endif @@ -268,10 +271,7 @@ void QCocoaWindow::setVisible(bool visible) // We need to recreate if the modality has changed as the style mask will need updating if (m_windowModality != window()->modality()) recreateWindow(parent()); - QCocoaWindow *parentCocoaWindow = 0; - if (window()->transientParent()) { - parentCocoaWindow = static_cast<QCocoaWindow *>(window()->transientParent()->handle()); - + if (parentCocoaWindow) { // The parent window might have moved while this window was hidden, // update the window geometry if there is a parent. setGeometry(window()->geometry()); @@ -281,6 +281,10 @@ void QCocoaWindow::setVisible(bool visible) if (window()->type() == Qt::Popup) { // qDebug() << "transientParent and popup" << window()->type() << Qt::Popup << (window()->type() & Qt::Popup); parentCocoaWindow->m_activePopupWindow = window(); + // QTBUG-30266: a window should not be resizable while a transient popup is open + // Since this isn't a native popup, the window manager doesn't close the popup when you click outside + [parentCocoaWindow->m_nsWindow setStyleMask: + (parentCocoaWindow->windowStyleMask(parentCocoaWindow->m_windowFlags) & ~NSResizableWindowMask)]; } } @@ -342,6 +346,9 @@ void QCocoaWindow::setVisible(bool visible) } else { [m_contentView setHidden:YES]; } + if (parentCocoaWindow && window()->type() == Qt::Popup) + // QTBUG-30266: a window should not be resizable while a transient popup is open + [parentCocoaWindow->m_nsWindow setStyleMask:parentCocoaWindow->windowStyleMask(parentCocoaWindow->m_windowFlags)]; } } |