diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 0920bc7b4b..90c5a050d0 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -111,6 +111,7 @@ public: void windowDidMove(); void windowDidResize(); void windowWillClose(); + bool windowIsPopupType() const; void setCurrentContext(QCocoaGLContext *context); QCocoaGLContext *currentContext() const; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index a76830f0b8..b4c4e31753 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -303,6 +303,15 @@ void QCocoaWindow::windowWillClose() QWindowSystemInterface::handleSynchronousCloseEvent(window()); } +bool QCocoaWindow::windowIsPopupType() const +{ + Qt::WindowType type = window()->windowType(); + if (type == Qt::Tool) + return false; // Qt::Tool has the Popup bit set but isn't, at least on Mac. + + return ((type & Qt::Popup) == Qt::Popup); +} + void QCocoaWindow::setCurrentContext(QCocoaGLContext *context) { m_glContext = context; @@ -348,7 +357,7 @@ NSWindow * QCocoaWindow::createNSWindow() // Use NSPanel for popup-type windows. (Popup, Tool, ToolTip, SplashScreen) if ((type & Qt::Popup) == Qt::Popup) { - if (type == Qt::Popup || type == Qt::ToolTip || type == Qt::SplashScreen) { + if (windowIsPopupType()) { styleMask = NSBorderlessWindowMask; } else { styleMask = (NSUtilityWindowMask | NSResizableWindowMask | NSClosableWindowMask | diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index ed67fd50fc..52f40ea01c 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -146,24 +146,24 @@ static QTouchDevice *touchDevice = 0; - (void)windowDidBecomeKey { -// QWindowSystemInterface::handleWindowActivated(m_window); + if (!m_platformWindow->windowIsPopupType()) + QWindowSystemInterface::handleWindowActivated(m_window); } - (void)windowDidResignKey { -// QWindowSystemInterface::handleWindowActivated(0); + if (!m_platformWindow->windowIsPopupType()) + QWindowSystemInterface::handleWindowActivated(0); } - (void)windowDidBecomeMain { // qDebug() << "window did become main" << m_window; - QWindowSystemInterface::handleWindowActivated(m_window); } - (void)windowDidResignMain { // qDebug() << "window did resign main" << m_window; - QWindowSystemInterface::handleWindowActivated(0); }