diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2009-12-11 09:35:28 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2009-12-11 09:35:28 (GMT) |
commit | 3b544e59d30a5cfb3953e75bf72477b3c3d60bb1 (patch) | |
tree | 6a5bb0a7747ae33030fc3827e250c1ce04552e50 /src/corelib | |
parent | d99a9ffed96ac26ddada3eeb61c44e6ff8b93895 (diff) | |
parent | b6352d487491e4d25db8a008de75280a666b0fce (diff) | |
download | Qt-3b544e59d30a5cfb3953e75bf72477b3c3d60bb1.zip Qt-3b544e59d30a5cfb3953e75bf72477b3c3d60bb1.tar.gz Qt-3b544e59d30a5cfb3953e75bf72477b3c3d60bb1.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win.cpp | 16 | ||||
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 5 | ||||
-rw-r--r-- | src/corelib/tools/qbytearray.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qhash.cpp | 5 | ||||
-rw-r--r-- | src/corelib/tools/qhash.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qlinkedlist.cpp | 5 | ||||
-rw-r--r-- | src/corelib/tools/qlinkedlist.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qlist.cpp | 5 | ||||
-rw-r--r-- | src/corelib/tools/qlist.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qmap.cpp | 5 | ||||
-rw-r--r-- | src/corelib/tools/qmap.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 7 | ||||
-rw-r--r-- | src/corelib/tools/qstring.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qvector.cpp | 5 | ||||
-rw-r--r-- | src/corelib/tools/qvector.h | 1 |
15 files changed, 54 insertions, 6 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index c6eef5e..105cf28 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -341,6 +341,7 @@ public: // for controlling when to send posted events QAtomicInt serialNumber; int lastSerialNumber; + int lastMessageTime; QAtomicInt wakeUps; // timers @@ -364,7 +365,8 @@ public: }; QEventDispatcherWin32Private::QEventDispatcherWin32Private() - : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), getMessageHook(0), serialNumber(0), lastSerialNumber(0), wakeUps(0) + : threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), getMessageHook(0), + serialNumber(0), lastSerialNumber(0), lastMessageTime(0), wakeUps(0) { resolveTimerAPI(); } @@ -479,6 +481,7 @@ LRESULT CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) int localSerialNumber = d->serialNumber; if (localSerialNumber != d->lastSerialNumber) { d->lastSerialNumber = localSerialNumber; + d->lastMessageTime = GetMessageTime(); QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData); } return 0; @@ -495,9 +498,10 @@ LRESULT CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp) if (q) { QEventDispatcherWin32Private *d = q->d_func(); int localSerialNumber = d->serialNumber; - if (HIWORD(GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER)) == 0) { - // no more input or timer events in the message queue, we can allow posted events to be - // sent now + if (HIWORD(GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER)) == 0 + || GetMessageTime() - d->lastMessageTime >= 10) { + // no more input or timer events in the message queue or more than 10ms has elapsed since + // we send posted events, we can allow posted events to be sent now (void) d->wakeUps.fetchAndStoreRelease(0); MSG *msg = (MSG *) lp; if (localSerialNumber != d->lastSerialNumber @@ -732,7 +736,9 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) } if (haveMessage) { if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) { - if (seenWM_QT_SENDPOSTEDEVENTS) { + if (seenWM_QT_SENDPOSTEDEVENTS && !(flags & QEventLoop::EventLoopExec)) { + // when calling processEvents() "manually", we only want to send posted + // events once needWM_QT_SENDPOSTEDEVENTS = true; continue; } diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index bf9b6bd..e43c2b5 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -1048,6 +1048,11 @@ QByteArray &QByteArray::operator=(const char *str) \internal */ +/*! \fn bool QByteArray::isSharedWith(const QByteArray &other) + + \internal +*/ + /*! \fn char QByteArray::at(int i) const Returns the character at index position \a i in the byte array. diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index 7dd6f4f..ba344cb 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -164,6 +164,7 @@ public: inline const char *constData() const; inline void detach(); bool isDetached() const; + inline bool isSharedWith(const QByteArray &other) const { return d == other.d; } void clear(); #ifdef Q_COMPILER_MANGLES_RETURN_TYPE diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index c82c389..a616ac2 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -847,6 +847,11 @@ void QHashData::checkSanity() \internal */ +/*! \fn bool QHash::isSharedWith(const QHash<Key, T> &other) const + + \internal +*/ + /*! \fn void QHash::clear() Removes all items from the hash. diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 2de03dc..66e9cde 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -299,6 +299,7 @@ public: inline void detach() { if (d->ref != 1) detach_helper(); } inline bool isDetached() const { return d->ref == 1; } inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + inline bool isSharedWith(const QHash<Key, T> &other) const { return d == other.d; } void clear(); diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp index 281508e..987e538 100644 --- a/src/corelib/tools/qlinkedlist.cpp +++ b/src/corelib/tools/qlinkedlist.cpp @@ -197,6 +197,11 @@ QLinkedListData QLinkedListData::shared_null = { \internal */ +/*! \fn bool QLinkedList::isSharedWith(const QLinkedList<T> &other) const + + \internal +*/ + /*! \fn bool QLinkedList::isEmpty() const Returns true if the list contains no items; otherwise returns diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h index e119a50..395adf2 100644 --- a/src/corelib/tools/qlinkedlist.h +++ b/src/corelib/tools/qlinkedlist.h @@ -93,6 +93,7 @@ public: { if (d->ref != 1) detach_helper(); } inline bool isDetached() const { return d->ref == 1; } inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + inline bool isSharedWith(const QLinkedList<T> &other) const { return d == other.d; } inline bool isEmpty() const { return d->size == 0; } diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp index 9b20c82..da93d5f 100644 --- a/src/corelib/tools/qlist.cpp +++ b/src/corelib/tools/qlist.cpp @@ -599,6 +599,11 @@ void **QListData::erase(void **xi) \internal */ +/*! \fn bool QList::isSharedWith(const QList<T> &other) const + + \internal +*/ + /*! \fn bool QList::isEmpty() const Returns true if the list contains no items; otherwise returns diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 49b5c0d..e65ee15 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -130,6 +130,7 @@ public: inline bool isDetached() const { return d->ref == 1; } inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + inline bool isSharedWith(const QList<T> &other) const { return d == other.d; } inline bool isEmpty() const { return p.isEmpty(); } diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index 3b48c3f..432b5a5 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -473,6 +473,11 @@ void QMapData::dump() \internal */ +/*! \fn bool QMap::isSharedWith(const QMap<Key, T> &other) const + + \internal +*/ + /*! \fn void QMap::setInsertInOrder(bool sharable) \internal diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 0441107..ce97178 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -182,6 +182,7 @@ public: inline void detach() { if (d->ref != 1) detach_helper(); } inline bool isDetached() const { return d->ref == 1; } inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + inline bool isSharedWith(const QMap<Key, T> &other) const { return d == other.d; } inline void setInsertInOrder(bool ordered) { d->insertInOrder = ordered; } void clear(); diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 33c45c4..f3355df 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -1092,7 +1092,12 @@ QString::QString(QChar ch) \internal */ -/*! \fn void QString::isDetached() const +/*! \fn bool QString::isDetached() const + + \internal +*/ + +/*! \fn bool QString::isSharedWith(const QString &other) const \internal */ diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 668be35..c6fd80a 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -122,6 +122,7 @@ public: inline void detach(); inline bool isDetached() const; + inline bool isSharedWith(const QString &other) const { return d == other.d; } void clear(); inline const QChar at(int i) const; diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index 8bb1074..00d663b 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -392,6 +392,11 @@ int QVectorData::grow(int sizeofTypedData, int size, int sizeofT, bool excessive \internal */ +/*! \fn bool QVector::isSharedWith(const QVector<T> &other) const + + \internal +*/ + /*! \fn T *QVector::data() Returns a pointer to the data stored in the vector. The pointer diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index e00cf3f..043617f 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -134,6 +134,7 @@ public: inline void detach() { if (d->ref != 1) detach_helper(); } inline bool isDetached() const { return d->ref == 1; } inline void setSharable(bool sharable) { if (!sharable) detach(); d->sharable = sharable; } + inline bool isSharedWith(const QVector<T> &other) const { return d == other.d; } inline T *data() { detach(); return p->array; } inline const T *data() const { return p->array; } |