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>
This commit is contained in:
Andrew Knight 2015-08-23 23:51:26 +03:00
parent b626a5859a
commit 5c95c2077c

View File

@ -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