winrt: Fix window resize v5.4.0
authorAndrew Knight <andrew.knight@theqtcompany.com>
Thu, 4 Dec 2014 13:21:28 +0000 (15:21 +0200)
committerIikka Eklund <iikka.eklund@theqtcompany.com>
Fri, 5 Dec 2014 04:37:01 +0000 (05:37 +0100)
The fixed-size EGL display must be updated on PC as well as Windows Phone.

Task-number: QTBUG-43112
Change-Id: I0ba90370b67e8c065843e5754579e341b647266d
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
src/plugins/platforms/winrt/qwinrtscreen.cpp

index 612a50f6b7e9d8b3c243963dd7ed2738ebca1903..37a3ff3d63b76ca458bf948439a33eda6a21519f 100644 (file)
@@ -1081,12 +1081,14 @@ HRESULT QWinRTScreen::onSizeChanged(ICoreWindow *, IWindowSizeChangedEventArgs *
     d->logicalSize = logicalSize;
     if (d->eglDisplay) {
         const QRect newGeometry = geometry();
-#ifdef Q_OS_WINPHONE // Resize the EGL window
-        const int width = newGeometry.width() * (d->orientation == Qt::InvertedPortraitOrientation || d->orientation == Qt::LandscapeOrientation ? -1 : 1);
-        const int height = newGeometry.height() * (d->orientation == Qt::InvertedPortraitOrientation || d->orientation == Qt::InvertedLandscapeOrientation ? -1 : 1);
+        int width = newGeometry.width();
+        int height = newGeometry.height();
+#ifdef Q_OS_WINPHONE // Windows Phone can pass in a negative size to provide orientation information
+        width *= (d->orientation == Qt::InvertedPortraitOrientation || d->orientation == Qt::LandscapeOrientation) ? -1 : 1;
+        height *= (d->orientation == Qt::InvertedPortraitOrientation || d->orientation == Qt::InvertedLandscapeOrientation) ? -1 : 1;
+#endif
         eglSurfaceAttrib(d->eglDisplay, d->eglSurface, EGL_WIDTH, width);
         eglSurfaceAttrib(d->eglDisplay, d->eglSurface, EGL_HEIGHT, height);
-#endif
         QWindowSystemInterface::handleScreenGeometryChange(screen(), newGeometry, newGeometry);
         QPlatformScreen::resizeMaximizedWindows();
         handleExpose();