summaryrefslogtreecommitdiffstats
path: root/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-07-13 12:04:19 +0200
committeraxis <qt-info@nokia.com>2009-07-13 12:08:42 +0200
commit89e606a5663cc33bf0ee29e74dcc41459320344e (patch)
treed143beee0d3848111b7c341a0bc550c9180daeb0 /src/gui/inputmethod/qcoefepinputcontext_s60.cpp
parent77f82a242e33277290020f6e5c884b6197d73159 (diff)
Fixed a bug where the input panel would not show up.
Task: 257214 The problem happened if a user called setFocus() on an input capable widget, and then tried to open the input panel by sending an event. Since the call to InputCapabilitiesChanged is asynchronous, Symbian would not yet know about the updated state, and the event would be lost. Now we generate our own asynchronous event, and ensure that it is synchronous in the cases where it's needed.
Diffstat (limited to 'src/gui/inputmethod/qcoefepinputcontext_s60.cpp')
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index 87f57e90a7..c03426f787 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -65,6 +65,7 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent)
m_textCapabilities(TCoeInputCapabilities::EAllText),
m_isEditing(false),
m_inDestruction(false),
+ m_pendingInputCapabilitiesChanged(false),
m_cursorVisibility(1),
m_inlinePosition(0),
m_formatRetriever(0),
@@ -269,6 +270,7 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event)
sControl->setIgnoreFocusChanged(true);
}
+ ensureInputCapabilitiesChanged();
m_fepState->ReportAknEdStateEventL(MAknEdStateObserver::QT_EAknActivatePenInputRequest);
if (sControl) {
@@ -331,7 +333,7 @@ void QCoeFepInputContext::updateHints(bool mustUpdateInputCapabilities)
return;
}
}
- CCoeEnv::Static()->InputCapabilitiesChanged();
+ queueInputCapabilitiesChanged();
}
void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints)
@@ -484,6 +486,30 @@ void QCoeFepInputContext::applyFormat(QList<QInputMethodEvent::Attribute> *attri
}
}
+void QCoeFepInputContext::queueInputCapabilitiesChanged()
+{
+ if (m_pendingInputCapabilitiesChanged)
+ return;
+
+ // Call ensureInputCapabilitiesChanged asynchronously. This is done to improve performance
+ // by not updating input capabilities too often. The reason we don't call the Symbian
+ // asynchronous version of InputCapabilitiesChanged is because we need to ensure that it
+ // is synchronous in some specific cases. Those will call ensureInputCapabilitesChanged.
+ QMetaObject::invokeMethod(this, "ensureInputCapabilitiesChanged", Qt::QueuedConnection);
+ m_pendingInputCapabilitiesChanged = true;
+}
+
+void QCoeFepInputContext::ensureInputCapabilitiesChanged()
+{
+ if (!m_pendingInputCapabilitiesChanged)
+ return;
+
+ // The call below is essentially equivalent to InputCapabilitiesChanged(),
+ // but is synchronous, rather than asynchronous.
+ CCoeEnv::Static()->SyncNotifyFocusObserversOfChangeInFocus();
+ m_pendingInputCapabilitiesChanged = false;
+}
+
void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText,
TInt aPositionOfInsertionPointInInlineText, TBool aCursorVisibility, const MFormCustomDraw* /*aCustomDraw*/,
MFepInlineTextFormatRetriever& aInlineTextFormatRetriever,