summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/winrt
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/winrt')
-rw-r--r--src/plugins/platforms/winrt/qwinrtbackingstore.cpp7
-rw-r--r--src/plugins/platforms/winrt/qwinrteglcontext.cpp5
-rw-r--r--src/plugins/platforms/winrt/qwinrtinputcontext.cpp4
-rw-r--r--src/plugins/platforms/winrt/qwinrtinputcontext.h2
-rw-r--r--src/plugins/platforms/winrt/qwinrtintegration.cpp136
-rw-r--r--src/plugins/platforms/winrt/qwinrtintegration.h16
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.cpp47
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.h8
-rw-r--r--src/plugins/platforms/winrt/qwinrtwindow.cpp7
-rw-r--r--src/plugins/platforms/winrt/winrt.pro3
10 files changed, 37 insertions, 198 deletions
diff --git a/src/plugins/platforms/winrt/qwinrtbackingstore.cpp b/src/plugins/platforms/winrt/qwinrtbackingstore.cpp
index c23d48b2dd..fbf611d7f7 100644
--- a/src/plugins/platforms/winrt/qwinrtbackingstore.cpp
+++ b/src/plugins/platforms/winrt/qwinrtbackingstore.cpp
@@ -45,8 +45,7 @@
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLFramebufferObject>
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
+#include <GLES3/gl3.h>
QT_BEGIN_NAMESPACE
@@ -83,7 +82,7 @@ bool QWinRTBackingStore::initialize()
return true;
d->context.reset(new QOpenGLContext);
- QSurfaceFormat format = window()->requestedFormat();
+ QSurfaceFormat format = window()->format();
d->context->setFormat(format);
d->context->setScreen(window()->screen());
if (!d->context->create())
@@ -138,7 +137,7 @@ void QWinRTBackingStore::flush(QWindow *window, const QRegion &region, const QPo
const int y2 = y1 + bounds.height();
const int x1 = bounds.x();
const int x2 = x1 + bounds.width();
- glBlitFramebufferANGLE(x1, y1, x2, y2,
+ glBlitFramebuffer(x1, y1, x2, y2,
x1, d->size.height() - y1, x2, d->size.height() - y2,
GL_COLOR_BUFFER_BIT, GL_NEAREST);
diff --git a/src/plugins/platforms/winrt/qwinrteglcontext.cpp b/src/plugins/platforms/winrt/qwinrteglcontext.cpp
index eeb79be2e6..aa64ac1f99 100644
--- a/src/plugins/platforms/winrt/qwinrteglcontext.cpp
+++ b/src/plugins/platforms/winrt/qwinrteglcontext.cpp
@@ -134,11 +134,14 @@ void QWinRTEGLContext::initialize()
const EGLint flags = d->format.testOption(QSurfaceFormat::DebugContext)
? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0;
+ const int major = d->format.majorVersion();
+ const int minor = d->format.minorVersion();
+ if (major > 3 || (major == 3 && minor > 0))
+ qWarning("QWinRTEGLContext: ANGLE only partially supports OpenGL ES > 3.0");
const EGLint attributes[] = {
EGL_CONTEXT_CLIENT_VERSION, d->format.majorVersion(),
EGL_CONTEXT_MINOR_VERSION_KHR, d->format.minorVersion(),
EGL_CONTEXT_FLAGS_KHR, flags,
- EGL_CONTEXT_OPENGL_NO_ERROR_KHR, true,
EGL_NONE
};
d->eglContext = eglCreateContext(g->eglDisplay, d->eglConfig, d->eglShareContext, attributes);
diff --git a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp
index f7e91bb047..5ae94ba613 100644
--- a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp
+++ b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp
@@ -158,8 +158,6 @@ HRESULT QWinRTInputContext::handleVisibilityChange(IInputPane *pane)
return S_OK;
}
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
-
static HRESULT getInputPane(ComPtr<IInputPane2> *inputPane2)
{
ComPtr<IInputPaneStatics> factory;
@@ -221,6 +219,4 @@ void QWinRTInputContext::hideInputPanel()
});
}
-#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
-
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/winrt/qwinrtinputcontext.h b/src/plugins/platforms/winrt/qwinrtinputcontext.h
index 13a0088ddc..59db90231f 100644
--- a/src/plugins/platforms/winrt/qwinrtinputcontext.h
+++ b/src/plugins/platforms/winrt/qwinrtinputcontext.h
@@ -74,10 +74,8 @@ public:
bool isInputPanelVisible() const override;
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
void showInputPanel() override;
void hideInputPanel() override;
-#endif
private slots:
void updateScreenCursorRect();
diff --git a/src/plugins/platforms/winrt/qwinrtintegration.cpp b/src/plugins/platforms/winrt/qwinrtintegration.cpp
index 4f37583bed..27d3746933 100644
--- a/src/plugins/platforms/winrt/qwinrtintegration.cpp
+++ b/src/plugins/platforms/winrt/qwinrtintegration.cpp
@@ -75,13 +75,6 @@
#include <windows.ui.viewmanagement.h>
#include <windows.graphics.display.h>
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
-# include <windows.phone.ui.input.h>
-# include <windows.foundation.metadata.h>
- using namespace ABI::Windows::Foundation::Metadata;
-#endif
-
-
using namespace Microsoft::WRL;
using namespace Microsoft::WRL::Wrappers;
using namespace ABI::Windows::Foundation;
@@ -92,27 +85,14 @@ using namespace ABI::Windows::UI::Core;
using namespace ABI::Windows::UI::ViewManagement;
using namespace ABI::Windows::Graphics::Display;
using namespace ABI::Windows::ApplicationModel::Core;
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
-using namespace ABI::Windows::Phone::UI::Input;
-#endif
typedef IEventHandler<IInspectable *> ResumeHandler;
typedef IEventHandler<SuspendingEventArgs *> SuspendHandler;
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
-typedef IEventHandler<BackPressedEventArgs*> BackPressedHandler;
-typedef IEventHandler<CameraEventArgs*> CameraButtonHandler;
-#endif
QT_BEGIN_NAMESPACE
typedef HRESULT (__stdcall ICoreApplication::*CoreApplicationCallbackRemover)(EventRegistrationToken);
uint qHash(CoreApplicationCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
-typedef HRESULT (__stdcall IHardwareButtonsStatics::*HardwareButtonsCallbackRemover)(EventRegistrationToken);
-uint qHash(HardwareButtonsCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
-typedef HRESULT (__stdcall IHardwareButtonsStatics2::*HardwareButtons2CallbackRemover)(EventRegistrationToken);
-uint qHash(HardwareButtons2CallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
-#endif
class QWinRTIntegrationPrivate
{
@@ -128,15 +108,6 @@ public:
ComPtr<ICoreApplication> application;
QHash<CoreApplicationCallbackRemover, EventRegistrationToken> applicationTokens;
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
- ComPtr<IHardwareButtonsStatics> hardwareButtons;
- QHash<HardwareButtonsCallbackRemover, EventRegistrationToken> buttonsTokens;
- ComPtr<IHardwareButtonsStatics2> cameraButtons;
- QHash<HardwareButtons2CallbackRemover, EventRegistrationToken> cameraTokens;
- boolean hasHardwareButtons;
- bool cameraHalfPressed : 1;
- bool cameraPressed : 1;
-#endif
};
QWinRTIntegration::QWinRTIntegration() : d_ptr(new QWinRTIntegrationPrivate)
@@ -156,52 +127,13 @@ QWinRTIntegration::QWinRTIntegration() : d_ptr(new QWinRTIntegrationPrivate)
&d->applicationTokens[&ICoreApplication::remove_Resuming]);
Q_ASSERT_SUCCEEDED(hr);
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
- d->hasHardwareButtons = false;
- ComPtr<IApiInformationStatics> apiInformationStatics;
- hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Foundation_Metadata_ApiInformation).Get(),
- IID_PPV_ARGS(&apiInformationStatics));
-
- if (SUCCEEDED(hr)) {
- const HStringReference valueRef(L"Windows.Phone.UI.Input.HardwareButtons");
- hr = apiInformationStatics->IsTypePresent(valueRef.Get(), &d->hasHardwareButtons);
- }
-
- if (d->hasHardwareButtons) {
- hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Phone_UI_Input_HardwareButtons).Get(),
- IID_PPV_ARGS(&d->hardwareButtons));
- Q_ASSERT_SUCCEEDED(hr);
- hr = d->hardwareButtons->add_BackPressed(Callback<BackPressedHandler>(this, &QWinRTIntegration::onBackButtonPressed).Get(),
- &d->buttonsTokens[&IHardwareButtonsStatics::remove_BackPressed]);
- Q_ASSERT_SUCCEEDED(hr);
-
- hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Phone_UI_Input_HardwareButtons).Get(),
- IID_PPV_ARGS(&d->cameraButtons));
- Q_ASSERT_SUCCEEDED(hr);
- if (qEnvironmentVariableIntValue("QT_QPA_ENABLE_CAMERA_KEYS")) {
- hr = d->cameraButtons->add_CameraPressed(Callback<CameraButtonHandler>(this, &QWinRTIntegration::onCameraPressed).Get(),
- &d->cameraTokens[&IHardwareButtonsStatics2::remove_CameraPressed]);
- Q_ASSERT_SUCCEEDED(hr);
- hr = d->cameraButtons->add_CameraHalfPressed(Callback<CameraButtonHandler>(this, &QWinRTIntegration::onCameraHalfPressed).Get(),
- &d->cameraTokens[&IHardwareButtonsStatics2::remove_CameraHalfPressed]);
- Q_ASSERT_SUCCEEDED(hr);
- hr = d->cameraButtons->add_CameraReleased(Callback<CameraButtonHandler>(this, &QWinRTIntegration::onCameraReleased).Get(),
- &d->cameraTokens[&IHardwareButtonsStatics2::remove_CameraReleased]);
- Q_ASSERT_SUCCEEDED(hr);
- }
- d->cameraPressed = false;
- d->cameraHalfPressed = false;
- }
-#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
-
-
QEventDispatcherWinRT::runOnXamlThread([d]() {
d->mainScreen = new QWinRTScreen;
return S_OK;
});
d->inputContext.reset(new QWinRTInputContext(d->mainScreen));
- screenAdded(d->mainScreen);
+ QWindowSystemInterface::handleScreenAdded(d->mainScreen);
d->platformServices = new QWinRTServices;
d->clipboard = new QWinRTClipboard;
#if QT_CONFIG(accessibility)
@@ -214,18 +146,6 @@ QWinRTIntegration::~QWinRTIntegration()
Q_D(QWinRTIntegration);
HRESULT hr;
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
- if (d->hasHardwareButtons) {
- for (QHash<HardwareButtonsCallbackRemover, EventRegistrationToken>::const_iterator i = d->buttonsTokens.begin(); i != d->buttonsTokens.end(); ++i) {
- hr = (d->hardwareButtons.Get()->*i.key())(i.value());
- Q_ASSERT_SUCCEEDED(hr);
- }
- for (QHash<HardwareButtons2CallbackRemover, EventRegistrationToken>::const_iterator i = d->cameraTokens.begin(); i != d->cameraTokens.end(); ++i) {
- hr = (d->cameraButtons.Get()->*i.key())(i.value());
- Q_ASSERT_SUCCEEDED(hr);
- }
- }
-#endif
// Do not execute this on Windows Phone as the application is already
// shutting down and trying to unregister suspending/resume handler will
// cause exceptions and assert in debug mode
@@ -234,7 +154,7 @@ QWinRTIntegration::~QWinRTIntegration()
Q_ASSERT_SUCCEEDED(hr);
}
- destroyScreen(d->mainScreen);
+ QWindowSystemInterface::handleScreenRemoved(d->mainScreen);
Windows::Foundation::Uninitialize();
}
@@ -353,58 +273,6 @@ QPlatformTheme *QWinRTIntegration::createPlatformTheme(const QString &name) cons
// System-level integration points
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
-HRESULT QWinRTIntegration::onBackButtonPressed(IInspectable *, IBackPressedEventArgs *args)
-{
- Q_D(QWinRTIntegration);
- QWindow *window = d->mainScreen->topWindow();
- QWindowSystemInterface::setSynchronousWindowSystemEvents(true);
- const bool pressed = QWindowSystemInterface::handleExtendedKeyEvent(window, QEvent::KeyPress, Qt::Key_Back, Qt::NoModifier,
- 0, 0, 0, QString(), false, 1, false);
- const bool released = QWindowSystemInterface::handleExtendedKeyEvent(window, QEvent::KeyRelease, Qt::Key_Back, Qt::NoModifier,
- 0, 0, 0, QString(), false, 1, false);
- QWindowSystemInterface::setSynchronousWindowSystemEvents(false);
- args->put_Handled(pressed || released);
- return S_OK;
-}
-
-HRESULT QWinRTIntegration::onCameraPressed(IInspectable *, ICameraEventArgs *)
-{
- Q_D(QWinRTIntegration);
- QWindow *window = d->mainScreen->topWindow();
- QWindowSystemInterface::handleExtendedKeyEvent(window, QEvent::KeyPress, Qt::Key_Camera, Qt::NoModifier,
- 0, 0, 0, QString(), false, 1, false);
- d->cameraPressed = true;
- return S_OK;
-}
-
-HRESULT QWinRTIntegration::onCameraHalfPressed(IInspectable *, ICameraEventArgs *)
-{
- Q_D(QWinRTIntegration);
- QWindow *window = d->mainScreen->topWindow();
- QWindowSystemInterface::handleExtendedKeyEvent(window, QEvent::KeyPress, Qt::Key_CameraFocus, Qt::NoModifier,
- 0, 0, 0, QString(), false, 1, false);
- d->cameraHalfPressed = true;
- return S_OK;
-}
-
-HRESULT QWinRTIntegration::onCameraReleased(IInspectable *, ICameraEventArgs *)
-{
- Q_D(QWinRTIntegration);
- QWindow *window = d->mainScreen->topWindow();
- if (d->cameraHalfPressed)
- QWindowSystemInterface::handleExtendedKeyEvent(window, QEvent::KeyRelease, Qt::Key_CameraFocus, Qt::NoModifier,
- 0, 0, 0, QString(), false, 1, false);
-
- if (d->cameraPressed)
- QWindowSystemInterface::handleExtendedKeyEvent(window, QEvent::KeyRelease, Qt::Key_Camera, Qt::NoModifier,
- 0, 0, 0, QString(), false, 1, false);
- d->cameraHalfPressed = false;
- d->cameraPressed = false;
- return S_OK;
-}
-#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
-
HRESULT QWinRTIntegration::onSuspended(IInspectable *, ISuspendingEventArgs *)
{
QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationSuspended);
diff --git a/src/plugins/platforms/winrt/qwinrtintegration.h b/src/plugins/platforms/winrt/qwinrtintegration.h
index 636e594b4b..e944ed5d79 100644
--- a/src/plugins/platforms/winrt/qwinrtintegration.h
+++ b/src/plugins/platforms/winrt/qwinrtintegration.h
@@ -50,16 +50,6 @@ namespace ABI {
namespace Foundation {
struct IAsyncAction;
}
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
- namespace Phone {
- namespace UI {
- namespace Input {
- struct IBackPressedEventArgs;
- struct ICameraEventArgs;
- }
- }
- }
-#endif
}
}
struct IAsyncInfo;
@@ -111,12 +101,6 @@ public:
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
private:
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
- HRESULT onBackButtonPressed(IInspectable *, ABI::Windows::Phone::UI::Input::IBackPressedEventArgs *args);
- HRESULT onCameraPressed(IInspectable *, ABI::Windows::Phone::UI::Input::ICameraEventArgs *);
- HRESULT onCameraHalfPressed(IInspectable *, ABI::Windows::Phone::UI::Input::ICameraEventArgs *);
- HRESULT onCameraReleased(IInspectable *, ABI::Windows::Phone::UI::Input::ICameraEventArgs *);
-#endif
HRESULT onSuspended(IInspectable *, ABI::Windows::ApplicationModel::ISuspendingEventArgs *);
HRESULT onResume(IInspectable *, IInspectable *);
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp
index bd2bbcb81c..e611c7be24 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.cpp
+++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp
@@ -91,13 +91,10 @@ typedef ITypedEventHandler<CoreWindow*, CharacterReceivedEventArgs*> CharacterRe
typedef ITypedEventHandler<CoreWindow*, InputEnabledEventArgs*> InputEnabledHandler;
typedef ITypedEventHandler<CoreWindow*, KeyEventArgs*> KeyHandler;
typedef ITypedEventHandler<CoreWindow*, PointerEventArgs*> PointerHandler;
-typedef ITypedEventHandler<CoreWindow*, WindowSizeChangedEventArgs*> SizeChangedHandler;
typedef ITypedEventHandler<CoreWindow*, VisibilityChangedEventArgs*> VisibilityChangedHandler;
typedef ITypedEventHandler<DisplayInformation*, IInspectable*> DisplayInformationHandler;
typedef ITypedEventHandler<ICorePointerRedirector*, PointerEventArgs*> RedirectHandler;
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
typedef ITypedEventHandler<ApplicationView*, IInspectable*> VisibleBoundsChangedHandler;
-#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
QT_BEGIN_NAMESPACE
@@ -479,10 +476,8 @@ typedef HRESULT (__stdcall IDisplayInformation::*DisplayCallbackRemover)(EventRe
uint qHash(DisplayCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
typedef HRESULT (__stdcall ICorePointerRedirector::*RedirectorCallbackRemover)(EventRegistrationToken);
uint qHash(RedirectorCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
typedef HRESULT (__stdcall IApplicationView2::*ApplicationView2CallbackRemover)(EventRegistrationToken);
uint qHash(ApplicationView2CallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); }
-#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
class QWinRTScreenPrivate
{
@@ -509,15 +504,14 @@ public:
QHash<CoreWindowCallbackRemover, EventRegistrationToken> windowTokens;
QHash<DisplayCallbackRemover, EventRegistrationToken> displayTokens;
QHash<RedirectorCallbackRemover, EventRegistrationToken> redirectTokens;
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
QHash<ApplicationView2CallbackRemover, EventRegistrationToken> view2Tokens;
ComPtr<IApplicationView2> view2;
-#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
QAtomicPointer<QWinRTWindow> mouseGrabWindow;
QAtomicPointer<QWinRTWindow> keyboardGrabWindow;
QWindow *currentPressWindow = nullptr;
QWindow *currentTargetWindow = nullptr;
bool firstMouseMove = true;
+ bool resizePending = false;
};
// To be called from the XAML thread
@@ -603,10 +597,8 @@ QWinRTScreen::QWinRTScreen()
d->cursor.reset(new QWinRTCursor);
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
hr = d->view.As(&d->view2);
Q_ASSERT_SUCCEEDED(hr);
-#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
}
QWinRTScreen::~QWinRTScreen()
@@ -630,12 +622,10 @@ QWinRTScreen::~QWinRTScreen()
hr = (d->redirect.Get()->*i.key())(i.value());
Q_ASSERT_SUCCEEDED(hr);
}
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
for (QHash<ApplicationView2CallbackRemover, EventRegistrationToken>::const_iterator i = d->view2Tokens.begin(); i != d->view2Tokens.end(); ++i) {
hr = (d->view2.Get()->*i.key())(i.value());
Q_ASSERT_SUCCEEDED(hr);
}
-#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
return hr;
});
RETURN_VOID_IF_FAILED("Failed to unregister screen event callbacks");
@@ -777,14 +767,8 @@ void QWinRTScreen::initialize()
Q_ASSERT_SUCCEEDED(hr);
hr = d->coreWindow->add_PointerWheelChanged(Callback<PointerHandler>(this, &QWinRTScreen::onPointerUpdated).Get(), &d->windowTokens[&ICoreWindow::remove_PointerWheelChanged]);
Q_ASSERT_SUCCEEDED(hr);
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
hr = d->view2->add_VisibleBoundsChanged(Callback<VisibleBoundsChangedHandler>(this, &QWinRTScreen::onWindowSizeChanged).Get(), &d->view2Tokens[&IApplicationView2::remove_VisibleBoundsChanged]);
Q_ASSERT_SUCCEEDED(hr);
-#else
- hr = d->coreWindow->add_SizeChanged(Callback<SizeChangedHandler>(this, &QWinRTScreen::onWindowSizeChanged).Get(), &d->windowTokens[&ICoreWindow::remove_SizeChanged]);
- Q_ASSERT_SUCCEEDED(hr)
-#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
-
hr = d->coreWindow->add_Activated(Callback<ActivatedHandler>(this, &QWinRTScreen::onActivated).Get(), &d->windowTokens[&ICoreWindow::remove_Activated]);
Q_ASSERT_SUCCEEDED(hr);
hr = d->coreWindow->add_Closed(Callback<ClosedHandler>(this, &QWinRTScreen::onClosed).Get(), &d->windowTokens[&ICoreWindow::remove_Closed]);
@@ -820,7 +804,6 @@ void QWinRTScreen::setKeyboardRect(const QRectF &keyboardRect)
return;
}
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);
if (FAILED(hr)) {
@@ -828,9 +811,6 @@ void QWinRTScreen::setKeyboardRect(const QRectF &keyboardRect)
return;
}
visibleRectF = QRectF(visibleRect.X, visibleRect.Y, visibleRect.Width, visibleRect.Height);
-#else
- visibleRectF = d->logicalRect;
-#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
// if keyboard is snapped to the bottom of the screen and would cover the cursor the content is
// moved up to make it visible
if (keyboardRect.intersects(mCursorRect)
@@ -1423,6 +1403,18 @@ void QWinRTScreen::emulateMouseMove(const QPointF &point, MousePositionTransitio
Qt::NoModifier);
}
+void QWinRTScreen::setResizePending()
+{
+ Q_D(QWinRTScreen);
+ d->resizePending = true;
+}
+
+bool QWinRTScreen::resizePending() const
+{
+ Q_D(const QWinRTScreen);
+ return d->resizePending;
+}
+
HRESULT QWinRTScreen::onActivated(ICoreWindow *, IWindowActivatedEventArgs *args)
{
Q_D(QWinRTScreen);
@@ -1528,11 +1520,7 @@ HRESULT QWinRTScreen::onRedirectReleased(ICorePointerRedirector *, IPointerEvent
return onPointerUpdated(nullptr, args);
}
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
-HRESULT QWinRTScreen::onWindowSizeChanged(IApplicationView *, IInspectable *)
-#else
-HRESULT QWinRTScreen::onWindowSizeChanged(ICoreWindow *, IWindowSizeChangedEventArgs *)
-#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
+HRESULT QWinRTScreen::onWindowSizeChanged(IApplicationView *w, IInspectable *)
{
Q_D(QWinRTScreen);
@@ -1543,19 +1531,18 @@ HRESULT QWinRTScreen::onWindowSizeChanged(ICoreWindow *, IWindowSizeChangedEvent
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();
+ // If we "emulate" a resize, w will be nullptr.Checking w shows whether it's a real resize
+ if (w)
+ d->resizePending = false;
return S_OK;
}
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.h b/src/plugins/platforms/winrt/qwinrtscreen.h
index cde148a638..63c254940d 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.h
+++ b/src/plugins/platforms/winrt/qwinrtscreen.h
@@ -59,7 +59,6 @@ namespace ABI {
struct IPointerEventArgs;
struct IVisibilityChangedEventArgs;
struct IWindowActivatedEventArgs;
- struct IWindowSizeChangedEventArgs;
}
namespace Xaml {
struct IDependencyObject;
@@ -137,6 +136,9 @@ public:
void emulateMouseMove(const QPointF &point, MousePositionTransition transition);
+ void setResizePending();
+ bool resizePending() const;
+
private:
void handleExpose();
@@ -154,11 +156,7 @@ private:
HRESULT onOrientationChanged(ABI::Windows::Graphics::Display::IDisplayInformation *, IInspectable *);
HRESULT onDpiChanged(ABI::Windows::Graphics::Display::IDisplayInformation *, IInspectable *);
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
HRESULT onWindowSizeChanged(ABI::Windows::UI::ViewManagement::IApplicationView *, IInspectable *);
-#else
- HRESULT onWindowSizeChanged(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IWindowSizeChangedEventArgs *);
-#endif
HRESULT onRedirectReleased(ABI::Windows::UI::Core::ICorePointerRedirector *, ABI::Windows::UI::Core::IPointerEventArgs *);
QScopedPointer<QWinRTScreenPrivate> d_ptr;
diff --git a/src/plugins/platforms/winrt/qwinrtwindow.cpp b/src/plugins/platforms/winrt/qwinrtwindow.cpp
index 29d234d276..73816b6512 100644
--- a/src/plugins/platforms/winrt/qwinrtwindow.cpp
+++ b/src/plugins/platforms/winrt/qwinrtwindow.cpp
@@ -112,6 +112,8 @@ QWinRTWindow::QWinRTWindow(QWindow *window)
d->screen = static_cast<QWinRTScreen *>(screen());
handleContentOrientationChange(window->contentOrientation());
+ d->surfaceFormat.setMajorVersion(3);
+ d->surfaceFormat.setMinorVersion(0);
d->surfaceFormat.setAlphaBufferSize(0);
d->surfaceFormat.setRedBufferSize(8);
d->surfaceFormat.setGreenBufferSize(8);
@@ -223,7 +225,8 @@ bool QWinRTWindow::isActive() const
bool QWinRTWindow::isExposed() const
{
- const bool exposed = isActive();
+ Q_D(const QWinRTWindow);
+ const bool exposed = isActive() && !d->screen->resizePending();
return exposed;
}
@@ -358,6 +361,7 @@ void QWinRTWindow::setWindowState(Qt::WindowStates state)
qCDebug(lcQpaWindows) << "Failed to enter full screen mode.";
return;
}
+ d->screen->setResizePending();
d->state = state;
return;
}
@@ -382,6 +386,7 @@ void QWinRTWindow::setWindowState(Qt::WindowStates state)
qCDebug(lcQpaWindows) << "Failed to exit full screen mode.";
return;
}
+ d->screen->setResizePending();
}
if (d->state & Qt::WindowMinimized || state == Qt::WindowNoState || state == Qt::WindowActive)
diff --git a/src/plugins/platforms/winrt/winrt.pro b/src/plugins/platforms/winrt/winrt.pro
index 6a847465e4..43132a1a76 100644
--- a/src/plugins/platforms/winrt/winrt.pro
+++ b/src/plugins/platforms/winrt/winrt.pro
@@ -8,7 +8,8 @@ QT += \
DEFINES *= QT_NO_CAST_FROM_ASCII __WRL_NO_DEFAULT_LIB__
-LIBS += -lws2_32 -ld3d11
+LIBS += -lws2_32
+QMAKE_USE_PRIVATE += d3d11
SOURCES = \
main.cpp \