diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-02-16 16:56:47 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-03-05 19:31:19 +0000 |
commit | 8912c2bd9db92e0a92086bf3b45202964604dbc1 (patch) | |
tree | 684213b1fe2e65d65712d8d982e98637aea1aa43 | |
parent | d2ee858194448e7fc8a5a240464aefcb178961db (diff) |
macOS: Base window collection behavior on the correct window flags
When QCocoaWindow::setWindowFlags is called, the window()'s flags have
not been updated, so re-computing the collection behavior based on those
would not be correct.
Change-Id: I5512da75104483eac7100880c164a9d08fd82984
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 3848bb12e5..f356ced804 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -558,14 +558,8 @@ void QCocoaWindow::setWindowFlags(Qt::WindowFlags flags) m_inSetStyleMask = true; m_view.window.styleMask = windowStyleMask(flags); m_inSetStyleMask = false; - m_view.window.level = this->windowLevel(flags); - - m_view.window.hasShadow = !(flags & Qt::NoDropShadowWindowHint); - - if (!(flags & Qt::FramelessWindowHint)) - setWindowTitle(window()->title()); - Qt::WindowType type = window()->type(); + Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask)); if ((type & Qt::Popup) != Qt::Popup && (type & Qt::Dialog) != Qt::Dialog) { NSWindowCollectionBehavior behavior = m_view.window.collectionBehavior; if (flags & Qt::WindowFullscreenButtonHint) { @@ -577,6 +571,16 @@ void QCocoaWindow::setWindowFlags(Qt::WindowFlags flags) } m_view.window.collectionBehavior = behavior; } + + // Set styleMask and collectionBehavior before applying window level, as + // the window level change will trigger verification of the two properties. + m_view.window.level = this->windowLevel(flags); + + m_view.window.hasShadow = !(flags & Qt::NoDropShadowWindowHint); + + if (!(flags & Qt::FramelessWindowHint)) + setWindowTitle(window()->title()); + setWindowZoomButton(flags); // Make window ignore mouse events if WindowTransparentForInput is set. |