Cocoa: Use internal style mask to disable resizing popup parents
Using QCocoaWindow::windowStyleMask() resets some private flags Cocoa sets when showing sheets. Task-number: QTBUG-33126 Change-Id: I34f0713f98e81e7010b0b7620ee24ea30f04dcff Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
parent
d25eead30f
commit
6cdd9928ab
@ -200,6 +200,7 @@ public: // for QNSView
|
|||||||
bool m_frameStrutEventsEnabled;
|
bool m_frameStrutEventsEnabled;
|
||||||
bool m_isExposed;
|
bool m_isExposed;
|
||||||
int m_registerTouchCount;
|
int m_registerTouchCount;
|
||||||
|
bool m_resizableTransientParent;
|
||||||
|
|
||||||
static const int NoAlertRequest;
|
static const int NoAlertRequest;
|
||||||
NSInteger m_alertRequest;
|
NSInteger m_alertRequest;
|
||||||
|
@ -211,6 +211,7 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
|
|||||||
, m_frameStrutEventsEnabled(false)
|
, m_frameStrutEventsEnabled(false)
|
||||||
, m_isExposed(false)
|
, m_isExposed(false)
|
||||||
, m_registerTouchCount(0)
|
, m_registerTouchCount(0)
|
||||||
|
, m_resizableTransientParent(false)
|
||||||
, m_alertRequest(NoAlertRequest)
|
, m_alertRequest(NoAlertRequest)
|
||||||
{
|
{
|
||||||
#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
|
#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
|
||||||
@ -317,12 +318,14 @@ void QCocoaWindow::setVisible(bool visible)
|
|||||||
parentCocoaWindow->m_activePopupWindow = window();
|
parentCocoaWindow->m_activePopupWindow = window();
|
||||||
// QTBUG-30266: a window should not be resizable while a transient popup is open
|
// 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
|
// Since this isn't a native popup, the window manager doesn't close the popup when you click outside
|
||||||
|
NSUInteger parentStyleMask = [parentCocoaWindow->m_nsWindow styleMask];
|
||||||
|
if ((m_resizableTransientParent = (parentStyleMask & NSResizableWindowMask))
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||||
if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7
|
&& QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7
|
||||||
&& !([parentCocoaWindow->m_nsWindow styleMask] & NSFullScreenWindowMask))
|
&& !([parentCocoaWindow->m_nsWindow styleMask] & NSFullScreenWindowMask)
|
||||||
#endif
|
#endif
|
||||||
[parentCocoaWindow->m_nsWindow setStyleMask:
|
)
|
||||||
(parentCocoaWindow->windowStyleMask(parentCocoaWindow->m_windowFlags) & ~NSResizableWindowMask)];
|
[parentCocoaWindow->m_nsWindow setStyleMask:parentStyleMask & ~NSResizableWindowMask];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -398,13 +401,14 @@ void QCocoaWindow::setVisible(bool visible)
|
|||||||
[m_contentView setHidden:YES];
|
[m_contentView setHidden:YES];
|
||||||
}
|
}
|
||||||
if (parentCocoaWindow && window()->type() == Qt::Popup
|
if (parentCocoaWindow && window()->type() == Qt::Popup
|
||||||
|
&& m_resizableTransientParent
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||||
&& QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7
|
&& QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7
|
||||||
&& !([parentCocoaWindow->m_nsWindow styleMask] & NSFullScreenWindowMask)
|
&& !([parentCocoaWindow->m_nsWindow styleMask] & NSFullScreenWindowMask)
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
// QTBUG-30266: a window should not be resizable while a transient popup is open
|
// QTBUG-30266: a window should not be resizable while a transient popup is open
|
||||||
[parentCocoaWindow->m_nsWindow setStyleMask:parentCocoaWindow->windowStyleMask(parentCocoaWindow->m_windowFlags)];
|
[parentCocoaWindow->m_nsWindow setStyleMask:[parentCocoaWindow->m_nsWindow styleMask] | NSResizableWindowMask];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user