Cocoa: Fix minimizing/zooming frameless windows.

Use miniaturize instead of performMiniaturize when the window has no
minimize button (even if frameless).
Make sure the window is resizable before performing zoom. Even restore
this, of course.

Change-Id: I43217153b4d4fcec0ded4afcde3009817e01feba
Task-number: QTBUG-32184 QTBUG-45339
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
This commit is contained in:
Christoph Schleifenbaum 2015-03-14 15:51:53 +01:00 committed by Timur Pocheptsov
parent 9f34943245
commit 2432a821aa

View File

@ -1488,10 +1488,23 @@ void QCocoaWindow::syncWindowState(Qt::WindowState newState)
}
Qt::WindowState predictedState = newState;
if ((m_synchedWindowState & Qt::WindowMaximized) != (newState & Qt::WindowMaximized)) {
const int styleMask = [m_nsWindow styleMask];
const bool usePerform = styleMask & NSResizableWindowMask;
[m_nsWindow setStyleMask:styleMask | NSResizableWindowMask];
if (usePerform)
[m_nsWindow performZoom : m_nsWindow]; // toggles
else
[m_nsWindow zoom : m_nsWindow]; // toggles
[m_nsWindow setStyleMask:styleMask];
}
if ((m_synchedWindowState & Qt::WindowMinimized) != (newState & Qt::WindowMinimized)) {
if (newState & Qt::WindowMinimized) {
[m_nsWindow performMiniaturize : m_nsWindow];
if ([m_nsWindow styleMask] & NSMiniaturizableWindowMask)
[m_nsWindow performMiniaturize : m_nsWindow];
else
[m_nsWindow miniaturize : m_nsWindow];
} else {
[m_nsWindow deminiaturize : m_nsWindow];
}