From 8912c2bd9db92e0a92086bf3b45202964604dbc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 16 Feb 2018 16:56:47 +0100 Subject: [PATCH] macOS: Base window collection behavior on the correct window flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/plugins/platforms/cocoa/qcocoawindow.mm | 18 +++++++++++------- 1 file 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(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.