Update QNSView geometry on window resize.
authorMorten Johan Sorvig <morten.sorvig@digia.com>
Thu, 6 Dec 2012 16:46:07 +0000 (17:46 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 7 Dec 2012 08:15:00 +0000 (09:15 +0100)
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 <liang.qi@digia.com>
src/plugins/platforms/cocoa/qcocoawindow.mm
src/plugins/platforms/cocoa/qnsview.mm

index 8ef489e..ffee852 100644 (file)
@@ -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()
index eea65cf..1f19b07 100644 (file)
@@ -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