summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qglobal.cpp25
-rw-r--r--src/corelib/global/qglobal.h2
-rw-r--r--src/corelib/global/qnamespace.h5
3 files changed, 25 insertions, 7 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 5a7b559..7d47944 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -2479,7 +2479,7 @@ bool qputenv(const char *varName, const QByteArray& value)
#endif
}
-#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN)
+#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN)
# if defined(Q_OS_INTEGRITY) && defined(__GHS_VERSION_NUMBER) && (__GHS_VERSION_NUMBER < 500)
// older versions of INTEGRITY used a long instead of a uint for the seed.
@@ -2535,20 +2535,35 @@ void qsrand(uint seed)
*/
void qsrand()
{
-#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN)
+#if (defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN)
SeedStorageType *pseed = randTLS()->localData();
if (pseed) {
// already seeded
return;
}
randTLS()->setLocalData(pseed = new SeedStorageType);
- static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(0);
+ // start beyond 1 to avoid the sequence reset
+ static QBasicAtomicInt serial = Q_BASIC_ATOMIC_INITIALIZER(2);
*pseed = QDateTime::currentDateTime().toTime_t()
+ quintptr(&pseed)
+ serial.fetchAndAddRelaxed(1);
-#else
- // On Windows, we assume that rand() already does the right thing
+#if defined(Q_OS_WIN)
+ // for Windows the srand function must still be called.
+ srand(*pseed);
#endif
+
+#elif defined(Q_OS_WIN)
+ static unsigned int seed = 0;
+
+ if (seed)
+ return;
+
+ seed = GetTickCount();
+ srand(seed);
+#else
+ // Symbian?
+
+#endif // defined(Q_OS_UNIX) || defined(Q_OS_WIN)) && !defined(QT_NO_THREAD) && !defined(Q_OS_SYMBIAN)
}
/*!
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index df17546..5ee1815 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -466,7 +466,7 @@ namespace QT_NAMESPACE {}
# define Q_NO_USING_KEYWORD
# define QT_NO_STL_WCHAR
# endif
-# if __GNUC__ >= 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
# define Q_ALIGNOF(type) __alignof__(type)
# define Q_TYPEOF(expr) __typeof__(expr)
# define Q_DECL_ALIGN(n) __attribute__((__aligned__(n)))
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index f28f94e..2b62c6b 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -1631,7 +1631,10 @@ public:
enum GestureContext
{
WidgetGesture = 0,
- WidgetWithChildrenGesture = 3
+ WidgetWithChildrenGesture = 3,
+
+ ItemGesture = WidgetGesture,
+ ItemWithChildrenGesture = WidgetWithChildrenGesture
};
enum NavigationMode