winrt: Fix Windows Store Certification

WinRT requires that IDXGIDevice3::Trim() is called on application
suspend in order to pass Store Certification.

Task-number: QTBUG-38481
Change-Id: Ia3cb5d3f6a2db8f11e4bfa4fd5c7791e18d6c36d
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
This commit is contained in:
Andrew Knight 2014-12-01 09:57:15 +02:00 committed by Jani Heikkinen
parent 03b5ecce4a
commit 2903db0469

View File

@ -37,6 +37,9 @@
#include <EGL/eglext.h>
#include <d3d11.h>
#include <dxgi1_2.h>
#ifndef Q_OS_WINPHONE
#include <dxgi1_3.h>
#endif
#include "qwinrtbackingstore.h"
#include "qwinrtinputcontext.h"
@ -1113,6 +1116,16 @@ HRESULT QWinRTScreen::onActivated(ICoreWindow *, IWindowActivatedEventArgs *args
HRESULT QWinRTScreen::onSuspended(IInspectable *, ISuspendingEventArgs *)
{
#ifndef Q_OS_WINPHONE
Q_D(QWinRTScreen);
ComPtr<ID3D11Device> d3dDevice;
const EGLBoolean ok = eglQuerySurfacePointerANGLE(d->eglDisplay, EGL_NO_SURFACE, EGL_DEVICE_EXT, (void **)d3dDevice.GetAddressOf());
if (ok && d3dDevice) {
ComPtr<IDXGIDevice3> dxgiDevice;
if (SUCCEEDED(d3dDevice.As(&dxgiDevice)))
dxgiDevice->Trim();
}
#endif
QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationSuspended);
QWindowSystemInterface::flushWindowSystemEvents();
return S_OK;