diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-30 09:22:29 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-30 09:22:29 (GMT) |
commit | 096474565f9683515dddb7175bb64a77d9f805f2 (patch) | |
tree | a0112308f19f67fae0e75fe050ef195b6e252bef | |
parent | 6940070adb45d67a0a9186205a4914a0a6c14135 (diff) | |
parent | 2665a992c56b902d098818e192e11164d9bf4e01 (diff) | |
download | Qt-096474565f9683515dddb7175bb64a77d9f805f2.zip Qt-096474565f9683515dddb7175bb64a77d9f805f2.tar.gz Qt-096474565f9683515dddb7175bb64a77d9f805f2.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public:
Removing unused code.
Support 'Text' mode in Symbian specific input methods
Map Symbian touch points to the screen's coordinate system.
Revert "Event dispatcher slow down using delays rather than thread priority"
Fix long menu item texts causing crash
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian.cpp | 127 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_symbian_p.h | 5 | ||||
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qfontengine_s60.cpp | 25 | ||||
-rw-r--r-- | src/gui/text/qfontengine_s60_p.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/qmenu_symbian.cpp | 8 |
7 files changed, 47 insertions, 126 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index fa337ca..8c96057 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -43,6 +43,7 @@ #include <private/qthread_p.h> #include <qcoreapplication.h> #include <private/qcoreapplication_p.h> +#include <qdatetime.h> #include <unistd.h> #include <errno.h> @@ -635,74 +636,6 @@ void QSocketActiveObject::deleteLater() } } -#ifdef QT_SYMBIAN_PRIORITY_DROP -class QIdleDetectorThread -{ -public: - QIdleDetectorThread() - : m_state(STATE_RUN), m_stop(false) - { - qt_symbian_throwIfError(m_lock.CreateLocal()); - TInt err = m_idleDetectorThread.Create(KNullDesC(), &idleDetectorThreadFunc, 1024, &User::Allocator(), this); - if (err != KErrNone) - m_lock.Close(); - qt_symbian_throwIfError(err); - m_idleDetectorThread.SetPriority(EPriorityAbsoluteBackgroundNormal); - m_idleDetectorThread.Resume(); - } - - ~QIdleDetectorThread() - { - // close down the idle thread because if corelib is loaded temporarily, this would leak threads into the host process - m_stop = true; - m_lock.Signal(); - m_idleDetectorThread.SetPriority(EPriorityNormal); - TRequestStatus s; - m_idleDetectorThread.Logon(s); - User::WaitForRequest(s); - m_idleDetectorThread.Close(); - m_lock.Close(); - } - - void kick() - { - m_state = STATE_KICKED; - m_lock.Signal(); - } - - bool hasRun() - { - return m_state == STATE_RUN; - } - -private: - static TInt idleDetectorThreadFunc(TAny* self) - { - static_cast<QIdleDetectorThread*>(self)->IdleLoop(); - return KErrNone; - } - - void IdleLoop() - { - while (!m_stop) { - m_lock.Wait(); - m_state = STATE_RUN; - } - } - -private: - enum IdleStates {STATE_KICKED, STATE_RUN} m_state; - bool m_stop; - RThread m_idleDetectorThread; - RFastLock m_lock; -}; - -Q_GLOBAL_STATIC(QIdleDetectorThread, idleDetectorThread); - -const int maxBusyTime = 2000; // maximum time we allow idle detector to be blocked before worrying, in milliseconds -const int baseDelay = 1000; // minimum delay time used when backing off to allow idling, in microseconds -#endif - QEventDispatcherSymbian::QEventDispatcherSymbian(QObject *parent) : QAbstractEventDispatcher(parent), m_activeScheduler(0), @@ -713,15 +646,11 @@ QEventDispatcherSymbian::QEventDispatcherSymbian(QObject *parent) m_iterationCount(0), m_noSocketEvents(false) { -#ifdef QT_SYMBIAN_PRIORITY_DROP - m_delay = baseDelay; - m_avgEventTime = 0; - idleDetectorThread(); -#endif } QEventDispatcherSymbian::~QEventDispatcherSymbian() { + m_processHandle.Close(); } void QEventDispatcherSymbian::startingUp() @@ -782,7 +711,23 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla m_interrupt = false; #ifdef QT_SYMBIAN_PRIORITY_DROP - QTime eventTimer; + /* + * This QTime variable is used to measure the time it takes to finish + * the event loop. If we take too long in the loop, other processes + * may be starved and killed. After the first event has completed, we + * take the current time, and if the remaining events take longer than + * a preset time, we temporarily lower the priority to force a context + * switch. For applications that do not take unecessarily long in the + * event loop, the priority will not be altered. + */ + QTime time; + enum { + FirstRun, + SubsequentRun, + TimeStarted + } timeState = FirstRun; + + TProcessPriority priority; #endif while (1) { @@ -798,18 +743,10 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla } #ifdef QT_SYMBIAN_PRIORITY_DROP - if (idleDetectorThread()->hasRun()) { - if (m_delay > baseDelay) - m_delay -= baseDelay; - m_lastIdleRequestTimer.start(); - idleDetectorThread()->kick(); - } else if (m_lastIdleRequestTimer.elapsed() > maxBusyTime) { - User::AfterHighRes(m_delay); - // allow delay to be up to 1/4 of execution time - if (!idleDetectorThread()->hasRun() && m_delay*3 < m_avgEventTime) - m_delay += baseDelay; + if (timeState == SubsequentRun) { + time.start(); + timeState = TimeStarted; } - eventTimer.start(); #endif TInt error; @@ -819,12 +756,6 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla CActiveScheduler::Current()->Error(error); } -#ifdef QT_SYMBIAN_PRIORITY_DROP - int eventDur = eventTimer.elapsed()*1000; - // average is calcualted as a 5% decaying exponential average - m_avgEventTime = (m_avgEventTime * 95 + eventDur * 5) / 100; -#endif - if (!handledSymbianEvent) { qFatal("QEventDispatcherSymbian::processEvents(): Caught Symbian stray signal"); } @@ -833,6 +764,20 @@ bool QEventDispatcherSymbian::processEvents ( QEventLoop::ProcessEventsFlags fla break; } block = false; +#ifdef QT_SYMBIAN_PRIORITY_DROP + if (timeState == TimeStarted && time.elapsed() > 100) { + priority = m_processHandle.Priority(); + m_processHandle.SetPriority(EPriorityBackground); + time.start(); + // Slight chance of race condition in the next lines, but nothing fatal + // will happen, just wrong priority. + if (m_processHandle.Priority() == EPriorityBackground) { + m_processHandle.SetPriority(priority); + } + } + if (timeState == FirstRun) + timeState = SubsequentRun; +#endif }; emit awake(); diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h index 8a9c9a0..1ab31cc 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian_p.h +++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h @@ -62,7 +62,6 @@ #include <qmutex.h> #include <qwaitcondition.h> #include <qsocketnotifier.h> -#include <qdatetime.h> #include <e32base.h> @@ -280,9 +279,7 @@ private: QList<QActiveObject *> m_deferredActiveObjects; - int m_delay; - int m_avgEventTime; - QTime m_lastIdleRequestTimer; + RProcess m_processHandle; }; #ifdef QT_DEBUG diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index b42e0ab..610ac3c 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -87,7 +87,7 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_fepState->SetDefaultInputMode( EAknEditorTextInputMode ); m_fepState->SetPermittedInputModes( EAknEditorAllInputModes ); m_fepState->SetDefaultCase( EAknEditorLowerCase ); - m_fepState->SetPermittedCases( EAknEditorLowerCase|EAknEditorUpperCase ); + m_fepState->SetPermittedCases( EAknEditorAllCaseModes ); m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG); m_fepState->SetNumericKeymap( EAknEditorStandardNumberModeKeymap ); } diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 7087b47..2bd29fc 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -440,7 +440,7 @@ void QSymbianControl::translateAdvancedPointerEvent(const TAdvancedPointerEvent state |= Qt::TouchPointPrimary; touchPoint.setState(state); - QPointF screenPos = QPointF(event->iPosition.iX, event->iPosition.iY); + QPointF screenPos = qwidget->mapToGlobal(QPoint(event->iPosition.iX, event->iPosition.iY)); touchPoint.setScreenPos(screenPos); touchPoint.setNormalizedPos(QPointF(screenPos.x() / screenGeometry.width(), screenPos.y() / screenGeometry.height())); diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index a9960e4..93f02ff 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -59,13 +59,10 @@ QSymbianTypeFaceExtras::QSymbianTypeFaceExtras(CFont* fontOwner, COpenFont *font , m_symbolCMap(false) , m_fontOwner(fontOwner) { - TAny *shapingExtension = NULL; - m_font->ExtendedInterface(KUidOpenFontShapingExtension, shapingExtension); - m_shapingExtension = static_cast<MOpenFontShapingExtension*>(shapingExtension); TAny *trueTypeExtension = NULL; m_font->ExtendedInterface(KUidOpenFontTrueTypeExtension, trueTypeExtension); m_trueTypeExtension = static_cast<MOpenFontTrueTypeExtension*>(trueTypeExtension); - Q_ASSERT(m_shapingExtension && m_trueTypeExtension); + Q_ASSERT(m_trueTypeExtension); } QByteArray QSymbianTypeFaceExtras::getSfntTable(uint tag) const @@ -114,26 +111,6 @@ const unsigned char *QSymbianTypeFaceExtras::cmap() const return m_cmap; } -QPainterPath QSymbianTypeFaceExtras::glyphOutline(glyph_t glyph) const -{ - QPainterPath result; - QPolygonF polygon; - TInt glyphIndex = glyph; - TInt pointNumber = 0; - TInt x, y; - while (m_shapingExtension->GlyphPointInFontUnits(glyphIndex, pointNumber++, x, y)) { - const QPointF point(qreal(x) / 0xffff, qreal(y) / 0xffff); - if (polygon.contains(point)) { - result.addPolygon(polygon); - result.closeSubpath(); - polygon.clear(); - } else { - polygon.append(point); - } - } - return result; -} - CFont *QSymbianTypeFaceExtras::fontOwner() const { return m_fontOwner; diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h index b6b117f..6883730 100644 --- a/src/gui/text/qfontengine_s60_p.h +++ b/src/gui/text/qfontengine_s60_p.h @@ -62,7 +62,7 @@ class CFont; QT_BEGIN_NAMESPACE -// ..gives us access to truetype tables, UTF-16<->GlyphID mapping, and glyph outlines +// ..gives us access to truetype tables class QSymbianTypeFaceExtras { public: @@ -71,12 +71,10 @@ public: QByteArray getSfntTable(uint tag) const; bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; const unsigned char *cmap() const; - QPainterPath glyphOutline(glyph_t glyph) const; CFont *fontOwner() const; private: COpenFont *m_font; - const MOpenFontShapingExtension *m_shapingExtension; mutable MOpenFontTrueTypeExtension *m_trueTypeExtension; mutable const unsigned char *m_cmap; mutable bool m_symbolCMap; diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index 7224768..d4b1250 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -149,8 +149,12 @@ static void qt_symbian_insert_action(QSymbianMenuAction* action, QList<SymbianMe "Too many menu actions"); const int underlineShortCut = QApplication::style()->styleHint(QStyle::SH_UnderlineShortcut); - QString iconText = action->action->iconText(); - TPtrC menuItemText = qt_QString2TPtrC( underlineShortCut ? action->action->text() : iconText); + QString actionText; + if (underlineShortCut) + actionText = action->action->text().left(CEikMenuPaneItem::SData::ENominalTextLength); + else + actionText = action->action->iconText().left(CEikMenuPaneItem::SData::ENominalTextLength); + TPtrC menuItemText = qt_QString2TPtrC(actionText); if (action->action->menu()) { SymbianMenuItem* menuItem = new SymbianMenuItem(); menuItem->menuItemData.iCascadeId = action->command; |