winrt: use visible bounds the get the visual area

On Windows Phone / Windows 10 Mobile, there are the status bar
and sometimes a navigation bar, which are hiding the visible
window area. In the Windows Phone code paths, the area of the
status bar was tracked and the visual area was dynamically shrinked.

This patch enables that we use ApplicationView::visibleBounds() on
every target (except Windows 8.1) to get the visible area of the
application. Its change event is now also used as a resize trigger
for manual resizing through user.

Task-number: QTBUG-51163
Change-Id: I7abe2a0978418cc941e118e212426852474c026a
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
This commit is contained in:
Jochen Seemann 2016-03-24 15:22:05 +01:00 committed by Maurice Kalinowski
parent 152e496cda
commit 1ce52b0ddd
3 changed files with 74 additions and 139 deletions

View File

@ -85,9 +85,9 @@ typedef ITypedEventHandler<CoreWindow*, PointerEventArgs*> PointerHandler;
typedef ITypedEventHandler<CoreWindow*, WindowSizeChangedEventArgs*> SizeChangedHandler; typedef ITypedEventHandler<CoreWindow*, WindowSizeChangedEventArgs*> SizeChangedHandler;
typedef ITypedEventHandler<CoreWindow*, VisibilityChangedEventArgs*> VisibilityChangedHandler; typedef ITypedEventHandler<CoreWindow*, VisibilityChangedEventArgs*> VisibilityChangedHandler;
typedef ITypedEventHandler<DisplayInformation*, IInspectable*> DisplayInformationHandler; typedef ITypedEventHandler<DisplayInformation*, IInspectable*> DisplayInformationHandler;
#ifdef Q_OS_WINPHONE #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
typedef ITypedEventHandler<StatusBar*, IInspectable*> StatusBarHandler; typedef ITypedEventHandler<ApplicationView*, IInspectable*> VisibleBoundsChangedHandler;
#endif #endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -448,10 +448,10 @@ typedef HRESULT (__stdcall ICoreWindow::*CoreWindowCallbackRemover)(EventRegistr
uint qHash(CoreWindowCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); } uint qHash(CoreWindowCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
typedef HRESULT (__stdcall IDisplayInformation::*DisplayCallbackRemover)(EventRegistrationToken); typedef HRESULT (__stdcall IDisplayInformation::*DisplayCallbackRemover)(EventRegistrationToken);
uint qHash(DisplayCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); } uint qHash(DisplayCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
#ifdef Q_OS_WINPHONE #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
typedef HRESULT (__stdcall IStatusBar::*StatusBarCallbackRemover)(EventRegistrationToken); typedef HRESULT (__stdcall IApplicationView2::*ApplicationView2CallbackRemover)(EventRegistrationToken);
uint qHash(StatusBarCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); } uint qHash(ApplicationView2CallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
#endif #endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
class QWinRTScreenPrivate class QWinRTScreenPrivate
{ {
@ -461,13 +461,11 @@ public:
ComPtr<Xaml::IDependencyObject> canvas; ComPtr<Xaml::IDependencyObject> canvas;
ComPtr<IApplicationView> view; ComPtr<IApplicationView> view;
ComPtr<IDisplayInformation> displayInformation; ComPtr<IDisplayInformation> displayInformation;
#ifdef Q_OS_WINPHONE
ComPtr<IStatusBar> statusBar;
#endif
QScopedPointer<QWinRTCursor> cursor; QScopedPointer<QWinRTCursor> cursor;
QHash<quint32, QWindowSystemInterface::TouchPoint> touchPoints; QHash<quint32, QWindowSystemInterface::TouchPoint> touchPoints;
QSizeF logicalSize; QRectF logicalRect;
QRectF visibleRect;
QSurfaceFormat surfaceFormat; QSurfaceFormat surfaceFormat;
qreal logicalDpi; qreal logicalDpi;
QDpi physicalDpi; QDpi physicalDpi;
@ -478,9 +476,10 @@ public:
QHash<Qt::Key, KeyInfo> activeKeys; QHash<Qt::Key, KeyInfo> activeKeys;
QHash<CoreWindowCallbackRemover, EventRegistrationToken> windowTokens; QHash<CoreWindowCallbackRemover, EventRegistrationToken> windowTokens;
QHash<DisplayCallbackRemover, EventRegistrationToken> displayTokens; QHash<DisplayCallbackRemover, EventRegistrationToken> displayTokens;
#ifdef Q_OS_WINPHONE #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
QHash<StatusBarCallbackRemover, EventRegistrationToken> statusBarTokens; QHash<ApplicationView2CallbackRemover, EventRegistrationToken> view2Tokens;
#endif ComPtr<IApplicationView2> view2;
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
}; };
// To be called from the XAML thread // To be called from the XAML thread
@ -511,7 +510,8 @@ QWinRTScreen::QWinRTScreen()
Rect rect; Rect rect;
hr = d->coreWindow->get_Bounds(&rect); hr = d->coreWindow->get_Bounds(&rect);
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
d->logicalSize = QSizeF(rect.Width, rect.Height); d->logicalRect = QRectF(0.0f, 0.0f, rect.Width, rect.Height);
d->visibleRect = QRectF(0.0f, 0.0f, rect.Width, rect.Height);
// Orientation handling // Orientation handling
ComPtr<IDisplayInformationStatics> displayInformationStatics; ComPtr<IDisplayInformationStatics> displayInformationStatics;
@ -546,9 +546,9 @@ QWinRTScreen::QWinRTScreen()
ComPtr<Xaml::IFrameworkElement> frameworkElement; ComPtr<Xaml::IFrameworkElement> frameworkElement;
hr = canvas.As(&frameworkElement); hr = canvas.As(&frameworkElement);
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
hr = frameworkElement->put_Width(d->logicalSize.width()); hr = frameworkElement->put_Width(d->logicalRect.width());
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
hr = frameworkElement->put_Height(d->logicalSize.height()); hr = frameworkElement->put_Height(d->logicalRect.height());
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
ComPtr<Xaml::IUIElement> uiElement; ComPtr<Xaml::IUIElement> uiElement;
hr = canvas.As(&uiElement); hr = canvas.As(&uiElement);
@ -560,14 +560,10 @@ QWinRTScreen::QWinRTScreen()
d->cursor.reset(new QWinRTCursor); d->cursor.reset(new QWinRTCursor);
#ifdef Q_OS_WINPHONE #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
ComPtr<IStatusBarStatics> statusBarStatics; hr = d->view.As(&d->view2);
hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_StatusBar).Get(),
IID_PPV_ARGS(&statusBarStatics));
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
hr = statusBarStatics->GetForCurrentView(&d->statusBar); #endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
Q_ASSERT_SUCCEEDED(hr);
#endif // Q_OS_WINPHONE
} }
QWinRTScreen::~QWinRTScreen() QWinRTScreen::~QWinRTScreen()
@ -587,12 +583,12 @@ QWinRTScreen::~QWinRTScreen()
hr = (d->displayInformation.Get()->*i.key())(i.value()); hr = (d->displayInformation.Get()->*i.key())(i.value());
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
} }
#ifdef Q_OS_WINPHONE #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
for (QHash<StatusBarCallbackRemover, EventRegistrationToken>::const_iterator i = d->statusBarTokens.begin(); i != d->statusBarTokens.end(); ++i) { for (QHash<ApplicationView2CallbackRemover, EventRegistrationToken>::const_iterator i = d->view2Tokens.begin(); i != d->view2Tokens.end(); ++i) {
hr = (d->statusBar.Get()->*i.key())(i.value()); hr = (d->view2.Get()->*i.key())(i.value());
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
} }
#endif //Q_OS_WINPHONE #endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
return hr; return hr;
}); });
RETURN_VOID_IF_FAILED("Failed to unregister screen event callbacks"); RETURN_VOID_IF_FAILED("Failed to unregister screen event callbacks");
@ -601,33 +597,17 @@ QWinRTScreen::~QWinRTScreen()
QRect QWinRTScreen::geometry() const QRect QWinRTScreen::geometry() const
{ {
Q_D(const QWinRTScreen); Q_D(const QWinRTScreen);
return QRect(QPoint(), (d->logicalSize * d->scaleFactor).toSize()); return QRect(QPoint(), QSizeF(d->logicalRect.size() * d->scaleFactor).toSize());
} }
#ifdef Q_OS_WINPHONE
QRect QWinRTScreen::availableGeometry() const QRect QWinRTScreen::availableGeometry() const
{ {
Q_D(const QWinRTScreen); Q_D(const QWinRTScreen);
QRect statusBar; return QRectF((d->visibleRect.x() - d->logicalRect.x())* d->scaleFactor,
QEventDispatcherWinRT::runOnXamlThread([d, &statusBar]() { (d->visibleRect.y() - d->logicalRect.y()) * d->scaleFactor,
HRESULT hr; d->visibleRect.width() * d->scaleFactor,
Rect rect; d->visibleRect.height() * d->scaleFactor).toRect();
hr = d->statusBar->get_OccludedRect(&rect);
Q_ASSERT_SUCCEEDED(hr);
statusBar.setRect(qRound(rect.X * d->scaleFactor),
qRound(rect.Y * d->scaleFactor),
qRound(rect.Width * d->scaleFactor),
qRound(rect.Height * d->scaleFactor));
return S_OK;
});
return geometry().adjusted(
d->orientation == Qt::LandscapeOrientation ? statusBar.width() : 0,
d->orientation == Qt::PortraitOrientation ? statusBar.height() : 0,
d->orientation == Qt::InvertedLandscapeOrientation ? -statusBar.width() : 0,
0);
} }
#endif //Q_OS_WINPHONE
int QWinRTScreen::depth() const int QWinRTScreen::depth() const
{ {
@ -642,8 +622,8 @@ QImage::Format QWinRTScreen::format() const
QSizeF QWinRTScreen::physicalSize() const QSizeF QWinRTScreen::physicalSize() const
{ {
Q_D(const QWinRTScreen); Q_D(const QWinRTScreen);
return QSizeF(d->logicalSize.width() * d->scaleFactor / d->physicalDpi.first * qreal(25.4), return QSizeF(d->logicalRect.width() * d->scaleFactor / d->physicalDpi.first * qreal(25.4),
d->logicalSize.height() * d->scaleFactor / d->physicalDpi.second * qreal(25.4)); d->logicalRect.height() * d->scaleFactor / d->physicalDpi.second * qreal(25.4));
} }
QDpi QWinRTScreen::logicalDpi() const QDpi QWinRTScreen::logicalDpi() const
@ -720,29 +700,6 @@ Xaml::IDependencyObject *QWinRTScreen::canvas() const
return d->canvas.Get(); return d->canvas.Get();
} }
#ifdef Q_OS_WINPHONE
void QWinRTScreen::setStatusBarVisibility(bool visible, QWindow *window)
{
Q_D(QWinRTScreen);
qCDebug(lcQpaWindows) << __FUNCTION__ << window << visible;
const Qt::WindowFlags windowType = window->flags() & Qt::WindowType_Mask;
if (!window || (windowType != Qt::Window && windowType != Qt::Dialog))
return;
QEventDispatcherWinRT::runOnXamlThread([d, visible]() {
HRESULT hr;
ComPtr<IAsyncAction> op;
if (visible)
hr = d->statusBar->ShowAsync(&op);
else
hr = d->statusBar->HideAsync(&op);
Q_ASSERT_SUCCEEDED(hr);
return S_OK;
});
}
#endif //Q_OS_WINPHONE
void QWinRTScreen::initialize() void QWinRTScreen::initialize()
{ {
Q_D(QWinRTScreen); Q_D(QWinRTScreen);
@ -765,15 +722,14 @@ void QWinRTScreen::initialize()
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
hr = d->coreWindow->add_PointerWheelChanged(Callback<PointerHandler>(this, &QWinRTScreen::onPointerUpdated).Get(), &d->windowTokens[&ICoreWindow::remove_PointerWheelChanged]); hr = d->coreWindow->add_PointerWheelChanged(Callback<PointerHandler>(this, &QWinRTScreen::onPointerUpdated).Get(), &d->windowTokens[&ICoreWindow::remove_PointerWheelChanged]);
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
#ifndef Q_OS_WINPHONE #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
hr = d->coreWindow->add_SizeChanged(Callback<SizeChangedHandler>(this, &QWinRTScreen::onSizeChanged).Get(), &d->windowTokens[&ICoreWindow::remove_SizeChanged]); hr = d->view2->add_VisibleBoundsChanged(Callback<VisibleBoundsChangedHandler>(this, &QWinRTScreen::onWindowSizeChanged).Get(), &d->view2Tokens[&IApplicationView2::remove_VisibleBoundsChanged]);
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
#else #else
hr = d->statusBar->add_Showing(Callback<StatusBarHandler>(this, &QWinRTScreen::onStatusBarShowing).Get(), &d->statusBarTokens[&IStatusBar::remove_Showing]); hr = d->coreWindow->add_SizeChanged(Callback<SizeChangedHandler>(this, &QWinRTScreen::onWindowSizeChanged).Get(), &d->windowTokens[&ICoreWindow::remove_SizeChanged]);
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr)
hr = d->statusBar->add_Hiding(Callback<StatusBarHandler>(this, &QWinRTScreen::onStatusBarHiding).Get(), &d->statusBarTokens[&IStatusBar::remove_Hiding]); #endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
Q_ASSERT_SUCCEEDED(hr);
#endif
hr = d->coreWindow->add_Activated(Callback<ActivatedHandler>(this, &QWinRTScreen::onActivated).Get(), &d->windowTokens[&ICoreWindow::remove_Activated]); hr = d->coreWindow->add_Activated(Callback<ActivatedHandler>(this, &QWinRTScreen::onActivated).Get(), &d->windowTokens[&ICoreWindow::remove_Activated]);
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
hr = d->coreWindow->add_Closed(Callback<ClosedHandler>(this, &QWinRTScreen::onClosed).Get(), &d->windowTokens[&ICoreWindow::remove_Closed]); hr = d->coreWindow->add_Closed(Callback<ClosedHandler>(this, &QWinRTScreen::onClosed).Get(), &d->windowTokens[&ICoreWindow::remove_Closed]);
@ -801,11 +757,6 @@ void QWinRTScreen::addWindow(QWindow *window)
if (window == topWindow()) if (window == topWindow())
return; return;
#ifdef Q_OS_WINPHONE
if (window->visibility() != QWindow::Maximized && window->visibility() != QWindow::Windowed)
setStatusBarVisibility(false, window);
#endif
d->visibleWindows.prepend(window); d->visibleWindows.prepend(window);
QWindowSystemInterface::handleWindowActivated(window, Qt::OtherFocusReason); QWindowSystemInterface::handleWindowActivated(window, Qt::OtherFocusReason);
handleExpose(); handleExpose();
@ -817,11 +768,6 @@ void QWinRTScreen::removeWindow(QWindow *window)
Q_D(QWinRTScreen); Q_D(QWinRTScreen);
qCDebug(lcQpaWindows) << __FUNCTION__ << window; qCDebug(lcQpaWindows) << __FUNCTION__ << window;
#ifdef Q_OS_WINPHONE
if (window->visibility() == QWindow::Minimized)
setStatusBarVisibility(false, window);
#endif
const bool wasTopWindow = window == topWindow(); const bool wasTopWindow = window == topWindow();
if (!d->visibleWindows.removeAll(window)) if (!d->visibleWindows.removeAll(window))
return; return;
@ -1125,7 +1071,7 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args)
} }
it.value().area = QRectF(area.X * d->scaleFactor, area.Y * d->scaleFactor, it.value().area = QRectF(area.X * d->scaleFactor, area.Y * d->scaleFactor,
area.Width * d->scaleFactor, area.Height * d->scaleFactor); area.Width * d->scaleFactor, area.Height * d->scaleFactor);
it.value().normalPosition = QPointF(point.X/d->logicalSize.width(), point.Y/d->logicalSize.height()); it.value().normalPosition = QPointF(point.X/d->logicalRect.width(), point.Y/d->logicalRect.height());
it.value().pressure = pressure; it.value().pressure = pressure;
QWindowSystemInterface::handleTouchEvent(topWindow(), d->touchDevice, d->touchPoints.values(), mods); QWindowSystemInterface::handleTouchEvent(topWindow(), d->touchDevice, d->touchPoints.values(), mods);
@ -1174,22 +1120,6 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args)
return S_OK; return S_OK;
} }
HRESULT QWinRTScreen::onSizeChanged(ICoreWindow *, IWindowSizeChangedEventArgs *)
{
Q_D(QWinRTScreen);
Rect size;
HRESULT hr;
hr = d->coreWindow->get_Bounds(&size);
RETURN_OK_IF_FAILED("Failed to get window bounds");
d->logicalSize = QSizeF(size.Width, size.Height);
qCDebug(lcQpaWindows) << __FUNCTION__ << d->logicalSize;
QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), availableGeometry());
QPlatformScreen::resizeMaximizedWindows();
handleExpose();
return S_OK;
}
HRESULT QWinRTScreen::onActivated(ICoreWindow *, IWindowActivatedEventArgs *args) HRESULT QWinRTScreen::onActivated(ICoreWindow *, IWindowActivatedEventArgs *args)
{ {
Q_D(QWinRTScreen); Q_D(QWinRTScreen);
@ -1228,8 +1158,10 @@ HRESULT QWinRTScreen::onVisibilityChanged(ICoreWindow *, IVisibilityChangedEvent
RETURN_OK_IF_FAILED("Failed to get visibility."); RETURN_OK_IF_FAILED("Failed to get visibility.");
qCDebug(lcQpaWindows) << __FUNCTION__ << visible; qCDebug(lcQpaWindows) << __FUNCTION__ << visible;
QWindowSystemInterface::handleApplicationStateChanged(visible ? Qt::ApplicationActive : Qt::ApplicationHidden); QWindowSystemInterface::handleApplicationStateChanged(visible ? Qt::ApplicationActive : Qt::ApplicationHidden);
if (visible) if (visible) {
handleExpose(); handleExpose();
onWindowSizeChanged(nullptr, nullptr);
}
return S_OK; return S_OK;
} }
@ -1245,9 +1177,7 @@ HRESULT QWinRTScreen::onOrientationChanged(IDisplayInformation *, IInspectable *
if (d->orientation != newOrientation) { if (d->orientation != newOrientation) {
d->orientation = newOrientation; d->orientation = newOrientation;
qCDebug(lcQpaWindows) << " New orientation:" << newOrientation; qCDebug(lcQpaWindows) << " New orientation:" << newOrientation;
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP) onWindowSizeChanged(nullptr, nullptr);
onSizeChanged(nullptr, nullptr);
#endif
QWindowSystemInterface::handleScreenOrientationChange(screen(), d->orientation); QWindowSystemInterface::handleScreenOrientationChange(screen(), d->orientation);
handleExpose(); // Clean broken frames caused by race between Qt and ANGLE handleExpose(); // Clean broken frames caused by race between Qt and ANGLE
} }
@ -1291,20 +1221,35 @@ HRESULT QWinRTScreen::onDpiChanged(IDisplayInformation *, IInspectable *)
return S_OK; return S_OK;
} }
#ifdef Q_OS_WINPHONE #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
HRESULT QWinRTScreen::onStatusBarShowing(IStatusBar *, IInspectable *) HRESULT QWinRTScreen::onWindowSizeChanged(IApplicationView *, IInspectable *)
#else
HRESULT QWinRTScreen::onWindowSizeChanged(ICoreWindow *, IWindowSizeChangedEventArgs *)
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
{ {
qCDebug(lcQpaWindows) << __FUNCTION__; Q_D(QWinRTScreen);
onSizeChanged(nullptr, nullptr);
return S_OK;
}
HRESULT QWinRTScreen::onStatusBarHiding(IStatusBar *, IInspectable *) HRESULT hr;
{ Rect windowSize;
qCDebug(lcQpaWindows) << __FUNCTION__;
onSizeChanged(nullptr, nullptr); hr = d->coreWindow->get_Bounds(&windowSize);
RETURN_OK_IF_FAILED("Failed to get window bounds");
d->logicalRect = QRectF(windowSize.X, windowSize.Y, windowSize.Width, windowSize.Height);
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
Rect visibleRect;
hr = d->view2->get_VisibleBounds(&visibleRect);
RETURN_OK_IF_FAILED("Failed to get window visible bounds");
d->visibleRect = QRectF(visibleRect.X, visibleRect.Y, visibleRect.Width, visibleRect.Height);
#else
d->visibleRect = QRectF(windowSize.X, windowSize.Y, windowSize.Width, windowSize.Height);
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
qCDebug(lcQpaWindows) << __FUNCTION__ << d->logicalRect;
QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), availableGeometry());
QPlatformScreen::resizeMaximizedWindows();
handleExpose();
return S_OK; return S_OK;
} }
#endif //Q_OS_WINPHONE
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -62,7 +62,7 @@ namespace ABI {
struct IWindow; struct IWindow;
} }
namespace ViewManagement { namespace ViewManagement {
struct IStatusBar; struct IApplicationView;
} }
} }
namespace Graphics { namespace Graphics {
@ -85,10 +85,9 @@ class QWinRTScreen : public QPlatformScreen
public: public:
explicit QWinRTScreen(); explicit QWinRTScreen();
~QWinRTScreen(); ~QWinRTScreen();
QRect geometry() const Q_DECL_OVERRIDE; QRect geometry() const Q_DECL_OVERRIDE;
#ifdef Q_OS_WINPHONE
QRect availableGeometry() const Q_DECL_OVERRIDE; QRect availableGeometry() const Q_DECL_OVERRIDE;
#endif
int depth() const Q_DECL_OVERRIDE; int depth() const Q_DECL_OVERRIDE;
QImage::Format format() const Q_DECL_OVERRIDE; QImage::Format format() const Q_DECL_OVERRIDE;
QSizeF physicalSize() const Q_DECL_OVERRIDE; QSizeF physicalSize() const Q_DECL_OVERRIDE;
@ -112,10 +111,6 @@ public:
ABI::Windows::UI::Core::ICoreWindow *coreWindow() const; ABI::Windows::UI::Core::ICoreWindow *coreWindow() const;
ABI::Windows::UI::Xaml::IDependencyObject *canvas() const; ABI::Windows::UI::Xaml::IDependencyObject *canvas() const;
#ifdef Q_OS_WINPHONE
void setStatusBarVisibility(bool visible, QWindow *window);
#endif
void initialize(); void initialize();
private: private:
@ -127,7 +122,6 @@ private:
HRESULT onPointerEntered(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IPointerEventArgs *); HRESULT onPointerEntered(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IPointerEventArgs *);
HRESULT onPointerExited(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IPointerEventArgs *); HRESULT onPointerExited(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IPointerEventArgs *);
HRESULT onPointerUpdated(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IPointerEventArgs *); HRESULT onPointerUpdated(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IPointerEventArgs *);
HRESULT onSizeChanged(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IWindowSizeChangedEventArgs *);
HRESULT onActivated(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IWindowActivatedEventArgs *); HRESULT onActivated(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IWindowActivatedEventArgs *);
@ -136,10 +130,10 @@ private:
HRESULT onOrientationChanged(ABI::Windows::Graphics::Display::IDisplayInformation *, IInspectable *); HRESULT onOrientationChanged(ABI::Windows::Graphics::Display::IDisplayInformation *, IInspectable *);
HRESULT onDpiChanged(ABI::Windows::Graphics::Display::IDisplayInformation *, IInspectable *); HRESULT onDpiChanged(ABI::Windows::Graphics::Display::IDisplayInformation *, IInspectable *);
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
#ifdef Q_OS_WINPHONE HRESULT onWindowSizeChanged(ABI::Windows::UI::ViewManagement::IApplicationView *, IInspectable *);
HRESULT onStatusBarShowing(ABI::Windows::UI::ViewManagement::IStatusBar *, IInspectable *); #else
HRESULT onStatusBarHiding(ABI::Windows::UI::ViewManagement::IStatusBar *, IInspectable *); HRESULT onWindowSizeChanged(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IWindowSizeChangedEventArgs *);
#endif #endif
QScopedPointer<QWinRTScreenPrivate> d_ptr; QScopedPointer<QWinRTScreenPrivate> d_ptr;

View File

@ -319,10 +319,6 @@ void QWinRTWindow::setWindowState(Qt::WindowState state)
if (d->state == state) if (d->state == state)
return; return;
#ifdef Q_OS_WINPHONE
d->screen->setStatusBarVisibility(state == Qt::WindowMaximized || state == Qt::WindowNoState, window());
#endif
if (state == Qt::WindowMinimized) if (state == Qt::WindowMinimized)
setUIElementVisibility(d->uiElement.Get(), false); setUIElementVisibility(d->uiElement.Get(), false);