From e84e86dc8cdab602ed19c18829e57230687a427c Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Thu, 6 Dec 2012 17:46:07 +0100 Subject: Update QNSView geometry on window resize. Ideally this should not be required since NSWindow should resize the content view automatically. However, in the case of modal QDialogs this does not happen. Add call to updateGeometry in windowDidResize as a workaround, and remove code which called QNSView::setFrameSize with the current size. This will cause duplicate handleGeometryChange calls in the non-qdialog case, add a test to see if the geometry really has changed to prevent that. Change-Id: I29bea23b2ab72f923aeadf8db8cb9131ae177a28 Reviewed-by: Liang Qi --- src/plugins/platforms/cocoa/qcocoawindow.mm | 4 +--- src/plugins/platforms/cocoa/qnsview.mm | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 8ef489e28e..ffee8528f0 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -590,9 +590,7 @@ void QCocoaWindow::windowDidResize() if (!m_nsWindow) return; - NSRect rect = [[m_nsWindow contentView]frame]; - // Call setFrameSize which will trigger a frameDidChangeNotification on QNSView. - [[m_nsWindow contentView] setFrameSize:rect.size]; + [m_contentView updateGeometry]; } void QCocoaWindow::windowWillClose() diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index eea65cf8c0..1f19b07904 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -185,6 +185,9 @@ static QTouchDevice *touchDevice = 0; geometry = qt_mac_toQRect([self frame]); } + if (geometry == m_platformWindow->geometry()) + return; + #ifdef QT_COCOA_ENABLE_WINDOW_DEBUG qDebug() << "QNSView::udpateGeometry" << m_platformWindow << geometry; #endif -- cgit v1.2.3