WinRT: Fix InputPanel on Windows 10
Check for MSVC2015 to enable usage of IInputPane(2). Move object construction to the XAML Thread, otherwise instantiation will fail when running on desktop. Task-number: QTBUG-44494 Change-Id: I816230cc5b0def796e86e6c6bb05a552a4e59d1b Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
This commit is contained in:
parent
70b229d996
commit
fb049254c8
@ -131,7 +131,7 @@ HRESULT QWinRTInputContext::handleVisibilityChange(IInputPane *pane)
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WINPHONE
|
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
|
||||||
|
|
||||||
static HRESULT getInputPane(ComPtr<IInputPane2> *inputPane2)
|
static HRESULT getInputPane(ComPtr<IInputPane2> *inputPane2)
|
||||||
{
|
{
|
||||||
@ -160,13 +160,11 @@ static HRESULT getInputPane(ComPtr<IInputPane2> *inputPane2)
|
|||||||
|
|
||||||
void QWinRTInputContext::showInputPanel()
|
void QWinRTInputContext::showInputPanel()
|
||||||
{
|
{
|
||||||
|
QEventDispatcherWinRT::runOnXamlThread([&]() {
|
||||||
ComPtr<IInputPane2> inputPane;
|
ComPtr<IInputPane2> inputPane;
|
||||||
HRESULT hr = getInputPane(&inputPane);
|
HRESULT hr = getInputPane(&inputPane);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return;
|
return hr;
|
||||||
|
|
||||||
QEventDispatcherWinRT::runOnXamlThread([&inputPane]() {
|
|
||||||
HRESULT hr;
|
|
||||||
boolean success;
|
boolean success;
|
||||||
hr = inputPane->TryShow(&success);
|
hr = inputPane->TryShow(&success);
|
||||||
if (FAILED(hr) || !success)
|
if (FAILED(hr) || !success)
|
||||||
@ -177,13 +175,11 @@ void QWinRTInputContext::showInputPanel()
|
|||||||
|
|
||||||
void QWinRTInputContext::hideInputPanel()
|
void QWinRTInputContext::hideInputPanel()
|
||||||
{
|
{
|
||||||
|
QEventDispatcherWinRT::runOnXamlThread([&]() {
|
||||||
ComPtr<IInputPane2> inputPane;
|
ComPtr<IInputPane2> inputPane;
|
||||||
HRESULT hr = getInputPane(&inputPane);
|
HRESULT hr = getInputPane(&inputPane);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return;
|
return hr;
|
||||||
|
|
||||||
QEventDispatcherWinRT::runOnXamlThread([&inputPane]() {
|
|
||||||
HRESULT hr;
|
|
||||||
boolean success;
|
boolean success;
|
||||||
hr = inputPane->TryHide(&success);
|
hr = inputPane->TryHide(&success);
|
||||||
if (FAILED(hr) || !success)
|
if (FAILED(hr) || !success)
|
||||||
@ -192,6 +188,6 @@ void QWinRTInputContext::hideInputPanel()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // Q_OS_WINPHONE
|
#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -68,7 +68,7 @@ public:
|
|||||||
|
|
||||||
bool isInputPanelVisible() const;
|
bool isInputPanelVisible() const;
|
||||||
|
|
||||||
#ifdef Q_OS_WINPHONE
|
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
|
||||||
void showInputPanel();
|
void showInputPanel();
|
||||||
void hideInputPanel();
|
void hideInputPanel();
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user