summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaurice Kalinowski <maurice.kalinowski@theqtcompany.com>2015-11-13 15:02:01 +0100
committerMaurice Kalinowski <maurice.kalinowski@theqtcompany.com>2015-11-16 19:44:28 +0000
commit99d061ffd5ea9fc52d96b92cdf3dce93685b4205 (patch)
tree0e3d41cd6a9fab4985f54c573e5592ca28f0efb2
parentd2792d2ed90e1e2789aa80f1667d6e67cd35af66 (diff)
winrt: Do not emit keyboard changes in the constructor
QWinRTInputContext is created from the XAML Thread, which can cause problems when handleVisibilityChange is invoked. Instead just query the keyboardRect and skip the emit. Task-number: QTBUG-49389 Change-Id: I158204a07b9e000adffdc308e68b0f1425ed7c62 Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
-rw-r--r--src/plugins/platforms/winrt/qwinrtinputcontext.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp
index 750233c94f..9d8792a6db 100644
--- a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp
+++ b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp
@@ -54,6 +54,14 @@ typedef ITypedEventHandler<InputPane*, InputPaneVisibilityEventArgs*> InputPaneV
QT_BEGIN_NAMESPACE
+inline QRectF getInputPaneRect(IInputPane *pane, qreal scaleFactor)
+{
+ Rect rect;
+ pane->get_OccludedRect(&rect);
+ return QRectF(qRound(rect.X * scaleFactor), qRound(rect.Y * scaleFactor),
+ qRound(rect.Width * scaleFactor), qRound(rect.Height * scaleFactor));
+}
+
/*!
\class QWinRTInputContext
\brief Manages Input Method visibility
@@ -87,7 +95,7 @@ QWinRTInputContext::QWinRTInputContext(QWinRTScreen *screen)
inputPane->add_Hiding(Callback<InputPaneVisibilityHandler>(
this, &QWinRTInputContext::onHiding).Get(), &hideToken);
- handleVisibilityChange(inputPane);
+ m_keyboardRect = getInputPaneRect(inputPane, m_screen->scaleFactor());
m_isInputPanelVisible = !m_keyboardRect.isEmpty();
} else {
qWarning(Q_FUNC_INFO ": failed to retrieve InputPane.");
@@ -120,10 +128,7 @@ HRESULT QWinRTInputContext::onHiding(IInputPane *pane, IInputPaneVisibilityEvent
HRESULT QWinRTInputContext::handleVisibilityChange(IInputPane *pane)
{
- Rect rect;
- pane->get_OccludedRect(&rect);
- const QRectF keyboardRect = QRectF(qRound(rect.X * m_screen->scaleFactor()), qRound(rect.Y * m_screen->scaleFactor()),
- qRound(rect.Width * m_screen->scaleFactor()), qRound(rect.Height * m_screen->scaleFactor()));
+ const QRectF keyboardRect = getInputPaneRect(pane, m_screen->scaleFactor());
if (m_keyboardRect != keyboardRect) {
m_keyboardRect = keyboardRect;
emitKeyboardRectChanged();