diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2011-06-30 12:16:10 (GMT) |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2011-06-30 13:43:20 (GMT) |
commit | 7168aebb1b452b6f22a35be5ae31ccdc3e3e23df (patch) | |
tree | 93d10514744b0b05f9fa7187e194d3bdbf02e90a /src/gui/inputmethod | |
parent | 2b6cf174153c6a680bac94eb666a131a3aad3891 (diff) | |
download | Qt-7168aebb1b452b6f22a35be5ae31ccdc3e3e23df.zip Qt-7168aebb1b452b6f22a35be5ae31ccdc3e3e23df.tar.gz Qt-7168aebb1b452b6f22a35be5ae31ccdc3e3e23df.tar.bz2 |
Do not try to open VKB if it is already open in Symbian
If QEvent::RequestSoftwareInputPanel was handled when there was already
an active virtual keyboard that had a child dialog open such as symbol
or writing language selection dialog, the VKB would be brought to
foreground on top of the child dialog, causing several problems, such
as options menu and letter keys no longer working in VKB.
Fixed by checking if VKB is already open before opening it again.
Task-number: QT-5133
Reviewed-by: Sami Merila
Diffstat (limited to 'src/gui/inputmethod')
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index aa87955..602c734 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -54,6 +54,7 @@ #include <fepitfr.h> #include <hal.h> +#include <e32property.h> #include <limits.h> // You only find these enumerations on SDK 5 onwards, so we need to provide our own @@ -72,6 +73,10 @@ // EAknEditorFlagEnablePartialScreen is only valid from Sym^3 onwards. #define QT_EAknEditorFlagEnablePartialScreen 0x200000 +// Properties to detect VKB status from AknFepInternalPSKeys.h +#define QT_EPSUidAknFep 0x100056de +#define QT_EAknFepTouchInputActive 0x00000004 + QT_BEGIN_NAMESPACE Q_GUI_EXPORT void qt_s60_setPartialScreenInputMode(bool enable) @@ -307,28 +312,46 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) return false; if (event->type() == QEvent::RequestSoftwareInputPanel) { - // Notify S60 that we want the virtual keyboard to show up. - QSymbianControl *sControl; - sControl = focusWidget()->effectiveWinId()->MopGetObject(sControl); - Q_ASSERT(sControl); - - // The FEP UI temporarily steals focus when it shows up the first time, causing - // all sorts of weird effects on the focused widgets. Since it will immediately give - // back focus to us, we temporarily disable focus handling until the job's done. - if (sControl) { - sControl->setIgnoreFocusChanged(true); + // Only request virtual keyboard if it is not yet active or if this is the first time + // panel is requested for this application. + static bool firstTime = true; + int vkbActive = 0; + + if (firstTime) { + // Sometimes the global QT_EAknFepTouchInputActive value can be left incorrect at + // application exit if the application is exited when input panel is active. + // Therefore we always want to open the panel the first time application requests it. + firstTime = false; + } else { + const TUid KPSUidAknFep = {QT_EPSUidAknFep}; + // No need to check for return value, as vkbActive stays zero in that case + RProperty::Get(KPSUidAknFep, QT_EAknFepTouchInputActive, vkbActive); } - ensureInputCapabilitiesChanged(); - m_fepState->ReportAknEdStateEventL(MAknEdStateObserver::QT_EAknActivatePenInputRequest); + if (!vkbActive) { + // Notify S60 that we want the virtual keyboard to show up. + QSymbianControl *sControl; + sControl = focusWidget()->effectiveWinId()->MopGetObject(sControl); + Q_ASSERT(sControl); + + // The FEP UI temporarily steals focus when it shows up the first time, causing + // all sorts of weird effects on the focused widgets. Since it will immediately give + // back focus to us, we temporarily disable focus handling until the job's done. + if (sControl) { + sControl->setIgnoreFocusChanged(true); + } + + ensureInputCapabilitiesChanged(); + m_fepState->ReportAknEdStateEventL(MAknEdStateObserver::QT_EAknActivatePenInputRequest); - if (sControl) { - sControl->setIgnoreFocusChanged(false); + if (sControl) { + sControl->setIgnoreFocusChanged(false); + } + //If m_pointerHandler has already been set, it means that fep inline editing is in progress. + //When this is happening, do not filter out pointer events. + if (!m_pointerHandler) + return true; } - //If m_pointerHandler has already been set, it means that fep inline editing is in progress. - //When this is happening, do not filter out pointer events. - if (!m_pointerHandler) - return true; } return false; |