From 23972064c554163e4bdb6de0fe6eaa0d41a6ad6a Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 8 Apr 2009 13:29:07 +0200 Subject: Made the S60 FEP use the new RequestSoftwareInputPanel events. RevBy: Trustme --- src/gui/inputmethod/qcoefepinputcontext_p.h | 1 - src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 49 +++++++++---------------- 2 files changed, 18 insertions(+), 32 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index 7f0a482..e4357c2 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -102,7 +102,6 @@ private: bool m_inDestruction; int m_cursorVisibility; int m_inlinePosition; - QPoint m_mousePressPos; MFepInlineTextFormatRetriever *m_formatRetriever; MFepPointerEventHandlerDuringInlineEdit *m_pointerHandler; }; diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index b9ea4c7..5bf4259 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -208,39 +208,26 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) return false; } - if (event->type() == QEvent::MouseButtonPress) { - const QMouseEvent *mEvent = static_cast(event); - m_mousePressPos = mEvent->globalPos(); - } else if (event->type() == QEvent::MouseButtonRelease) { + if (event->type() == QEvent::RequestSoftwareInputPanel) { // Notify S60 that we want the virtual keyboard to show up. - const QMouseEvent *mEvent = static_cast(event); - - if (mEvent->modifiers() == Qt::NoModifier - && mEvent->button() == Qt::LeftButton - && focusWidget() // Not set if prior MouseButtonPress was not on this widget - && focusWidget()->rect().contains(focusWidget()->mapFromGlobal(mEvent->globalPos())) - && (m_mousePressPos - mEvent->globalPos()).manhattanLength() < QApplication::startDragDistance()) { - - QSymbianControl *sControl; - sControl = focusWidget()->effectiveWinId()->MopGetObject(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); - } - - m_fepState->ReportAknEdStateEventL(MAknEdStateObserver::QT_EAknActivatePenInputRequest); - - if (sControl) { - sControl->setIgnoreFocusChanged(false); - } - - // Although it is tempting to let the click through by returning false, we have to return - // true because the event might have caused focus switches, which may in turn delete - // widgets. - return true; + QSymbianControl *sControl; + Q_ASSERT(focusWidget()); + 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); + } + + m_fepState->ReportAknEdStateEventL(MAknEdStateObserver::QT_EAknActivatePenInputRequest); + + if (sControl) { + sControl->setIgnoreFocusChanged(false); } + return true; } return false; -- cgit v0.12