diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-14 23:59:31 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-14 23:59:31 (GMT) |
commit | eaa981c943293bf346a041aa4ad3d254e99ebd78 (patch) | |
tree | 860d47d678f1ff9fb640b1046b8f67cf01df375a /src/gui | |
parent | 7390cfbcbd5000a7da3eb5dbef790d114b06d042 (diff) | |
parent | 3d85883b9e4957f44a870ffb8530acc16882ac01 (diff) | |
download | Qt-eaa981c943293bf346a041aa4ad3d254e99ebd78.zip Qt-eaa981c943293bf346a041aa4ad3d254e99ebd78.tar.gz Qt-eaa981c943293bf346a041aa4ad3d254e99ebd78.tar.bz2 |
Merge branch 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration into 4.7-integration
* 'qt-4.7-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration:
Prospective S60 build fix
Thread safety for QFontEngineS60
Allow to build Qt in static with mingw
Fix incorrect line breaking in QtWebKit.
QLocalSocket: don't emit readChannelFinished() twice on Windows
QLocalSocket/Win: QLocalSocketPrivate::bytesAvailable renamed
QLocalSocket: fix reading from a socket after broken connection
QLocalServer: make many simultaneous connection attempts work on Windows
tst_QLocalSocket::threadedConnection autotest stabilized
tst_qlocalsocket: pro files of client / server examples fixed
Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( d8a9d09376a47b92ea49f1a078c392cbfdbc0ed6 )
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 25 | ||||
-rw-r--r-- | src/gui/kernel/qt_s60_p.h | 26 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase_s60.cpp | 20 | ||||
-rw-r--r-- | src/gui/text/qfontengine_s60.cpp | 2 |
4 files changed, 59 insertions, 14 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index a50fd95..d5d4be6 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -2196,4 +2196,29 @@ void QApplication::restoreOverrideCursor() #endif // QT_NO_CURSOR +QS60ThreadLocalData::QS60ThreadLocalData() +{ + CCoeEnv *env = CCoeEnv::Static(); + if (env) { + //if this is the UI thread, share objects owned by CONE + usingCONEinstances = true; + wsSession = env->WsSession(); + screenDevice = env->ScreenDevice(); + } + else { + usingCONEinstances = false; + qt_symbian_throwIfError(wsSession.Connect(qt_s60GetRFs())); + screenDevice = new CWsScreenDevice(wsSession); + screenDevice->Construct(); + } +} + +QS60ThreadLocalData::~QS60ThreadLocalData() +{ + if (!usingCONEinstances) { + delete screenDevice; + wsSession.Close(); + } +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index fe3fa57..ed53ccf 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -63,6 +63,7 @@ #include "qpointer.h" #include "qapplication.h" #include "qelapsedtimer.h" +#include "QtCore/qthreadstorage.h" #include <w32std.h> #include <coecntrl.h> #include <eikenv.h> @@ -86,10 +87,21 @@ const TInt KInternalStatusPaneChange = 0x50000000; //this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2 #define Q_SYMBIAN_ECOLOR16MAP TDisplayMode(13) +class QS60ThreadLocalData +{ +public: + QS60ThreadLocalData(); + ~QS60ThreadLocalData(); + bool usingCONEinstances; + RWsSession wsSession; + CWsScreenDevice *screenDevice; +}; + class QS60Data { public: QS60Data(); + QThreadStorage<QS60ThreadLocalData *> tls; TUid uid; int screenDepth; QPoint lastCursorPos; @@ -132,9 +144,9 @@ public: int memoryLimitForHwRendering; QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type static inline void updateScreenSize(); - static inline RWsSession& wsSession(); + inline RWsSession& wsSession(); static inline RWindowGroup& windowGroup(); - static inline CWsScreenDevice* screenDevice(); + inline CWsScreenDevice* screenDevice(); static inline CCoeAppUi* appUi(); static inline CEikMenuBar* menuBar(); #ifdef Q_WS_S60 @@ -265,7 +277,10 @@ inline void QS60Data::updateScreenSize() inline RWsSession& QS60Data::wsSession() { - return CCoeEnv::Static()->WsSession(); + if(!tls.hasLocalData()) { + tls.setLocalData(new QS60ThreadLocalData); + } + return tls.localData()->wsSession; } inline RWindowGroup& QS60Data::windowGroup() @@ -275,7 +290,10 @@ inline RWindowGroup& QS60Data::windowGroup() inline CWsScreenDevice* QS60Data::screenDevice() { - return CCoeEnv::Static()->ScreenDevice(); + if(!tls.hasLocalData()) { + tls.setLocalData(new QS60ThreadLocalData); + } + return tls.localData()->screenDevice; } inline CCoeAppUi* QS60Data::appUi() diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 943df7f..cdfba3d 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -118,7 +118,7 @@ public: { if (!font) return; - QS60Data::screenDevice()->ReleaseFont(font); + S60->screenDevice()->ReleaseFont(font); } }; @@ -205,7 +205,7 @@ const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(c CFont* font = NULL; #ifdef Q_SYMBIAN_HAS_FONTTABLE_API - const TInt err = QS60Data::screenDevice()->GetNearestFontToDesignHeightInPixels(font, searchSpec); + const TInt err = S60->screenDevice()->GetNearestFontToDesignHeightInPixels(font, searchSpec); Q_ASSERT(err == KErrNone && font); QScopedPointer<CFont, CFontFromScreenDeviceReleaser> sFont(font); QSymbianTypeFaceExtras *extras = new QSymbianTypeFaceExtras(font); @@ -260,17 +260,19 @@ QFontEngineFTS60::QFontEngineFTS60(const QFontDef &fd) */ qreal QFontEngineS60::pixelsToPoints(qreal pixels, Qt::Orientation orientation) { + CWsScreenDevice* device = S60->screenDevice(); return (orientation == Qt::Horizontal? - S60->screenDevice()->HorizontalPixelsToTwips(pixels) - :S60->screenDevice()->VerticalPixelsToTwips(pixels)) / KTwipsPerPoint; + device->HorizontalPixelsToTwips(pixels) + :device->VerticalPixelsToTwips(pixels)) / KTwipsPerPoint; } qreal QFontEngineS60::pointsToPixels(qreal points, Qt::Orientation orientation) { + CWsScreenDevice* device = S60->screenDevice(); const int twips = points * KTwipsPerPoint; return orientation == Qt::Horizontal? - S60->screenDevice()->HorizontalTwipsToPixels(twips) - :S60->screenDevice()->VerticalTwipsToPixels(twips); + device->HorizontalTwipsToPixels(twips) + :device->VerticalTwipsToPixels(twips); } QFontEngineMultiS60::QFontEngineMultiS60(QFontEngine *first, int script, const QStringList &fallbackFamilies) @@ -309,16 +311,16 @@ static void initializeDb() QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); - const int numTypeFaces = QS60Data::screenDevice()->NumTypefaces(); + const int numTypeFaces = S60->screenDevice()->NumTypefaces(); const QSymbianFontDatabaseExtrasImplementation *dbExtras = static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras); bool fontAdded = false; for (int i = 0; i < numTypeFaces; i++) { TTypefaceSupport typefaceSupport; - QS60Data::screenDevice()->TypefaceSupport(typefaceSupport, i); + S60->screenDevice()->TypefaceSupport(typefaceSupport, i); CFont *font; // We have to get a font instance in order to know all the details TFontSpec fontSpec(typefaceSupport.iTypeface.iName, 11); - if (QS60Data::screenDevice()->GetNearestFontInPixels(font, fontSpec) != KErrNone) + if (S60->screenDevice()->GetNearestFontInPixels(font, fontSpec) != KErrNone) continue; QScopedPointer<CFont, QSymbianFontDatabaseExtrasImplementation::CFontFromScreenDeviceReleaser> sFont(font); if (font->TypeUid() == KCFbsFontUid) { diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp index 925b3bf..f691413 100644 --- a/src/gui/text/qfontengine_s60.cpp +++ b/src/gui/text/qfontengine_s60.cpp @@ -66,7 +66,7 @@ QSymbianTypeFaceExtras::QSymbianTypeFaceExtras(CFont* cFont, COpenFont *openFont QSymbianTypeFaceExtras::~QSymbianTypeFaceExtras() { - QS60Data::screenDevice()->ReleaseFont(m_cFont); + S60->screenDevice()->ReleaseFont(m_cFont); } QByteArray QSymbianTypeFaceExtras::getSfntTable(uint tag) const |