Cocoa plugin - showMaximized/showMinimized and Qt::FramelessWindowHint

1. Qt::FramelessWindowHint imlplies NSBorderlessWindowMask, but should
   _not_ exclude NSResizableWindowMask - we still have API (showMaximized)
   to resize this window. Without NSResizableWindowMask showMaximized
   (calling NSWindow's '-zoom' under the hood) has no effect.
2. -performMiniaturize does not work with a borderless window, since such
   a window does not have a minimize button - use miniaturize for such
   window instead.

Change-Id: I691182ad7c1d230e670bfb70ef758483acbf0792
Task-number: QTBUG-44195
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
This commit is contained in:
Timur Pocheptsov 2015-01-30 12:37:37 +01:00
parent ad2ea16550
commit d024f0a922

View File

@ -804,7 +804,7 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags)
Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask)); Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask));
NSInteger styleMask = NSBorderlessWindowMask; NSInteger styleMask = NSBorderlessWindowMask;
if (flags & Qt::FramelessWindowHint) if (flags & Qt::FramelessWindowHint)
return styleMask; return styleMask | NSResizableWindowMask;
if ((type & Qt::Popup) == Qt::Popup) { if ((type & Qt::Popup) == Qt::Popup) {
if (!windowIsPopupType(type)) if (!windowIsPopupType(type))
styleMask = (NSUtilityWindowMask | NSResizableWindowMask | NSClosableWindowMask | styleMask = (NSUtilityWindowMask | NSResizableWindowMask | NSClosableWindowMask |
@ -1506,7 +1506,10 @@ void QCocoaWindow::syncWindowState(Qt::WindowState newState)
if ((m_synchedWindowState & Qt::WindowMinimized) != (newState & Qt::WindowMinimized)) { if ((m_synchedWindowState & Qt::WindowMinimized) != (newState & Qt::WindowMinimized)) {
if (newState & Qt::WindowMinimized) { if (newState & Qt::WindowMinimized) {
if (m_nsWindow.styleMask & NSMiniaturizableWindowMask)
[m_nsWindow performMiniaturize : m_nsWindow]; [m_nsWindow performMiniaturize : m_nsWindow];
else
[m_nsWindow miniaturize : m_nsWindow];
} else { } else {
[m_nsWindow deminiaturize : m_nsWindow]; [m_nsWindow deminiaturize : m_nsWindow];
} }