summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-07-13 10:04:19 (GMT)
committeraxis <qt-info@nokia.com>2009-07-13 10:08:42 (GMT)
commit89e606a5663cc33bf0ee29e74dcc41459320344e (patch)
treed143beee0d3848111b7c341a0bc550c9180daeb0 /src
parent77f82a242e33277290020f6e5c884b6197d73159 (diff)
downloadQt-89e606a5663cc33bf0ee29e74dcc41459320344e.zip
Qt-89e606a5663cc33bf0ee29e74dcc41459320344e.tar.gz
Qt-89e606a5663cc33bf0ee29e74dcc41459320344e.tar.bz2
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')
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_p.h5
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp28
2 files changed, 32 insertions, 1 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h
index 7d20d24..d754763 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_p.h
+++ b/src/gui/inputmethod/qcoefepinputcontext_p.h
@@ -96,6 +96,10 @@ private:
void updateHints(bool mustUpdateInputCapabilities);
void applyHints(Qt::InputMethodHints hints);
void applyFormat(QList<QInputMethodEvent::Attribute> *attributes);
+ void queueInputCapabilitiesChanged();
+
+private Q_SLOTS:
+ void ensureInputCapabilitiesChanged();
// From MCoeFepAwareTextEditor
public:
@@ -135,6 +139,7 @@ private:
TUint m_textCapabilities;
bool m_isEditing;
bool m_inDestruction;
+ bool m_pendingInputCapabilitiesChanged;
int m_cursorVisibility;
int m_inlinePosition;
MFepInlineTextFormatRetriever *m_formatRetriever;
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index 87f57e9..c03426f 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,