From 63b4e11ca2e7211e2a444de54eff3a3e233d64ce Mon Sep 17 00:00:00 2001 From: Casper van Donderen Date: Thu, 14 Jul 2011 11:11:03 +0200 Subject: Documentation fix. Fixes: QTBUG-20390 --- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 7014571..3fd4fcd 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -560,13 +560,11 @@ QRect QDeclarativeTextInput::cursorRectangle() const \qmlproperty int TextInput::selectionStart The cursor position before the first character in the current selection. - Setting this and selectionEnd allows you to specify a selection in the - text edit. - Note that if selectionStart == selectionEnd then there is no current - selection. + This property is read-only. To change the selection, use select(start,end), + selectAll(), or selectWord(). - \sa selectionEnd, cursorPosition, selectedText, select() + \sa selectionEnd, cursorPosition, selectedText */ int QDeclarativeTextInput::selectionStart() const { @@ -578,13 +576,11 @@ int QDeclarativeTextInput::selectionStart() const \qmlproperty int TextInput::selectionEnd The cursor position after the last character in the current selection. - Setting this and selectionStart allows you to specify a selection in the - text edit. - Note that if selectionStart == selectionEnd then there is no current - selection. + This property is read-only. To change the selection, use select(start,end), + selectAll(), or selectWord(). - \sa selectionStart, cursorPosition, selectedText, select() + \sa selectionStart, cursorPosition, selectedText */ int QDeclarativeTextInput::selectionEnd() const { -- cgit v0.12 From 90dac1e856e4d3648ce19ae6b356f9aeb090af49 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Thu, 14 Jul 2011 14:49:55 +0200 Subject: sync qws_dataDir() with coreapp's internal qws_dataDir() Merge-request: 1295 Reviewed-by: Harald Fernengel --- tools/qvfb/qvfbshmem.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/tools/qvfb/qvfbshmem.cpp b/tools/qvfb/qvfbshmem.cpp index a03b25d..b05b69c 100644 --- a/tools/qvfb/qvfbshmem.cpp +++ b/tools/qvfb/qvfbshmem.cpp @@ -69,27 +69,40 @@ QT_BEGIN_NAMESPACE // live. static QString qws_dataDir(int qws_display_id) { - QByteArray dataDir = QT_VFB_DATADIR(qws_display_id).toLocal8Bit(); - if (mkdir(dataDir, 0700)) { + static QString result; + if (!result.isEmpty()) + return result; + result = QT_VFB_DATADIR(qws_display_id); + QByteArray dataDir = result.toLocal8Bit(); + +#if defined(Q_OS_INTEGRITY) + /* ensure filesystem is ready before starting requests */ + WaitForFileSystemInitialization(); +#endif + + if (QT_MKDIR(dataDir, 0700)) { if (errno != EEXIST) { qFatal("Cannot create Qt for Embedded Linux data directory: %s", dataDir.constData()); } } - struct stat buf; - if (lstat(dataDir, &buf)) + QT_STATBUF buf; + if (QT_LSTAT(dataDir, &buf)) qFatal("stat failed for Qt for Embedded Linux data directory: %s", dataDir.constData()); if (!S_ISDIR(buf.st_mode)) qFatal("%s is not a directory", dataDir.constData()); + +#if !defined(Q_OS_INTEGRITY) && !defined(Q_OS_VXWORKS) && !defined(Q_OS_QNX) if (buf.st_uid != getuid()) qFatal("Qt for Embedded Linux data directory is not owned by user %uh", getuid()); if ((buf.st_mode & 0677) != 0600) qFatal("Qt for Embedded Linux data directory has incorrect permissions: %s", dataDir.constData()); - dataDir += "/"; +#endif - return QString(dataDir); + result.append(QLatin1Char('/')); + return result; } -- cgit v0.12 From 1093d3363df4260cc738ccc1649d710414f07cb3 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Thu, 14 Jul 2011 14:49:56 +0200 Subject: get rid of unwanted dependencies and unused header includes Merge-request: 1295 Reviewed-by: Harald Fernengel --- tools/qvfb/qvfbmmap.cpp | 2 -- tools/qvfb/qvfbshmem.cpp | 25 ++++++------------------- tools/qvfb/qvfbview.cpp | 5 ----- 3 files changed, 6 insertions(+), 26 deletions(-) diff --git a/tools/qvfb/qvfbmmap.cpp b/tools/qvfb/qvfbmmap.cpp index 7e80e37..01c1d9c 100644 --- a/tools/qvfb/qvfbmmap.cpp +++ b/tools/qvfb/qvfbmmap.cpp @@ -48,9 +48,7 @@ #include #include #include -#include #include -#include #include #include #include diff --git a/tools/qvfb/qvfbshmem.cpp b/tools/qvfb/qvfbshmem.cpp index b05b69c..c17a680 100644 --- a/tools/qvfb/qvfbshmem.cpp +++ b/tools/qvfb/qvfbshmem.cpp @@ -39,10 +39,9 @@ ** ****************************************************************************/ -#include "qlock_p.h" - #include "qvfbshmem.h" -#include "qvfbhdr.h" +#include +#include #include #include @@ -53,8 +52,6 @@ #include #include #include -#include -#include #include #include #include @@ -143,20 +140,10 @@ QShMemViewProtocol::QShMemViewProtocol(int displayid, const QSize &s, qws_dataDir(displayid); - QString oldPipe = "/tmp/qtembedded-" + username + "/" + QString("QtEmbedded-%1").arg(displayid); - int oldPipeSemkey = ftok(oldPipe.toLatin1().constData(), 'd'); - if (oldPipeSemkey != -1) { - int oldPipeLockId = semget(oldPipeSemkey, 0, 0); - if (oldPipeLockId >= 0){ - sembuf sops; - sops.sem_num = 0; - sops.sem_op = 1; - sops.sem_flg = SEM_UNDO; - int rv; - do { - rv = semop(lockId,&sops,1); - } while (rv == -1 && errno == EINTR); - + { + QString oldPipe = "/tmp/qtembedded-" + username + "/" + QString("QtEmbedded-%1").arg(displayid); + QLock oldPipeLock(oldPipe, 'd', false); + if (oldPipeLock.isValid()) { perror("QShMemViewProtocol::QShMemViewProtocol"); qFatal("Cannot create lock file as an old version of QVFb has " "opened %s. Close other QVFb and try again", diff --git a/tools/qvfb/qvfbview.cpp b/tools/qvfb/qvfbview.cpp index 3f13ecc..91c5380 100644 --- a/tools/qvfb/qvfbview.cpp +++ b/tools/qvfb/qvfbview.cpp @@ -61,12 +61,7 @@ #include #include -#include #include -#include -#include -#include -#include #include #include -- cgit v0.12 From c1788c07deaf4effb5e7c2d2564e7077b9ddcf95 Mon Sep 17 00:00:00 2001 From: Ritt Konstantin Date: Thu, 14 Jul 2011 14:49:58 +0200 Subject: fix build both QLock and QWSSignalHandler are imported and must not be compiled-in as this breaks the build process due to unresolved dependencies inside QWSSignalHandler QTBUG: 20236 Merge-request: 1295 Reviewed-by: Harald Fernengel --- tools/qvfb/qvfb.pro | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/tools/qvfb/qvfb.pro b/tools/qvfb/qvfb.pro index c101d00..29ce202 100644 --- a/tools/qvfb/qvfb.pro +++ b/tools/qvfb/qvfb.pro @@ -8,9 +8,6 @@ DESTDIR = ../../bin target.path=$$[QT_INSTALL_BINS] INSTALLS += target -DEPENDPATH = ../../include -INCLUDEPATH += ../../src/gui/embedded - FORMS = config.ui HEADERS = qvfb.h \ qvfbview.h \ @@ -19,10 +16,7 @@ HEADERS = qvfb.h \ gammaview.h \ qvfbprotocol.h \ qvfbshmem.h \ - qvfbmmap.h \ - ../../src/gui/embedded/qvfbhdr.h \ - ../../src/gui/embedded/qlock_p.h \ - ../../src/gui/embedded/qwssignalhandler_p.h + qvfbmmap.h SOURCES = qvfb.cpp \ qvfbview.cpp \ @@ -31,9 +25,7 @@ SOURCES = qvfb.cpp \ qanimationwriter.cpp \ qvfbprotocol.cpp \ qvfbshmem.cpp \ - qvfbmmap.cpp \ - ../../src/gui/embedded/qlock.cpp \ - ../../src/gui/embedded/qwssignalhandler.cpp + qvfbmmap.cpp include(../shared/deviceskin/deviceskin.pri) -- cgit v0.12 From d4f7cc91cdaee88db35fd74666d631d44c8dd4b7 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 14 Jul 2011 17:55:45 +0200 Subject: namespace fix Reviewed-by: hjk --- src/corelib/tools/qelapsedtimer_win.cpp | 6 +++--- src/gui/text/qfontdatabase.cpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/corelib/tools/qelapsedtimer_win.cpp b/src/corelib/tools/qelapsedtimer_win.cpp index cd076a6..d79dc5d 100644 --- a/src/corelib/tools/qelapsedtimer_win.cpp +++ b/src/corelib/tools/qelapsedtimer_win.cpp @@ -42,14 +42,14 @@ #include "qelapsedtimer.h" #include -// Result of QueryPerformanceFrequency, 0 indicates that the high resolution timer is unavailable -static quint64 counterFrequency = 0; - typedef ULONGLONG (WINAPI *PtrGetTickCount64)(void); static PtrGetTickCount64 ptrGetTickCount64 = 0; QT_BEGIN_NAMESPACE +// Result of QueryPerformanceFrequency, 0 indicates that the high resolution timer is unavailable +static quint64 counterFrequency = 0; + static void resolveLibs() { static bool done = false; diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 3762f39..26d9f2c 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -1130,13 +1130,14 @@ QT_BEGIN_INCLUDE_NAMESPACE #elif defined(Q_OS_SYMBIAN) # include "qfontdatabase_s60.cpp" #endif +QT_END_INCLUDE_NAMESPACE + #if !defined(Q_WS_X11) QString QFontDatabase::resolveFontFamilyAlias(const QString &family) { return family; } #endif -QT_END_INCLUDE_NAMESPACE static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey, const QString &styleName = QString()) -- cgit v0.12 From b66db48934bc13cc7439e0fc9c8ec54122678a02 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 14 Jul 2011 14:43:44 +0200 Subject: Fix the timeout calculation for futexes in QMutex. Recalculate how much time is remaining. This commit needs to be backported to 4.8. Change-Id: Ib587335bb90306e65969bb26256fb388f8f6bd24 Merge-request: 20 Reviewed-by: Olivier Goffart Reviewed-on: http://codereview.qt.nokia.com/1666 Reviewed-by: Qt Sanity Bot (cherry picked from commit 412ef92162f8874a1585221125c31ef5f8ccc9cb) --- src/corelib/thread/qmutex_unix.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/corelib/thread/qmutex_unix.cpp b/src/corelib/thread/qmutex_unix.cpp index 12bc795..e692e19 100644 --- a/src/corelib/thread/qmutex_unix.cpp +++ b/src/corelib/thread/qmutex_unix.cpp @@ -60,6 +60,7 @@ # include # include # include +# include #endif QT_BEGIN_NAMESPACE @@ -138,16 +139,31 @@ static inline int _q_futex(volatile int *addr, int op, int val, const struct tim bool QMutexPrivate::wait(int timeout) { + struct timespec ts, *pts = 0; + QElapsedTimer timer; + if (timeout >= 0) { + ts.tv_nsec = ((timeout % 1000) * 1000) * 1000; + ts.tv_sec = (timeout / 1000); + pts = &ts; + timer.start(); + } while (contenders.fetchAndStoreAcquire(2) > 0) { - struct timespec ts, *pts = 0; - if (timeout >= 0) { - ts.tv_nsec = ((timeout % 1000) * 1000) * 1000; - ts.tv_sec = (timeout / 1000); - pts = &ts; - } int r = _q_futex(&contenders._q_value, FUTEX_WAIT, 2, pts, 0, 0); if (r != 0 && errno == ETIMEDOUT) return false; + + if (pts) { + // recalculate the timeout + qint64 xtimeout = timeout * 1000 * 1000; + xtimeout -= timer.nsecsElapsed(); + if (xtimeout < 0) { + // timer expired after we returned + return false; + } + + ts.tv_sec = timeout / Q_INT64_C(1000) / 1000 / 1000; + ts.tv_nsec = timeout % (Q_INT64_C(1000) * 1000 * 1000); + } } return true; } -- cgit v0.12