From c48484ea6d39909b7919577701ffeb9656bbea62 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Tue, 15 Jul 2014 02:02:58 +0300 Subject: winrt: Fix orientation update mask On WP8.0, setting auto rotation preferences at runtime worked like an orientation update mask, and did not modify the behavior of the window. With WP8.1, setting auto rotation preferences has the side effect that the compositor will then resize the window when moving from e.g. portrait to landscape. Because of this, the auto rotation API should not be called inside orientationUpdateMask(). The default implementation is now sufficient, so the platform override is removed. Developers looking to set auto rotation preferences should use the application manifest or call the native api directly. Task-number: QTBUG-35953 Change-Id: I90cf4290ced34df1bb350cb6aa5deff209622865 Reviewed-by: Oliver Wolff --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 18 +++++------------- src/plugins/platforms/winrt/qwinrtscreen.h | 1 - 2 files changed, 5 insertions(+), 14 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index c366babebc..ef99e6da6b 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -432,7 +432,6 @@ class QWinRTScreenPrivate public: ComPtr application; ComPtr coreWindow; - ComPtr displayInformationStatics; ComPtr displayInformation; #ifdef Q_OS_WINPHONE ComPtr hardwareButtons; @@ -552,11 +551,12 @@ QWinRTScreen::QWinRTScreen() #endif // Q_OS_WINPHONE // Orientation handling + ComPtr displayInformationStatics; hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Graphics_Display_DisplayInformation).Get(), - IID_PPV_ARGS(&d->displayInformationStatics)); + IID_PPV_ARGS(&displayInformationStatics)); Q_ASSERT_SUCCEEDED(hr); - hr = d->displayInformationStatics->GetForCurrentView(&d->displayInformation); + hr = displayInformationStatics->GetForCurrentView(&d->displayInformation); Q_ASSERT_SUCCEEDED(hr); // Set native orientation @@ -572,9 +572,9 @@ QWinRTScreen::QWinRTScreen() Q_ASSERT_SUCCEEDED(hr); // Set initial orientation & pixel density - onOrientationChanged(Q_NULLPTR, Q_NULLPTR); onDpiChanged(Q_NULLPTR, Q_NULLPTR); - setOrientationUpdateMask(d->nativeOrientation); + d->orientation = d->nativeOrientation; + onOrientationChanged(Q_NULLPTR, Q_NULLPTR); d->eglDisplay = eglGetDisplay(d->displayInformation.Get()); if (d->eglDisplay == EGL_NO_DISPLAY) @@ -696,14 +696,6 @@ Qt::ScreenOrientation QWinRTScreen::orientation() const return d->orientation; } -void QWinRTScreen::setOrientationUpdateMask(Qt::ScreenOrientations mask) -{ - Q_D(QWinRTScreen); - - HRESULT hr = d->displayInformationStatics->put_AutoRotationPreferences(nativeOrientationsFromQt(mask)); - RETURN_VOID_IF_FAILED("Failed to set display auto rotation preferences."); -} - ICoreWindow *QWinRTScreen::coreWindow() const { Q_D(const QWinRTScreen); diff --git a/src/plugins/platforms/winrt/qwinrtscreen.h b/src/plugins/platforms/winrt/qwinrtscreen.h index 21673c9f06..6764450d84 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.h +++ b/src/plugins/platforms/winrt/qwinrtscreen.h @@ -107,7 +107,6 @@ public: Qt::ScreenOrientation nativeOrientation() const; Qt::ScreenOrientation orientation() const; - void setOrientationUpdateMask(Qt::ScreenOrientations mask); QWindow *topWindow() const; void addWindow(QWindow *window); -- cgit v1.2.3