diff options
author | Andrew Knight <andrew.knight@intopalo.com> | 2015-08-23 23:51:26 +0300 |
---|---|---|
committer | Andrew Knight <andrew.knight@intopalo.com> | 2015-08-24 07:02:58 +0000 |
commit | 5c95c2077ce480a2a0192babbe5efe1e23731633 (patch) | |
tree | 7d9ed8cda9ebc913351cf6a2beaa62afbff22e2d /src/plugins/platforms/winrt | |
parent | b626a5859abef9a1b47ba02ffab0fd8d08f79a21 (diff) |
winphone: Fix keyboard show/hide calls
These need to occur on the XAML thread.
Change-Id: Id42a37df95b09e6d3c0a1b6e593bbf8cbfe5a129
Reviewed-by: Samuel Nevala <samuel.nevala@intopalo.com>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/winrt')
-rw-r--r-- | src/plugins/platforms/winrt/qwinrtinputcontext.cpp | 26 |
1 files 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 <QtGui/QWindow> +#include <private/qeventdispatcher_winrt_p.h> +#include <functional> #include <wrl.h> #include <roapi.h> #include <windows.ui.viewmanagement.h> @@ -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 |