summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@digia.com>2014-07-15 02:02:58 +0300
committerAndrew Knight <andrew.knight@digia.com>2014-08-05 16:44:18 +0200
commitc48484ea6d39909b7919577701ffeb9656bbea62 (patch)
treeaa585aa88e969d9f460875301833859d6d7d1d4d
parenta93bfc1ebe52c613804cbf58711337d9f5c7289b (diff)
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 <oliver.wolff@digia.com>
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.cpp18
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.h1
2 files changed, 5 insertions, 14 deletions
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<ICoreApplication> application;
ComPtr<ICoreWindow> coreWindow;
- ComPtr<IDisplayInformationStatics> displayInformationStatics;
ComPtr<IDisplayInformation> displayInformation;
#ifdef Q_OS_WINPHONE
ComPtr<IHardwareButtonsStatics> hardwareButtons;
@@ -552,11 +551,12 @@ QWinRTScreen::QWinRTScreen()
#endif // Q_OS_WINPHONE
// Orientation handling
+ ComPtr<IDisplayInformationStatics> 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);