diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qcocoawindowdelegate_mac.mm | 12 | ||||
-rw-r--r-- | src/gui/kernel/qcocoawindowdelegate_mac_p.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 10 |
3 files changed, 20 insertions, 3 deletions
diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm index 803a1b1..9fb674e 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac.mm +++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm @@ -307,6 +307,18 @@ static void cleanupCocoaWindowDelegate() return m_windowHash->value(window); } +- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame +{ + Q_UNUSED(newFrame); + // saving the current window geometry before the window is maximized + QWidget *qwidget = m_windowHash->value(window); + if (qwidget->isWindow() && !(qwidget->windowState() & Qt::WindowMaximized)) { + QWidgetPrivate *widgetPrivate = qt_widget_private(qwidget); + widgetPrivate->topData()->normalGeometry = qwidget->geometry(); + } + return YES; +} + - (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)defaultFrame { NSRect frameToReturn = defaultFrame; diff --git a/src/gui/kernel/qcocoawindowdelegate_mac_p.h b/src/gui/kernel/qcocoawindowdelegate_mac_p.h index 3728002..243ba03 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac_p.h +++ b/src/gui/kernel/qcocoawindowdelegate_mac_p.h @@ -78,6 +78,7 @@ QT_FORWARD_DECLARE_CLASS(QWidgetData) - (void)windowDidResignKey:(NSNotification*)notification; - (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu; - (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event from:(NSPoint)dragImageLocation withPasteboard:(NSPasteboard *)pasteboard; +- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame; @end @protocol NSDrawerDelegate <NSObject> diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 9270220..e6dd0ee 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -730,6 +730,7 @@ static EventTypeSpec window_events[] = { { kEventClassWindow, kEventWindowClose }, { kEventClassWindow, kEventWindowExpanded }, { kEventClassWindow, kEventWindowHidden }, + { kEventClassWindow, kEventWindowZoom }, { kEventClassWindow, kEventWindowZoomed }, { kEventClassWindow, kEventWindowCollapsed }, { kEventClassWindow, kEventWindowToolbarSwitchMode }, @@ -812,6 +813,9 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event, QShowEvent qse; QApplication::sendSpontaneousEvent(widget, &qse); + } else if(ekind == kEventWindowZoom) { + widget->d_func()->topData()->normalGeometry = widget->geometry(); + handled_event = false; } else if(ekind == kEventWindowZoomed) { WindowPartCode windowPart; GetEventParameter(event, kEventParamWindowPartCode, @@ -3487,10 +3491,10 @@ void QWidget::setWindowState(Qt::WindowStates newstate) qt_mac_set_fullscreen_mode(true); } else { needShow = isVisible(); - setParent(parentWidget(), d->topData()->savedFlags); - setGeometry(d->topData()->normalGeometry); if(!qApp->desktop()->screenNumber(this)) qt_mac_set_fullscreen_mode(false); + setParent(parentWidget(), d->topData()->savedFlags); + setGeometry(d->topData()->normalGeometry); d->topData()->normalGeometry.setRect(0, 0, -1, -1); } } @@ -3592,7 +3596,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) [window zoom:window]; #endif needSendStateChange = oldstate == windowState(); // Zoom didn't change flags. - } else if(oldstate & Qt::WindowMaximized) { + } else if(oldstate & Qt::WindowMaximized && !(oldstate & Qt::WindowFullScreen)) { #ifndef QT_MAC_USE_COCOA Point idealSize; ZoomWindowIdeal(window, inZoomIn, &idealSize); |