From 5c95c2077ce480a2a0192babbe5efe1e23731633 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Sun, 23 Aug 2015 23:51:26 +0300 Subject: [PATCH] winphone: Fix keyboard show/hide calls These need to occur on the XAML thread. Change-Id: Id42a37df95b09e6d3c0a1b6e593bbf8cbfe5a129 Reviewed-by: Samuel Nevala Reviewed-by: Maurice Kalinowski --- .../platforms/winrt/qwinrtinputcontext.cpp | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp index 7bd9e87ca6..f3b390b4d6 100644 --- a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp +++ b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp @@ -37,7 +37,9 @@ #include "qwinrtinputcontext.h" #include "qwinrtscreen.h" #include +#include +#include #include #include #include @@ -163,10 +165,14 @@ void QWinRTInputContext::showInputPanel() if (FAILED(hr)) return; - boolean success; - hr = inputPane->TryShow(&success); - if (FAILED(hr)) - qErrnoWarning(hr, "Failed to show input panel."); + QEventDispatcherWinRT::runOnXamlThread([&inputPane]() { + HRESULT hr; + boolean success; + hr = inputPane->TryShow(&success); + if (FAILED(hr) || !success) + qErrnoWarning(hr, "Failed to show input panel."); + return hr; + }); } void QWinRTInputContext::hideInputPanel() @@ -176,10 +182,14 @@ void QWinRTInputContext::hideInputPanel() if (FAILED(hr)) return; - boolean success; - hr = inputPane->TryHide(&success); - if (FAILED(hr)) - qErrnoWarning(hr, "Failed to hide input panel."); + QEventDispatcherWinRT::runOnXamlThread([&inputPane]() { + HRESULT hr; + boolean success; + hr = inputPane->TryHide(&success); + if (FAILED(hr) || !success) + qErrnoWarning(hr, "Failed to hide input panel."); + return hr; + }); } #endif // Q_OS_WINPHONE -- 2.34.1