diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-12-13 11:14:49 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-12-13 11:14:49 (GMT) |
commit | 0e0a3883675ed2943af9810b8354ed406075a6ee (patch) | |
tree | 8e97a2917bc3002722d0cd9b995ceb4a652c4615 | |
parent | ca6db4b5b89f627a970e9f4ea489eae38d771f66 (diff) | |
parent | c614e71cdd4047bb49ccde2f94c9d622f5071fc3 (diff) | |
download | Qt-0e0a3883675ed2943af9810b8354ed406075a6ee.zip Qt-0e0a3883675ed2943af9810b8354ed406075a6ee.tar.gz Qt-0e0a3883675ed2943af9810b8354ed406075a6ee.tar.bz2 |
Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qt-fire-team
* 'master' of git://scm.dev.nokia.troll.no/qt/qt-fire-team:
directfb: Backport the work from QtBase to Qt 4.8
[blitter] Work on tst_QPixmap::clear()
[blitter] Use QScopedPointer for the engine and blittable
[blitter] Generate a new serial number when resizing the
[blitter] Fix memory leak in the blitter paintengine
Revert "Fix memory leaks in OpenVG and OpenGL resource pools"
Fix window surface config on OpenGL graphics system.
Symbian: Fix a case sensitivity issue with QMAKE_EXTRA_COMPILERS
Symbian: Fix double deletion of selected text when using predictive
tests: fixed compile of qscriptextensionplugin test with high -jN
Symbian: improving diagnostics for QWaitCondition
Updated WebKit to 83439de78841f9569ad78e3a84b7b888337b5d18
Symbian: Fix language mappings for localize_deployment
Symbian: Only localize the application .rss that needs it, not all .rss
Revert "Fix sqlite driver memory eating due to close failure"
Revert "Fix sqlite driver memory eating due to close failure"
tests: make tests compile or disable those which don't compile
Reduce unnecessary QtCore DLL loads during Symbian app thread creation
Fix HarfBuzz Thai character SARA AM handling
75 files changed, 1253 insertions, 474 deletions
diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index c50dc77..4e9690d 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -155,7 +155,9 @@ SYMBIAN_SUPPORTED_LANGUAGES = \ pt_br en_ca fr_ca el_cy tr_cy \ en_tw en_hk en_cn en_jp en_th \ sv_fi zh_hk es_419 en_za fr_ch \ - de_ch it_ch zh_tw + de_ch it_ch zh_tw en_in + +SYMBIAN_LANGUAGES_WITH_TWO_CODES = ms id # These directories must match what configure uses for QT_INSTALL_PLUGINS and QT_INSTALL_IMPORTS QT_PLUGINS_BASE_DIR = /resource/qt$${QT_LIBINFIX}/plugins @@ -295,8 +297,10 @@ defineReplace(addLanguageDependentPkgItem) { pkgItem = $$eval($$1) pkgLanguageList = - for(dummyItem, SYMBIAN_MATCHED_LANGUAGES) { + for(matchedLanguage, SYMBIAN_MATCHED_LANGUAGES) { pkgLanguageList += "\"$$pkgItem\"" + # If the language has two mappings, add the item another time. + contains(SYMBIAN_LANGUAGES_WITH_TWO_CODES, $$matchedLanguage): pkgLanguageList += "\"$$pkgItem\"" } isEmpty(pkgLanguageList): pkgLanguageList = "\"$$pkgItem\"" diff --git a/mkspecs/features/symbian/localize_deployment.prf b/mkspecs/features/symbian/localize_deployment.prf index 3e7f585..57c3e93 100644 --- a/mkspecs/features/symbian/localize_deployment.prf +++ b/mkspecs/features/symbian/localize_deployment.prf @@ -28,7 +28,7 @@ SYMBIAN_LANG.he = 57 #Hebrew SYMBIAN_LANG.hi = 58 #Hindi SYMBIAN_LANG.hu = 17 #Hungarian SYMBIAN_LANG.is = 15 #Icelandic -SYMBIAN_LANG.id = 59 #Indonesian +SYMBIAN_LANG.id = 59 327 #Indonesian / Indonesian APAC SYMBIAN_LANG.ga = 60 #Irish SYMBIAN_LANG.it = 05 #Italian SYMBIAN_LANG.ja = 32 #Japanese @@ -39,7 +39,7 @@ SYMBIAN_LANG.lo = 66 #Laothian SYMBIAN_LANG.lv = 67 #Latvian SYMBIAN_LANG.lt = 68 #Lithuanian SYMBIAN_LANG.mk = 69 #Macedonian -SYMBIAN_LANG.ms = 70 #Malay +SYMBIAN_LANG.ms = 70 326 #Malay / Malay APAC SYMBIAN_LANG.ml = 71 #Malayalam SYMBIAN_LANG.mr = 72 #Marathi SYMBIAN_LANG.mo = 73 #Moldavian @@ -88,6 +88,7 @@ SYMBIAN_LANG.en_hk = 158 #English as appropriate for use in Hong Kong SYMBIAN_LANG.en_cn = 159 #English as appropriate for use in the Peoples Republic of China SYMBIAN_LANG.en_jp = 160 #English as appropriate for use in Japan SYMBIAN_LANG.en_th = 161 #English as appropriate for use in Thailand +SYMBIAN_LANG.en_in = 230 #English as appropriate for use in India SYMBIAN_LANG.sv_fi = 85 #Finland Swedish SYMBIAN_LANG.zh_hk = 30 #HongKong Chinese SYMBIAN_LANG.es_419 = 83 #Latin American Spanish diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index 8db82d6..e2dec40 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -397,7 +397,6 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, if (symbianLocalizationList.size()) { // Add localized resources to DEPLOYMENT if default resource deployment is done addLocalizedResourcesToDeployment("default_resource_deployment.files", symbianLocalizationList); - addLocalizedResourcesToDeployment("default_reg_deployment.files", symbianLocalizationList); } // deploy files specified by DEPLOYMENT variable @@ -865,12 +864,17 @@ void SymbianCommonGenerator::fillQt2SymbianLocalizationList(SymbianLocalizationL QStringList symbianLanguages = generator->project->values("SYMBIAN_MATCHED_LANGUAGES"); foreach (QString qtCode, symbianLanguages) { - SymbianLocalization newLoc; QString symbianCodeVariable = symbianCodePrefix + qtCode; - newLoc.symbianLanguageCode = generator->project->first(symbianCodeVariable); - if (!newLoc.symbianLanguageCode.isEmpty()) { - newLoc.qtLanguageCode = qtCode; - symbianLocalizationList->append(newLoc); + QStringList symbianCodes = generator->project->values(symbianCodeVariable); + // Some languages have more than one Symbian code, so they get more than one + // entry in symbianLocalizationList. + foreach (QString symbianCode, symbianCodes) { + SymbianLocalization newLoc; + newLoc.symbianLanguageCode = symbianCode; + if (!newLoc.symbianLanguageCode.isEmpty()) { + newLoc.qtLanguageCode = qtCode; + symbianLocalizationList->append(newLoc); + } } } } diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 694bbfb..0b41572 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -681,6 +681,7 @@ void SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, const Sy locTarget.append(".rss"); t << "SOURCEPATH\t\t\t. " << endl; + t << MMP_START_RESOURCE "\t\t" << locTarget << endl; t << "LANG SC "; // no endl SymbianLocalizationListIterator iter(symbianLocalizationList); while (iter.hasNext()) { @@ -688,7 +689,6 @@ void SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, const Sy t << loc.symbianLanguageCode << " "; // no endl } t << endl; - t << MMP_START_RESOURCE "\t\t" << locTarget << endl; t << "HEADER" << endl; t << "TARGETPATH\t\t\t" RESOURCE_DIRECTORY_MMP << endl; t << MMP_END_RESOURCE << endl << endl; diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index cc32f8d..5077be5 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -650,7 +650,11 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t foreach(QString targetItem, project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_TARGETS.") + item)) { // Make sure targetpath is absolute QString absoluteTarget = QDir::cleanPath(outputDir.absoluteFilePath(targetItem)); +#if defined(Q_OS_WIN) + if (allPreDeps.contains(absoluteTarget, Qt::CaseInsensitive)) { +#else if (allPreDeps.contains(absoluteTarget)) { +#endif QStringList deps = project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_DEPS.") + item + targetItem); QString commandItem = project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_CMD.") + item + targetItem).join(" "); diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h index e1360c7..05214e7 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper-private.h @@ -111,6 +111,7 @@ extern HB_Bool HB_HangulShape(HB_ShaperItem *shaper_item); extern HB_Bool HB_MyanmarShape(HB_ShaperItem *shaper_item); extern HB_Bool HB_KhmerShape(HB_ShaperItem *shaper_item); extern HB_Bool HB_IndicShape(HB_ShaperItem *shaper_item); +extern HB_Bool HB_ThaiShape(HB_ShaperItem *shaper_item); extern void HB_TibetanAttributes(HB_Script script, const HB_UChar16 *string, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes); diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp index 7f4bb0c..0734442 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp @@ -630,7 +630,7 @@ const HB_ScriptEngine HB_ScriptEngines[] = { // Sinhala { HB_IndicShape, HB_IndicAttributes }, // Thai - { HB_BasicShape, HB_ThaiAttributes }, + { HB_ThaiShape, HB_ThaiAttributes }, // Lao { HB_BasicShape, 0 }, // Tibetan @@ -1337,18 +1337,18 @@ HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool do #ifdef OT_DEBUG if (doLogClusters) { - DEBUG("log clusters after shaping:"); - for (int j = 0; j < length; j++) - DEBUG(" log[%d] = %d", j, item->log_clusters[j]); + DEBUG("log clusters after shaping:\n"); + for (unsigned int j = 0; j < item->item.length; j++) + DEBUG(" log[%d] = %d\n", j, item->log_clusters[j]); } - DEBUG("final glyphs:"); - for (int i = 0; i < (int)hb_buffer->in_length; ++i) - DEBUG(" glyph=%4x char_index=%d mark: %d cmp: %d, clusterStart: %d advance=%d/%d offset=%d/%d", - glyphs[i].glyph, hb_buffer->in_string[i].cluster, glyphs[i].attributes.mark, - glyphs[i].attributes.combiningClass, glyphs[i].attributes.clusterStart, - glyphs[i].advance.x.toInt(), glyphs[i].advance.y.toInt(), - glyphs[i].offset.x.toInt(), glyphs[i].offset.y.toInt()); - DEBUG("-----------------------------------------"); + DEBUG("final glyphs:\n"); + for (unsigned int i = 0; i < item->num_glyphs; ++i) + DEBUG(" glyph=%4x char_index=%d mark: %d cmp: %d, clusterStart: %d advance=%d offset=%d/%d\n", + glyphs[i], face->buffer->in_string[i].cluster, attributes[i].mark, + attributes[i].combiningClass, attributes[i].clusterStart, + item->advances[i] >> 6, + item->offsets[i].x >> 6, item->offsets[i].y >> 6); + DEBUG("-----------------------------------------\n"); #endif return true; } diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-thai.c b/src/3rdparty/harfbuzz/src/harfbuzz-thai.c index e80e2c5..262cee6 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-thai.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-thai.c @@ -29,15 +29,41 @@ #include <assert.h> #include <stdio.h> -typedef int (*th_brk_def)(const char*, int[], int); +#define LIBTHAI_MAJOR 0 + +/* + * if libthai changed please update these codes too. + */ +struct thcell_t { + unsigned char base; /**< base character */ + unsigned char hilo; /**< upper/lower vowel/diacritic */ + unsigned char top; /**< top-level mark */ +}; +typedef int (*th_brk_def) (const unsigned char*, int*, size_t); +typedef int (*th_render_cell_tis_def) (struct thcell_t cell, unsigned char res[], size_t res_sz, int is_decomp_am); +typedef int (*th_render_cell_win_def) (struct thcell_t cell, unsigned char res[], size_t res_sz, int is_decomp_am); +typedef int (*th_render_cell_mac_def) (struct thcell_t cell, unsigned char res[], size_t res_sz, int is_decomp_am); +typedef size_t (*th_next_cell_def) (const unsigned char *, size_t, struct thcell_t *, int); + +/* libthai releated function handles */ static th_brk_def th_brk = 0; -static int libthai_resolved = 0; +static th_next_cell_def th_next_cell = 0; +static th_render_cell_tis_def th_render_cell_tis = 0; +static th_render_cell_win_def th_render_cell_win = 0; +static th_render_cell_mac_def th_render_cell_mac = 0; -static void resolve_libthai() -{ - if (!th_brk) - th_brk = (th_brk_def)HB_Library_Resolve("thai", 0, "th_brk"); - libthai_resolved = 1; +static int init_libthai() { + if (!th_brk || !th_next_cell || !th_render_cell_tis || !th_render_cell_win || !th_render_cell_mac) { + th_brk = (th_brk_def) HB_Library_Resolve("thai", (int)LIBTHAI_MAJOR, "th_brk"); + th_next_cell = (th_next_cell_def)HB_Library_Resolve("thai", LIBTHAI_MAJOR, "th_next_cell"); + th_render_cell_tis = (th_render_cell_tis_def) HB_Library_Resolve("thai", (int)LIBTHAI_MAJOR, "th_render_cell_tis"); + th_render_cell_win = (th_render_cell_win_def) HB_Library_Resolve("thai", (int)LIBTHAI_MAJOR, "th_render_cell_win"); + th_render_cell_mac = (th_render_cell_mac_def) HB_Library_Resolve("thai", (int)LIBTHAI_MAJOR, "th_render_cell_mac"); + } + if (th_brk && th_next_cell && th_render_cell_tis && th_render_cell_win && th_render_cell_mac) + return 1; + else + return 0; } static void to_tis620(const HB_UChar16 *string, hb_uint32 len, const char *cstr) @@ -57,46 +83,329 @@ static void to_tis620(const HB_UChar16 *string, hb_uint32 len, const char *cstr) result[len] = 0; } -static void thaiWordBreaks(const HB_UChar16 *string, hb_uint32 len, HB_CharAttributes *attributes) +/* + * --------------------------------------------------------------------------- + * Thai Shaper / Attributes + * --------------------------------------------------------------------------- + */ + +/* + * USe basic_features prepare for future adding. + */ +#ifndef NO_OPENTYPE +static const HB_OpenTypeFeature thai_features[] = { + { HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty }, + { HB_MAKE_TAG('l', 'i', 'g', 'a'), CcmpProperty }, + { HB_MAKE_TAG('c', 'l', 'i', 'g'), CcmpProperty }, + {0, 0} +}; +#endif + +/* TIS-to-Unicode glyph maps for characters 0x80-0xff */ +static int tis620_0[128] = { + /**/ 0, 0, 0, 0, 0, 0, 0, 0, + /**/ 0, 0, 0, 0, 0, 0, 0, 0, + /**/ 0, 0, 0, 0, 0, 0, 0, 0, + /**/ 0, 0, 0, 0, 0, 0, 0, 0, + 0x0020, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, + 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, + 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, + 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, + 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, + 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, + 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, + 0x0e38, 0x0e39, 0x0e3a, 0, 0, 0, 0, 0x0e3f, + 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, + 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, + 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, + 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0, 0, 0, 0 +}; + +static int tis620_1[128] = { + 0xf89e, 0, 0, 0xf88c, 0xf88f, 0xf892, 0xf895, 0xf898, + 0xf88b, 0xf88e, 0xf891, 0xf894, 0xf897, 0, 0, 0xf899, + 0xf89a, 0, 0xf884, 0xf889, 0xf885, 0xf886, 0xf887, 0xf888, + 0xf88a, 0xf88d, 0xf890, 0xf893, 0xf896, 0, 0, 0, + /**/ 0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, + 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, + 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, + 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, + 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, + 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, + 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, + 0x0e38, 0x0e39, 0x0e3a, 0, 0, 0, 0, 0x0e3f, + 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, + 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0, 0x0e4f, + 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, + 0x0e58, 0x0e59, 0, 0, 0xf89b, 0xf89c, 0xf89d, 0 +}; + +static int tis620_2[128] = { + 0xf700, 0xf701, 0xf702, 0xf703, 0xf704, 0x2026, 0xf705, 0xf706, + 0xf707, 0xf708, 0xf709, 0xf70a, 0xf70b, 0xf70c, 0xf70d, 0xf70e, + 0xf70f, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0xf710, 0xf711, 0xf712, 0xf713, 0xf714, 0xf715, 0xf716, 0xf717, + 0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, + 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, + 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, + 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, + 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, + 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, + 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, + 0x0e38, 0x0e39, 0x0e3a, 0, 0, 0, 0, 0x0e3f, + 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, + 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, + 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, + 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0xf718, 0xf719, 0xf71a, 0 +}; + +enum ThaiFontType { + TIS, + WIN, + MAC, +}; + +static int thai_get_glyph_index (ThaiFontType font_type, unsigned char c) +{ + switch (font_type){ + case TIS: return (c & 0x80) ? tis620_0[c & 0x7f] : c; + case WIN: return (c & 0x80) ? tis620_1[c & 0x7f] : c; + case MAC: return (c & 0x80) ? tis620_2[c & 0x7f] : c; + default: return 0; + } +} + +static int thai_contain_glyphs (HB_ShaperItem *shaper_item, const int glyph_map[128]) +{ + unsigned char c; + + for (c = 0; c < 0x80; c++) { + if ( glyph_map[c] ) { + if ( !shaper_item->font->klass->canRender (shaper_item->font, (HB_UChar16 *) &glyph_map[c], 1) ) + return 0; + } + } + return 1; +} + +static ThaiFontType getThaiFontType(HB_ShaperItem *shaper_item) +{ + if ( thai_contain_glyphs (shaper_item, tis620_2) ) + return MAC; + else if ( thai_contain_glyphs (shaper_item, tis620_1) ) + return WIN; + else + return TIS; +} + +/* + * convert to the correct display level of THAI vowels and marks. + */ +static HB_Bool HB_ThaiConvertStringToGlyphIndices (HB_ShaperItem *item) { char s[128]; char *cstr = s; - int brp[128]; - int *break_positions = brp; - hb_uint32 numbreaks; - hb_uint32 i; + const HB_UChar16 *string = item->string + item->item.pos; + const hb_uint32 len = item->item.length; + unsigned short *logClusters = item->log_clusters; + hb_uint32 i = 0, slen = 0; - if (!libthai_resolved) - resolve_libthai(); - - if (!th_brk) - return; + if (!init_libthai()) + return HB_BasicShape (item); if (len >= 128) cstr = (char *)malloc(len*sizeof(char) + 1); + if (!cstr) + return HB_BasicShape (item); + to_tis620(string, len, cstr); - numbreaks = th_brk(cstr, break_positions, 128); - if (numbreaks > 128) { - break_positions = (int *)malloc(numbreaks * sizeof(int)); - numbreaks = th_brk(cstr, break_positions, numbreaks); + /* Get font type */ + static ThaiFontType font_type; + static HB_Font itemFont; + if (itemFont != item->font) { + font_type = getThaiFontType (item); + itemFont = item->font; + } + + /* allocate temporary glyphs buffers */ + HB_STACKARRAY (HB_UChar16, glyphString, (item->item.length * 2)); + + while (i < item->item.length) { + struct thcell_t tis_cell; + unsigned char rglyphs[4]; + int cell_length; + int lgn = 0; + HB_Bool haveSaraAm = false; + + cell_length = th_next_cell ((const unsigned char *)cstr + i, len - i, &tis_cell, true); /* !item->fixedPitch); */ + haveSaraAm = (cstr[i + cell_length - 1] == (char)0xd3); + + /* set shaper item's log_clusters */ + logClusters[i] = slen; + for (int j = 1; j < cell_length; j++) { + logClusters[i + j] = logClusters[i]; + } + + /* Find Logical Glyphs by font type */ + switch (font_type) { + case TIS: lgn = th_render_cell_tis (tis_cell, rglyphs, sizeof(rglyphs) / sizeof(rglyphs[0]), true); break; + case WIN: lgn = th_render_cell_mac (tis_cell, rglyphs, sizeof(rglyphs) / sizeof(rglyphs[0]), true); break; + case MAC: lgn = th_render_cell_win (tis_cell, rglyphs, sizeof(rglyphs) / sizeof(rglyphs[0]), true); break; + } + + /* Add glyphs to glyphs string and setting some attributes */ + for (int lgi = 0; lgi < lgn; lgi++) { + if ( rglyphs[lgi] == 0xdd/*TH_BLANK_BASE_GLYPH*/ ) { + //if ( !item->fixedPitch ) { + glyphString[slen++] = C_DOTTED_CIRCLE; + item->attributes[slen-1].dontPrint = true; // FIXME this will hide all dotted circle + //} + } + else { + glyphString[slen++] = (HB_UChar16) thai_get_glyph_index (font_type, rglyphs[lgi]); + } + } + + if (haveSaraAm) { + logClusters[i + cell_length - 1] = slen - 1; // Set logClusters before NIKAHIT + if (tis_cell.top != 0) + logClusters[i + cell_length - 2] = slen - 2; // Set logClusters before NIKAHIT when tis_cell has top + if (logClusters[i + cell_length - 1] > slen) + logClusters[i + cell_length - 1] = 0; + } + + i += cell_length; + } + glyphString[slen] = (HB_UChar16) '\0'; + + /* for check, should reallocate space or not */ + HB_Bool spaceOK = (item->num_glyphs >= slen); + + /* Convert to Glyph indices */ + HB_Bool haveGlyphs = item->font->klass->convertStringToGlyphIndices ( + item->font, + glyphString, slen, + item->glyphs, &item->num_glyphs, + item->shaperFlags); + + HB_FREE_STACKARRAY (glyphString); + + if (len >= 128) + free(cstr); + + return (haveGlyphs && spaceOK); +} + +/* + * set the glyph attributes heuristically. + */ +static void HB_ThaiHeuristicSetGlyphAttributes (HB_ShaperItem *item) +{ + /* Set Glyph Attributes */ + hb_uint32 iCluster = 0; + hb_uint32 length = item->item.length; + while (iCluster < length) { + int cluster_start = item->log_clusters[iCluster]; + ++iCluster; + while (iCluster < length && item->log_clusters[iCluster] == cluster_start) { + ++iCluster; + } + int cluster_end = (iCluster < length) ? item->log_clusters[iCluster] : item->num_glyphs; + item->attributes[cluster_start].clusterStart = true; + for (int i = cluster_start + 1; i < cluster_end; i++) { + item->attributes[i].clusterStart = false; + } + } +} + +/* + * THAI Shaping. + */ +HB_Bool HB_ThaiShape (HB_ShaperItem *shaper_item) +{ + if ( !HB_ThaiConvertStringToGlyphIndices (shaper_item) ) + return false; + + HB_ThaiHeuristicSetGlyphAttributes (shaper_item); + +#ifndef NO_OPENTYPE + const int availableGlyphs = shaper_item->num_glyphs; + if ( HB_SelectScript (shaper_item, thai_features) ) { + HB_OpenTypeShape (shaper_item, /*properties*/0); + return HB_OpenTypePosition (shaper_item, availableGlyphs, /*doLogClusters*/false); } +#endif + + HB_HeuristicPosition (shaper_item); + return true; +} + +/* + * Thai Attributes: computes Word Break, Word Boundary and Char stop for THAI. + */ +static void HB_ThaiAssignAttributes(const HB_UChar16 *string, hb_uint32 len, HB_CharAttributes *attributes) +{ + char s[128]; + char *cstr = s; + int *break_positions = 0; + int brp[128]; + int brp_size = 0; + hb_uint32 numbreaks, i, j, cell_length; + struct thcell_t tis_cell; + + if (!init_libthai()) + return ; + + if (len >= 128) + cstr = (char *)malloc(len*sizeof(char) + 1); + + to_tis620(string, len, cstr); for (i = 0; i < len; ++i) { attributes[i].lineBreakType = HB_NoBreak; attributes[i].wordBoundary = FALSE; } - for (i = 0; i < numbreaks; ++i) { - if (break_positions[i] > 0) { - attributes[break_positions[i]-1].lineBreakType = HB_Break; - attributes[break_positions[i]-1].wordBoundary = TRUE; + if (len > 128) { + break_positions = (int*) malloc (sizeof(int) * len); + memset (break_positions, 0, sizeof(int) * len); + brp_size = len; + } + else { + break_positions = brp; + brp_size = 128; + } + + if (break_positions) { + attributes[0].wordBoundary = TRUE; + numbreaks = th_brk((const unsigned char *)cstr, break_positions, brp_size); + for (i = 0; i < numbreaks; ++i) { + attributes[break_positions[i]].wordBoundary = TRUE; + if (break_positions[i] > 0) + attributes[break_positions[i]-1].lineBreakType = HB_Break; } + + if (break_positions != brp) + free(break_positions); } - if (break_positions != brp) - free(break_positions); + /* manage charStop */ + i = 0; + while (i < len) { + cell_length = th_next_cell((const unsigned char *)cstr + i, len - i, &tis_cell, true); + + attributes[i].charStop = true; + for (j = 1; j < cell_length; j++) + attributes[i + j].charStop = false; + + /* Set charStop for SARA AM */ + if (cstr[i + cell_length - 1] == (char)0xd3) + attributes[i + cell_length - 1].charStop = true; + + i += cell_length; + } if (len >= 128) free(cstr); @@ -105,7 +414,9 @@ static void thaiWordBreaks(const HB_UChar16 *string, hb_uint32 len, HB_CharAttri void HB_ThaiAttributes(HB_Script script, const HB_UChar16 *text, hb_uint32 from, hb_uint32 len, HB_CharAttributes *attributes) { assert(script == HB_Script_Thai); + const HB_UChar16 *uc = text + from; attributes += from; - thaiWordBreaks(text + from, len, attributes); + HB_UNUSED(script); + HB_ThaiAssignAttributes(uc, len, attributes); } diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index 12a28b8..3868886 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -52a11cec052aa40d3bbc06861be1177b649b4a99 +83439de78841f9569ad78e3a84b7b888337b5d18 diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index bbaf26d..82dc1fb 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,11 @@ +2011-12-08 Zeno Albisser <zeno@webkit.org> + + Disable -Werror for standalone packages. + + Reviewed by Simon Hausmann. + + * Source/WebKit.pri: + 2011-11-09 Zeno Albisser <zeno.albisser@nokia.com> [Qt] Unreviewed: Fix build on Mac. diff --git a/src/3rdparty/webkit/Source/WebCore/ChangeLog b/src/3rdparty/webkit/Source/WebCore/ChangeLog index ead97bd..4c6a7c1 100644 --- a/src/3rdparty/webkit/Source/WebCore/ChangeLog +++ b/src/3rdparty/webkit/Source/WebCore/ChangeLog @@ -1,3 +1,12 @@ +2011-06-10 Konstantin Tokarev <ktokarev@smartlabs.tv> + + Reviewed by Joseph Pecoraro. + + Fixed build with enabled workers and disabled inspector + https://bugs.webkit.org/show_bug.cgi?id=62461 + + * inspector/InspectorWorkerAgent.cpp: Added inspector guard + 2011-11-01 Zeno Albisser <zeno.albisser@nokia.com> [Qt] bad codegen, pointer diff in JSC::JSCallbackConstructor::JSCallbackConstructor diff --git a/src/3rdparty/webkit/Source/WebCore/WebCore.pri b/src/3rdparty/webkit/Source/WebCore/WebCore.pri index d8ba8a6..00357a1 100644 --- a/src/3rdparty/webkit/Source/WebCore/WebCore.pri +++ b/src/3rdparty/webkit/Source/WebCore/WebCore.pri @@ -153,7 +153,7 @@ symbian { CONFIG += do_not_build_as_thumb CONFIG(release, debug|release): QMAKE_CXXFLAGS.ARMCC += -OTime -O3 - # Symbian plugin support. + # Symbian plugin support LIBS += -lefsrv !CONFIG(QTDIR_build) { diff --git a/src/3rdparty/webkit/Source/WebCore/inspector/InspectorWorkerAgent.cpp b/src/3rdparty/webkit/Source/WebCore/inspector/InspectorWorkerAgent.cpp index b875f0f..6288a88 100644 --- a/src/3rdparty/webkit/Source/WebCore/inspector/InspectorWorkerAgent.cpp +++ b/src/3rdparty/webkit/Source/WebCore/inspector/InspectorWorkerAgent.cpp @@ -30,7 +30,7 @@ #include "config.h" -#if ENABLE(WORKERS) +#if ENABLE(WORKERS) && ENABLE(INSPECTOR) #include "InspectorWorkerAgent.h" @@ -128,4 +128,4 @@ void InspectorWorkerAgent::didStartWorkerContext(WorkerContextProxy* workerConte } // namespace WebCore -#endif // ENABLE(WORKERS) +#endif // ENABLE(WORKERS) && ENABLE(INSPECTOR) diff --git a/src/3rdparty/webkit/Source/WebKit.pri b/src/3rdparty/webkit/Source/WebKit.pri index c469d1a..5080119 100644 --- a/src/3rdparty/webkit/Source/WebKit.pri +++ b/src/3rdparty/webkit/Source/WebKit.pri @@ -102,7 +102,7 @@ CONFIG -= warn_on # Treat warnings as errors on x86/Linux/GCC linux-g++* { - isEqual(QT_ARCH,x86_64)|isEqual(QT_ARCH,i386): QMAKE_CXXFLAGS += -Werror + !CONFIG(standalone_package):isEqual(QT_ARCH,x86_64)|isEqual(QT_ARCH,i386): QMAKE_CXXFLAGS += -Werror greaterThan(QT_GCC_MAJOR_VERSION, 3):greaterThan(QT_GCC_MINOR_VERSION, 5) { if (!contains(QMAKE_CXXFLAGS, -std=c++0x) && !contains(QMAKE_CXXFLAGS, -std=gnu++0x)) { diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 750e7e7..a08cc05 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - 52a11cec052aa40d3bbc06861be1177b649b4a99 + 83439de78841f9569ad78e3a84b7b888337b5d18 diff --git a/src/corelib/thread/qwaitcondition_symbian.cpp b/src/corelib/thread/qwaitcondition_symbian.cpp index c6414e8..ed1011c 100644 --- a/src/corelib/thread/qwaitcondition_symbian.cpp +++ b/src/corelib/thread/qwaitcondition_symbian.cpp @@ -112,7 +112,10 @@ public: --wakeups; } - mutex.Signal(); + // if err is KErrGeneral it signals that the RCondVar is closed along with the mutex and that this has been deleted + // we must not access any member variables in this case + if (err != KErrGeneral) + mutex.Signal(); if (err && err != KErrTimedOut) report_error(err, "QWaitCondition::wait()", "cv wait"); diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index f3a4318..c73e6a9 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -57,7 +57,8 @@ QT_BEGIN_NAMESPACE static int global_ser_no = 0; QBlittablePixmapData::QBlittablePixmapData() - : QPixmapData(QPixmapData::PixmapType,BlitterClass), m_engine(0), m_blittable(0) + : QPixmapData(QPixmapData::PixmapType,BlitterClass) + , m_alpha(false) #ifdef QT_BLITTER_RASTEROVERLAY ,m_rasterOverlay(0), m_unmergedCopy(0) #endif //QT_BLITTER_RASTEROVERLAY @@ -67,8 +68,6 @@ QBlittablePixmapData::QBlittablePixmapData() QBlittablePixmapData::~QBlittablePixmapData() { - delete m_blittable; - delete m_engine; #ifdef QT_BLITTER_RASTEROVERLAY delete m_rasterOverlay; delete m_unmergedCopy; @@ -79,31 +78,30 @@ QBlittable *QBlittablePixmapData::blittable() const { if (!m_blittable) { QBlittablePixmapData *that = const_cast<QBlittablePixmapData *>(this); - that->m_blittable = this->createBlittable(QSize(w,h)); + that->m_blittable.reset(this->createBlittable(QSize(w,h), m_alpha)); } - return m_blittable; + return m_blittable.data(); } void QBlittablePixmapData::setBlittable(QBlittable *blittable) { resize(blittable->size().width(),blittable->size().height()); - m_blittable = blittable; + m_blittable.reset(blittable); } void QBlittablePixmapData::resize(int width, int height) { - delete m_blittable; - m_blittable = 0; - delete m_engine; - m_engine = 0; + m_blittable.reset(0); + m_engine.reset(0); #ifdef Q_WS_QPA d = QApplicationPrivate::platformIntegration()->screens().at(0)->depth(); #endif w = width; h = height; is_null = (w <= 0 || h <= 0); + setSerialNumber(++global_ser_no); } int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const @@ -139,7 +137,16 @@ void QBlittablePixmapData::fill(const QColor &color) if (color.alpha() == 255 && blittable()->capabilities() & QBlittable::SolidRectCapability) { blittable()->unlock(); blittable()->fillRect(QRectF(0,0,w,h),color); - }else { + } else { + // Need to be backed with an alpha channel now. It would be nice + // if we could just change the format, e.g. when going from + // RGB32 -> ARGB8888. + if (color.alpha() != 255 && !hasAlphaChannel()) { + m_blittable.reset(0); + m_engine.reset(0); + m_alpha = true; + } + uint pixel; switch (blittable()->lock()->format()) { case QImage::Format_ARGB32_Premultiplied: @@ -185,6 +192,7 @@ bool QBlittablePixmapData::hasAlphaChannel() const void QBlittablePixmapData::fromImage(const QImage &image, Qt::ImageConversionFlags flags) { + m_alpha = image.hasAlphaChannel(); resize(image.width(),image.height()); markRasterOverlay(QRect(0,0,w,h)); QImage *thisImg = buffer(); @@ -208,9 +216,9 @@ QPaintEngine *QBlittablePixmapData::paintEngine() const { if (!m_engine) { QBlittablePixmapData *that = const_cast<QBlittablePixmapData *>(this); - that->m_engine = new QBlitterPaintEngine(that); + that->m_engine.reset(new QBlitterPaintEngine(that)); } - return m_engine; + return m_engine.data(); } #ifdef QT_BLITTER_RASTEROVERLAY diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h index 07791e5..4742a83 100644 --- a/src/gui/image/qpixmap_blitter_p.h +++ b/src/gui/image/qpixmap_blitter_p.h @@ -55,7 +55,7 @@ public: QBlittablePixmapData(); ~QBlittablePixmapData(); - virtual QBlittable *createBlittable(const QSize &size) const = 0; + virtual QBlittable *createBlittable(const QSize &size, bool alpha) const = 0; QBlittable *blittable() const; void setBlittable(QBlittable *blittable); @@ -83,8 +83,9 @@ public: #endif //QT_BLITTER_RASTEROVERLAY protected: - QBlitterPaintEngine *m_engine; - QBlittable *m_blittable; + QScopedPointer<QBlitterPaintEngine> m_engine; + QScopedPointer<QBlittable> m_blittable; + bool m_alpha; #ifdef QT_BLITTER_RASTEROVERLAY QImage *m_rasterOverlay; diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 3bcac62..02bc4d0 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -1388,15 +1388,25 @@ void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText, // but FEP requires that selected text is always removed at StartFepInlineEditL. // Let's remove the selected text if aInitialInlineText is empty and there is selected text if (m_preeditString.isEmpty()) { - int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt(); - int cursorPos = w->inputMethodQuery(Qt::ImCursorPosition).toInt(); - int replacementLength = qAbs(cursorPos-anchor); - if (replacementLength > 0) { - int replacementStart = cursorPos < anchor ? 0 : -replacementLength; - QList<QInputMethodEvent::Attribute> clearSelectionAttributes; - QInputMethodEvent clearSelectionEvent(QLatin1String(""), clearSelectionAttributes); - clearSelectionEvent.setCommitString(QLatin1String(""), replacementStart, replacementLength); + QString currentSelection = w->inputMethodQuery(Qt::ImCurrentSelection).toString(); + if (!currentSelection.isEmpty()) { + // To correctly remove selection in cases where we have multiple lines selected, + // we must rely on the control's own selection removal mechanism, as surrounding + // text contains only one line. It's also impossible to accurately detect + // these overselection cases as the anchor and cursor positions are limited to the + // surrounding text. + // Solution is to clear the selection by faking a preedit. Use a dummy character + // from the current selection just to be safe. + QString dummyText = currentSelection.left(1); + QList<QInputMethodEvent::Attribute> attributes; + QInputMethodEvent clearSelectionEvent(dummyText, attributes); + clearSelectionEvent.setCommitString(QLatin1String(""), 0, 0); sendEvent(clearSelectionEvent); + + // Now that selection is taken care of, clear the fake preedit. + QInputMethodEvent clearPreeditEvent(QLatin1String(""), attributes); + clearPreeditEvent.setCommitString(QLatin1String(""), 0, 0); + sendEvent(clearPreeditEvent); } } diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp index 75efa20..69f0301 100644 --- a/src/gui/painting/qpaintengine_blitter.cpp +++ b/src/gui/painting/qpaintengine_blitter.cpp @@ -198,8 +198,8 @@ public: hasXForm(false) { - raster = new QRasterPaintEngine(p->buffer()); - capabillities = new CapabilitiesToStateMask(pmData->blittable()->capabilities()); + raster.reset(new QRasterPaintEngine(p->buffer())); + capabillities.reset(new CapabilitiesToStateMask(pmData->blittable()->capabilities())); } inline void lock() { @@ -279,12 +279,12 @@ public: raster->d_func()->systemStateChanged(); } - QRasterPaintEngine *raster; + QScopedPointer<QRasterPaintEngine> raster; QBlittablePixmapData *pmData; bool isBlitterLocked; - CapabilitiesToStateMask *capabillities; + QScopedPointer<CapabilitiesToStateMask> capabillities; uint hasXForm; }; @@ -655,7 +655,7 @@ void QBlitterPaintEngine::setState(QPainterState *s) inline QRasterPaintEngine *QBlitterPaintEngine::raster() const { Q_D(const QBlitterPaintEngine); - return d->raster; + return d->raster.data(); } QT_END_NAMESPACE diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 0b96350..21047d7 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -64,6 +64,25 @@ void qt_eglproperties_set_glformat(QEglProperties& eglProperties, const QGLForma int stencilSize = glFormat.stencilBufferSize(); int sampleCount = glFormat.samples(); +#ifdef Q_OS_SYMBIAN + // on Symbian we prefer 32-bit configs + if (glFormat.alpha() && alphaSize <= 0) + alphaSize = 8; + if (glFormat.depth() && depthSize <= 0) + depthSize = 24; + if (glFormat.stencil() && stencilSize <= 0) + stencilSize = 8; + if (glFormat.sampleBuffers() && sampleCount <= 0) + sampleCount = 1; + + redSize = redSize > 0 ? redSize : 8; + greenSize = greenSize > 0 ? greenSize : 8; + blueSize = blueSize > 0 ? blueSize : 8; + alphaSize = alphaSize > 0 ? alphaSize : 8; + depthSize = depthSize > 0 ? depthSize : 24; + stencilSize = stencilSize > 0 ? stencilSize : 8; + sampleCount = sampleCount > 0 ? sampleCount : 4; +#else // QGLFormat uses a magic value of -1 to indicate "don't care", even when a buffer of that // type has been requested. So we must check QGLFormat's booleans too if size is -1: if (glFormat.alpha() && alphaSize <= 0) @@ -101,6 +120,7 @@ void qt_eglproperties_set_glformat(QEglProperties& eglProperties, const QGLForma depthSize = depthSize > 0 ? depthSize : 0; stencilSize = stencilSize > 0 ? stencilSize : 0; sampleCount = sampleCount > 0 ? sampleCount : 0; +#endif eglProperties.setValue(EGL_RED_SIZE, redSize); eglProperties.setValue(EGL_GREEN_SIZE, greenSize); diff --git a/src/opengl/qgl_symbian.cpp b/src/opengl/qgl_symbian.cpp index 0148304..7d343f6 100644 --- a/src/opengl/qgl_symbian.cpp +++ b/src/opengl/qgl_symbian.cpp @@ -181,14 +181,19 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // almost same as d->ownsEglContext = true; d->eglContext->setApi(QEgl::OpenGL); - // Allow apps to override ability to use multisampling by setting an environment variable. Eg: - // qputenv("QT_SYMBIAN_DISABLE_GL_MULTISAMPLE", "1"); - // Added to allow camera app to start with limited memory. - if (!QSymbianGraphicsSystemEx::hasBCM2727() && !qgetenv("QT_SYMBIAN_DISABLE_GL_MULTISAMPLE").toInt()) { - // Most likely we have hw support for multisampling - // so let's enable it. - d->glFormat.setSampleBuffers(1); - d->glFormat.setSamples(4); + if (d->glFormat.samples() == EGL_DONT_CARE) { + // Allow apps to override ability to use multisampling by setting an environment variable. Eg: + // qputenv("QT_SYMBIAN_DISABLE_GL_MULTISAMPLE", "1"); + // Added to allow camera app to start with limited memory. + if (!QSymbianGraphicsSystemEx::hasBCM2727() && !qgetenv("QT_SYMBIAN_DISABLE_GL_MULTISAMPLE").toInt()) { + // Most likely we have hw support for multisampling + // so let's enable it. + d->glFormat.setSampleBuffers(1); + d->glFormat.setSamples(4); + } else { + d->glFormat.setSampleBuffers(0); + d->glFormat.setSamples(1); + } } // If the device is a widget with WA_TranslucentBackground set, make sure the glFormat diff --git a/src/opengl/qgltexturepool.cpp b/src/opengl/qgltexturepool.cpp index d19b1db..9ad66f2 100644 --- a/src/opengl/qgltexturepool.cpp +++ b/src/opengl/qgltexturepool.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE Q_OPENGL_EXPORT extern QGLWidget* qt_gl_share_widget(); -Q_GLOBAL_STATIC(QGLTexturePool, qt_gl_texture_pool) +static QGLTexturePool *qt_gl_texture_pool = 0; class QGLTexturePoolPrivate { @@ -69,7 +69,9 @@ QGLTexturePool::~QGLTexturePool() QGLTexturePool *QGLTexturePool::instance() { - return qt_gl_texture_pool(); + if (!qt_gl_texture_pool) + qt_gl_texture_pool = new QGLTexturePool(); + return qt_gl_texture_pool; } GLuint QGLTexturePool::createTexture(GLenum target, diff --git a/src/openvg/qvgimagepool.cpp b/src/openvg/qvgimagepool.cpp index cd1caf4..3a187b0 100644 --- a/src/openvg/qvgimagepool.cpp +++ b/src/openvg/qvgimagepool.cpp @@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE -Q_GLOBAL_STATIC(QVGImagePool, qt_vg_image_pool) +static QVGImagePool *qt_vg_image_pool = 0; class QVGImagePoolPrivate { @@ -66,7 +66,16 @@ QVGImagePool::~QVGImagePool() QVGImagePool *QVGImagePool::instance() { - return qt_vg_image_pool(); + if (!qt_vg_image_pool) + qt_vg_image_pool = new QVGImagePool(); + return qt_vg_image_pool; +} + +void QVGImagePool::setImagePool(QVGImagePool *pool) +{ + if (qt_vg_image_pool != pool) + delete qt_vg_image_pool; + qt_vg_image_pool = pool; } VGImage QVGImagePool::createTemporaryImage(VGImageFormat format, diff --git a/src/openvg/qvgimagepool_p.h b/src/openvg/qvgimagepool_p.h index e4fd4e1..07c57bf 100644 --- a/src/openvg/qvgimagepool_p.h +++ b/src/openvg/qvgimagepool_p.h @@ -69,6 +69,10 @@ public: static QVGImagePool *instance(); + // This function can be used from system-specific graphics system + // plugins to alter the image allocation strategy. + static void setImagePool(QVGImagePool *pool); + // Create a new VGImage from the pool with the specified parameters // that is not associated with a pixmap. The VGImage is returned to // the pool when releaseImage() is called. diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro index 65c49e3..aaf4057 100644 --- a/src/plugins/platforms/directfb/directfb.pro +++ b/src/plugins/platforms/directfb/directfb.pro @@ -20,7 +20,8 @@ SOURCES = main.cpp \ qdirectfbinput.cpp \ qdirectfbcursor.cpp \ qdirectfbwindow.cpp \ - qdirectfbglcontext.cpp + qdirectfbglcontext.cpp \ + qdirectfbscreen.cpp HEADERS = qdirectfbintegration.h \ qdirectfbwindowsurface.h \ qdirectfbblitter.h \ @@ -28,7 +29,8 @@ HEADERS = qdirectfbintegration.h \ qdirectfbinput.h \ qdirectfbcursor.h \ qdirectfbwindow.h \ - qdirectfbglcontext.h + qdirectfbglcontext.h \ + qdirectfbscreen.h include(../fontdatabases/genericunix/genericunix.pri) target.path += $$[QT_INSTALL_PLUGINS]/platforms diff --git a/src/plugins/platforms/directfb/main.cpp b/src/plugins/platforms/directfb/main.cpp index 312fc41..da37b0a 100644 --- a/src/plugins/platforms/directfb/main.cpp +++ b/src/plugins/platforms/directfb/main.cpp @@ -44,6 +44,16 @@ QT_BEGIN_NAMESPACE +#ifdef DIRECTFB_GL_EGL +#define QT_EGL_BACKEND_STRING(list) list << "directfbegl"; +#define QT_EGL_BACKEND_CREATE(list, out) \ + if (list.toLower() == "directfbegl") \ + out = new QDirectFbIntegrationEGL; +#else +#define QT_EGL_BACKEND_STRING(list) +#define QT_EGL_BACKEND_CREATE(system, out) +#endif + class QDirectFbIntegrationPlugin : public QPlatformIntegrationPlugin { public: @@ -55,16 +65,24 @@ QStringList QDirectFbIntegrationPlugin::keys() const { QStringList list; list << "directfb"; + QT_EGL_BACKEND_STRING(list); return list; } QPlatformIntegration * QDirectFbIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); + QDirectFbIntegration *integration = 0; + if (system.toLower() == "directfb") - return new QDirectFbIntegration; + integration = new QDirectFbIntegration; + QT_EGL_BACKEND_CREATE(system, integration) + + if (!integration) + return 0; - return 0; + integration->initialize(); + return integration; } Q_EXPORT_PLUGIN2(directfb, QDirectFbIntegrationPlugin) diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.cpp b/src/plugins/platforms/directfb/qdirectfbblitter.cpp index 86a8bf7..af060aa 100644 --- a/src/plugins/platforms/directfb/qdirectfbblitter.cpp +++ b/src/plugins/platforms/directfb/qdirectfbblitter.cpp @@ -45,48 +45,79 @@ #include <QtGui/private/qpixmap_blitter_p.h> #include <QDebug> +#include <QFile> #include <directfb.h> +QT_BEGIN_NAMESPACE + +static QBlittable::Capabilities dfb_blitter_capabilities() +{ + return QBlittable::Capabilities(QBlittable::SolidRectCapability + |QBlittable::SourcePixmapCapability + |QBlittable::SourceOverPixmapCapability + |QBlittable::SourceOverScaledPixmapCapability); +} + QDirectFbBlitter::QDirectFbBlitter(const QSize &rect, IDirectFBSurface *surface) - : QBlittable(rect, QBlittable::Capabilities(QBlittable::SolidRectCapability - |QBlittable::SourcePixmapCapability - |QBlittable::SourceOverPixmapCapability - |QBlittable::SourceOverScaledPixmapCapability)) + : QBlittable(rect, dfb_blitter_capabilities()) + , m_surface(surface) { - if (surface) { - m_surface = surface; - } else { - DFBSurfaceDescription surfaceDesc; - memset(&surfaceDesc,0,sizeof(DFBSurfaceDescription)); - surfaceDesc.width = rect.width(); - surfaceDesc.height = rect.height(); + m_surface->AddRef(m_surface.data()); +} + +QDirectFbBlitter::QDirectFbBlitter(const QSize &rect, bool alpha) + : QBlittable(rect, dfb_blitter_capabilities()) +{ + DFBSurfaceDescription surfaceDesc; + memset(&surfaceDesc,0,sizeof(DFBSurfaceDescription)); + surfaceDesc.width = rect.width(); + surfaceDesc.height = rect.height(); + + if (alpha) { surfaceDesc.caps = DSCAPS_PREMULTIPLIED; - surfaceDesc.pixelformat = DSPF_ARGB; + surfaceDesc.pixelformat = QDirectFbBlitter::alphaPixmapFormat(); surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS | DSDESC_PIXELFORMAT); - - IDirectFB *dfb = QDirectFbConvenience::dfbInterface(); - dfb->CreateSurface(dfb,&surfaceDesc, &m_surface); - m_surface->Clear(m_surface,0,0,0,0); + } else { + surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT); + surfaceDesc.pixelformat = QDirectFbBlitter::pixmapFormat(); } + + IDirectFB *dfb = QDirectFbConvenience::dfbInterface(); + dfb->CreateSurface(dfb , &surfaceDesc, m_surface.outPtr()); + m_surface->Clear(m_surface.data(), 0, 0, 0, 0); } QDirectFbBlitter::~QDirectFbBlitter() { unlock(); - m_surface->Release(m_surface); +} + +DFBSurfacePixelFormat QDirectFbBlitter::alphaPixmapFormat() +{ + return DSPF_ARGB; +} + +DFBSurfacePixelFormat QDirectFbBlitter::pixmapFormat() +{ + return DSPF_RGB32; +} + +DFBSurfacePixelFormat QDirectFbBlitter::selectPixmapFormat(bool withAlpha) +{ + return withAlpha ? alphaPixmapFormat() : pixmapFormat(); } void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color) { - m_surface->SetColor(m_surface, color.red(), color.green(), color.blue(), color.alpha()); + m_surface->SetColor(m_surface.data(), color.red(), color.green(), color.blue(), color.alpha()); // When the blitter api supports non opaque blits, also remember to change // qpixmap_blitter.cpp::fill // DFBSurfaceDrawingFlags drawingFlags = color.alpha() ? DSDRAW_BLEND : DSDRAW_NOFX; // m_surface->SetDrawingFlags(m_surface, drawingFlags); - m_surface->SetDrawingFlags(m_surface, DSDRAW_NOFX); - m_surface->FillRectangle(m_surface, rect.x(), rect.y(), + m_surface->SetDrawingFlags(m_surface.data(), DSDRAW_NOFX); + m_surface->FillRectangle(m_surface.data(), rect.x(), rect.y(), rect.width(), rect.height()); } @@ -99,7 +130,7 @@ void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, con QDirectFbBlitter *dfbBlitter = static_cast<QDirectFbBlitter *>(blitPm->blittable()); dfbBlitter->unlock(); - IDirectFBSurface *s = dfbBlitter->m_surface; + IDirectFBSurface *s = dfbBlitter->m_surface.data(); DFBSurfaceBlittingFlags blittingFlags = DSBLIT_NOFX; DFBSurfacePorterDuffRule porterDuff = DSPD_SRC; @@ -108,18 +139,18 @@ void QDirectFbBlitter::drawPixmap(const QRectF &rect, const QPixmap &pixmap, con porterDuff = DSPD_SRC_OVER; } - m_surface->SetBlittingFlags(m_surface, DFBSurfaceBlittingFlags(blittingFlags)); - m_surface->SetPorterDuff(m_surface,porterDuff); - m_surface->SetDstBlendFunction(m_surface,DSBF_INVSRCALPHA); + m_surface->SetBlittingFlags(m_surface.data(), DFBSurfaceBlittingFlags(blittingFlags)); + m_surface->SetPorterDuff(m_surface.data(), porterDuff); + m_surface->SetDstBlendFunction(m_surface.data(), DSBF_INVSRCALPHA); const DFBRectangle sRect = { srcRect.x(), srcRect.y(), srcRect.width(), srcRect.height() }; DFBResult result; if (rect.width() == srcRect.width() && rect.height() == srcRect.height()) - result = m_surface->Blit(m_surface, s, &sRect, rect.x(), rect.y()); + result = m_surface->Blit(m_surface.data(), s, &sRect, rect.x(), rect.y()); else { const DFBRectangle dRect = { rect.x(), rect.y(), rect.width(), rect.height() }; - result = m_surface->StretchBlit(m_surface, s, &sRect, &dRect); + result = m_surface->StretchBlit(m_surface.data(), s, &sRect, &dRect); } if (result != DFB_OK) DirectFBError("QDirectFBBlitter::drawPixmap()", result); @@ -132,15 +163,15 @@ QImage *QDirectFbBlitter::doLock() void *mem; int bpl; - const DFBResult result = m_surface->Lock(m_surface, DFBSurfaceLockFlags(DSLF_WRITE|DSLF_READ), static_cast<void**>(&mem), &bpl); + const DFBResult result = m_surface->Lock(m_surface.data(), DFBSurfaceLockFlags(DSLF_WRITE|DSLF_READ), static_cast<void**>(&mem), &bpl); if (result == DFB_OK) { DFBSurfacePixelFormat dfbFormat; DFBSurfaceCapabilities dfbCaps; - m_surface->GetPixelFormat(m_surface,&dfbFormat); - m_surface->GetCapabilities(m_surface,&dfbCaps); + m_surface->GetPixelFormat(m_surface.data(), &dfbFormat); + m_surface->GetCapabilities(m_surface.data(), &dfbCaps); QImage::Format format = QDirectFbConvenience::imageFormatFromSurfaceFormat(dfbFormat, dfbCaps); int w, h; - m_surface->GetSize(m_surface,&w,&h); + m_surface->GetSize(m_surface.data(), &w, &h); m_image = QImage(static_cast<uchar *>(mem),w,h,bpl,format); } else { DirectFBError("Failed to lock image", result); @@ -149,7 +180,97 @@ QImage *QDirectFbBlitter::doLock() return &m_image; } +bool QDirectFbBlitterPlatformPixmap::fromDataBufferDescription(const DFBDataBufferDescription &dataBufferDescription) +{ + DFBResult result; + IDirectFB *dfb = QDirectFbConvenience::dfbInterface(); + + // Create a data buffer + QDirectFBPointer<IDirectFBDataBuffer> dataBuffer; + result = dfb->CreateDataBuffer(dfb, &dataBufferDescription, dataBuffer.outPtr()); + if (result != DFB_OK) { + DirectFBError(QDFB_PRETTY, result); + return false; + } + + // Create the image provider + QDirectFBPointer<IDirectFBImageProvider> provider; + result = dataBuffer->CreateImageProvider(dataBuffer.data(), provider.outPtr()); + if (result != DFB_OK) { + DirectFBError(QDFB_PRETTY, result); + return false; + } + + // Extract image information + DFBImageDescription imageDescription; + result = provider->GetImageDescription(provider.data(), &imageDescription); + if (result != DFB_OK) { + DirectFBError(QDFB_PRETTY, result); + return false; + } + + // Can we handle this directlu? + if (imageDescription.caps & DICAPS_COLORKEY) + return false; + + DFBSurfaceDescription surfaceDescription; + result = provider->GetSurfaceDescription(provider.data(), &surfaceDescription); + if (result != DFB_OK) { + DirectFBError(QDFB_PRETTY, result); + return false; + } + + m_alpha = imageDescription.caps & DICAPS_ALPHACHANNEL; + resize(surfaceDescription.width, surfaceDescription.height); + // TODO: FIXME; update d + + + result = provider->RenderTo(provider.data(), dfbBlitter()->dfbSurface(), 0); + if (result != DFB_OK) { + DirectFBError(QDFB_PRETTY, result); + return false; + } + + return true; +} + +bool QDirectFbBlitterPlatformPixmap::fromFile(const QString &filename, const char *format, + Qt::ImageConversionFlags flags) +{ + // If we can't find the file, pass it on to the base class as it is + // trying harder by appending various extensions to the path. + if (!QFile::exists(filename)) + return QBlittablePixmapData::fromFile(filename, format, flags); + + // Stop if there is a requirement for colors + if (flags != Qt::AutoColor) + return QBlittablePixmapData::fromFile(filename, format, flags); + + // Deal with resources + if (filename.startsWith(QLatin1Char(':'))) { // resource + QFile file(filename); + if (!file.open(QIODevice::ReadOnly)) + return false; + const QByteArray data = file.readAll(); + file.close(); + return fromData(reinterpret_cast<const uchar*>(data.constData()), data.size(), format, flags); + } + + // Try to use directfb to load it. + DFBDataBufferDescription description; + description.flags = DBDESC_FILE; + const QByteArray fileNameData = filename.toLocal8Bit(); + description.file = fileNameData.constData(); + if (fromDataBufferDescription(description)) + return true; + + // Fallback + return QBlittablePixmapData::fromFile(filename, format, flags); +} + void QDirectFbBlitter::doUnlock() { - m_surface->Unlock(m_surface); + m_surface->Unlock(m_surface.data()); } + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.h b/src/plugins/platforms/directfb/qdirectfbblitter.h index 16d7599..fe39aaf 100644 --- a/src/plugins/platforms/directfb/qdirectfbblitter.h +++ b/src/plugins/platforms/directfb/qdirectfbblitter.h @@ -48,29 +48,63 @@ #include <directfb.h> +QT_BEGIN_NAMESPACE + class QDirectFbBlitter : public QBlittable { public: - QDirectFbBlitter(const QSize &size, IDirectFBSurface *surface = 0); + QDirectFbBlitter(const QSize &size, IDirectFBSurface *surface); + QDirectFbBlitter(const QSize &size, bool alpha); virtual ~QDirectFbBlitter(); virtual void fillRect(const QRectF &rect, const QColor &color); virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect); + IDirectFBSurface *dfbSurface() const; + + static DFBSurfacePixelFormat alphaPixmapFormat(); + static DFBSurfacePixelFormat pixmapFormat(); + static DFBSurfacePixelFormat selectPixmapFormat(bool withAlpha); + protected: virtual QImage *doLock(); virtual void doUnlock(); - IDirectFBSurface *m_surface; + QDirectFBPointer<IDirectFBSurface> m_surface; QImage m_image; friend class QDirectFbConvenience; }; -class QDirectFbBlitterPixmapData : public QBlittablePixmapData +class QDirectFbBlitterPlatformPixmap : public QBlittablePixmapData { public: - QBlittable *createBlittable(const QSize &size) const { return new QDirectFbBlitter(size); } + QBlittable *createBlittable(const QSize &size, bool alpha) const; + + QDirectFbBlitter *dfbBlitter() const; + + virtual bool fromFile(const QString &filename, const char *format, + Qt::ImageConversionFlags flags); + +private: + bool fromDataBufferDescription(const DFBDataBufferDescription &); }; +inline QBlittable *QDirectFbBlitterPlatformPixmap::createBlittable(const QSize& size, bool alpha) const +{ + return new QDirectFbBlitter(size, alpha); +} + +inline QDirectFbBlitter *QDirectFbBlitterPlatformPixmap::dfbBlitter() const +{ + return static_cast<QDirectFbBlitter*>(blittable()); +} + +inline IDirectFBSurface *QDirectFbBlitter::dfbSurface() const +{ + return m_surface.data(); +} + +QT_END_NAMESPACE + #endif // QDIRECTFBBLITTER_H diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp index 37810dc..83c71b3 100644 --- a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp +++ b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp @@ -41,16 +41,22 @@ #include "qdirectfbconvenience.h" #include "qdirectfbblitter.h" +#include "qdirectfbscreen.h" #include <private/qpixmap_blitter_p.h> +#include <QtGui/QWidget> +#include <QtGui/QScreen> + +QT_BEGIN_NAMESPACE + IDirectFB *QDirectFbConvenience::dfbInterface() { static IDirectFB *dfb = 0; if (!dfb) { DFBResult result = DirectFBCreate(&dfb); if (result != DFB_OK) { - DirectFBError("QDirectFBConvenience: error creating DirectFB interface",result); + DirectFBErrorFatal("QDirectFBConvenience: error creating DirectFB interface", result); return 0; } } @@ -61,10 +67,9 @@ IDirectFBDisplayLayer *QDirectFbConvenience::dfbDisplayLayer(int display) { IDirectFBDisplayLayer *layer; DFBResult result = QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),display,&layer); - if (result != DFB_OK) { - DirectFBError("QDirectFbConvenience: " - "Unable to get primary display layer!", result); - } + if (result != DFB_OK) + DirectFBErrorFatal("QDirectFbConvenience: " + "Unable to get primary display layer!", result); return layer; } @@ -106,13 +111,17 @@ int QDirectFbConvenience::colorDepthForSurface(const DFBSurfacePixelFormat forma return ((0x1f << 7) & format) >> 7; } -IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPixmapData(QPixmapData *pixmapData) +/** + * This is borrowing the reference of the QDirectFbBlitter. You may not store this + * pointer as a class member but must only use it locally. + */ +IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPlatformPixmap(QPixmapData *handle) { - QBlittablePixmapData *blittablePmData = static_cast<QBlittablePixmapData *>(pixmapData); + QBlittablePixmapData *blittablePmData = static_cast<QBlittablePixmapData *>(handle); if (blittablePmData) { QBlittable *blittable = blittablePmData->blittable(); QDirectFbBlitter *dfbBlitter = static_cast<QDirectFbBlitter *>(blittable); - return dfbBlitter->m_surface; + return dfbBlitter->m_surface.data(); } return 0; } @@ -374,3 +383,15 @@ QDirectFbKeyMap::QDirectFbKeyMap() insert(DIKS_CURLY_BRACKET_RIGHT , Qt::Key_BraceRight); insert(DIKS_TILDE , Qt::Key_AsciiTilde); } + +QDirectFbScreen *toDfbScreen(QWidget *window) +{ + return static_cast<QDirectFbScreen*>(QPlatformScreen::platformScreenForWidget(window)); +} + +IDirectFBDisplayLayer *toDfbLayer(QPlatformScreen *screen) +{ + return static_cast<QDirectFbScreen*>(screen)->dfbLayer(); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.h b/src/plugins/platforms/directfb/qdirectfbconvenience.h index c82bea8..d009393 100644 --- a/src/plugins/platforms/directfb/qdirectfbconvenience.h +++ b/src/plugins/platforms/directfb/qdirectfbconvenience.h @@ -49,6 +49,11 @@ #include <directfb.h> +QT_BEGIN_NAMESPACE + +class QDirectFbScreen; +class QPlatformScreen; + class QDirectFbKeyMap: public QHash<DFBInputDeviceKeySymbol, Qt::Key> { public: @@ -67,7 +72,7 @@ public: static IDirectFB *dfbInterface(); static IDirectFBDisplayLayer *dfbDisplayLayer(int display = DLID_PRIMARY); - static IDirectFBSurface *dfbSurfaceForPixmapData(QPixmapData *); + static IDirectFBSurface *dfbSurfaceForPlatformPixmap(QPixmapData *); static Qt::MouseButton mouseButton(DFBInputDeviceButtonIdentifier identifier); static Qt::MouseButtons mouseButtons(DFBInputDeviceButtonMask mask); @@ -81,4 +86,41 @@ private: friend class QDirectFbIntegration; }; +template <typename T> struct QDirectFBInterfaceCleanupHandler +{ + static void cleanup(T *t) + { + if (!t) + return; + t->Release(t); + } +}; + +template <typename T> +class QDirectFBPointer : public QScopedPointer<T, QDirectFBInterfaceCleanupHandler<T> > +{ +public: + QDirectFBPointer(T *t = 0) + : QScopedPointer<T, QDirectFBInterfaceCleanupHandler<T> >(t) + {} + + T** outPtr() + { + this->reset(0); + return &this->d; + } +}; + +// Helper conversions from internal to DFB types +QDirectFbScreen *toDfbScreen(QWidget *window); +IDirectFBDisplayLayer *toDfbLayer(QPlatformScreen *screen); + +#define QDFB_STRINGIFY(x) #x +#define QDFB_TOSTRING(x) QDFB_STRINGIFY(x) +#define QDFB_PRETTY \ + (__FILE__ ":" QDFB_TOSTRING(__LINE__)) + +QT_END_NAMESPACE + + #endif // QDIRECTFBCONVENIENCE_H diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.cpp b/src/plugins/platforms/directfb/qdirectfbcursor.cpp index 8a38bc4..ea9be84 100644 --- a/src/plugins/platforms/directfb/qdirectfbcursor.cpp +++ b/src/plugins/platforms/directfb/qdirectfbcursor.cpp @@ -42,26 +42,25 @@ #include "qdirectfbcursor.h" #include "qdirectfbconvenience.h" +QT_BEGIN_NAMESPACE -QDirectFBCursor::QDirectFBCursor(QPlatformScreen* screen) : - QPlatformCursor(screen), surface(0) +QDirectFBCursor::QDirectFBCursor(QPlatformScreen *screen) + : QPlatformCursor(screen) { - QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY, &m_layer); - image = new QPlatformCursorImage(0, 0, 0, 0, 0, 0); + m_image.reset(new QPlatformCursorImage(0, 0, 0, 0, 0, 0)); } -void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) +void QDirectFBCursor::changeCursor(QCursor *cursor, QWidget *) { - Q_UNUSED(widget); int xSpot; int ySpot; QPixmap map; if (cursor->shape() != Qt::BitmapCursor) { - image->set(cursor->shape()); - xSpot = image->hotspot().x(); - ySpot = image->hotspot().y(); - QImage *i = image->image(); + m_image->set(cursor->shape()); + xSpot = m_image->hotspot().x(); + ySpot = m_image->hotspot().y(); + QImage *i = m_image->image(); map = QPixmap::fromImage(*i); } else { QPoint point = cursor->hotSpot(); @@ -70,11 +69,18 @@ void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget) map = cursor->pixmap(); } - IDirectFBSurface *surface = QDirectFbConvenience::dfbSurfaceForPixmapData(map.pixmapData()); + DFBResult res; + IDirectFBDisplayLayer *layer = toDfbLayer(screen); + IDirectFBSurface* surface(QDirectFbConvenience::dfbSurfaceForPlatformPixmap(map.pixmapData())); - if (m_layer->SetCooperativeLevel(m_layer, DLSCL_ADMINISTRATIVE) != DFB_OK) { + res = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); + if (res != DFB_OK) { + DirectFBError("Failed to set DLSCL_ADMINISTRATIVE", res); return; } - m_layer->SetCursorShape( m_layer, surface, xSpot, ySpot); - m_layer->SetCooperativeLevel(m_layer, DLSCL_SHARED); + + layer->SetCursorShape(layer, surface, xSpot, ySpot); + layer->SetCooperativeLevel(layer, DLSCL_SHARED); } + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.h b/src/plugins/platforms/directfb/qdirectfbcursor.h index b148de5..2f8efba 100644 --- a/src/plugins/platforms/directfb/qdirectfbcursor.h +++ b/src/plugins/platforms/directfb/qdirectfbcursor.h @@ -44,20 +44,24 @@ #include <QPlatformCursor> #include <directfb.h> + +#include "qdirectfbconvenience.h" + +QT_BEGIN_NAMESPACE + class QDirectFbScreen; class QDirectFbBlitter; class QDirectFBCursor : public QPlatformCursor { public: - QDirectFBCursor(QPlatformScreen *screem); - void changeCursor(QCursor * cursor, QWidget * widget); + QDirectFBCursor(QPlatformScreen *screen); + void changeCursor(QCursor *cursor, QWidget *window); private: - IDirectFBDisplayLayer * m_layer; - IDirectFBSurface * surface; - QPlatformCursorImage * image; - QDirectFbBlitter *blitter; + QScopedPointer<QPlatformCursorImage> m_image; }; +QT_END_NAMESPACE + #endif // QDIRECTFBCURSOR_H diff --git a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp index aca28f1..4111774 100644 --- a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp +++ b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp @@ -45,6 +45,8 @@ #include <QDebug> +QT_BEGIN_NAMESPACE + QDirectFbGLContext::QDirectFbGLContext(IDirectFBGL *glContext) : m_dfbGlContext(glContext) { @@ -99,3 +101,5 @@ QPlatformWindowFormat QDirectFbGLContext::platformWindowFormat() const { return m_windowFormat; } + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbinput.cpp b/src/plugins/platforms/directfb/qdirectfbinput.cpp index d35cea5..34dbc9d 100644 --- a/src/plugins/platforms/directfb/qdirectfbinput.cpp +++ b/src/plugins/platforms/directfb/qdirectfbinput.cpp @@ -47,65 +47,71 @@ #include <QWindowSystemInterface> #include <QMouseEvent> #include <QEvent> -#include <QApplication> #include <directfb.h> -QDirectFbInput::QDirectFbInput(QObject *parent) - : QObject(parent), m_shouldStop(false) -{ - m_dfbInterface = QDirectFbConvenience::dfbInterface(); +QT_BEGIN_NAMESPACE - DFBResult ok = m_dfbInterface->CreateEventBuffer(m_dfbInterface,&m_eventBuffer); +QDirectFbInput::QDirectFbInput(IDirectFB *dfb, IDirectFBDisplayLayer *dfbLayer) + : m_dfbInterface(dfb) + , m_dfbDisplayLayer(dfbLayer) + , m_shouldStop(false) +{ + DFBResult ok = m_dfbInterface->CreateEventBuffer(m_dfbInterface, m_eventBuffer.outPtr()); if (ok != DFB_OK) DirectFBError("Failed to initialise eventbuffer", ok); - - m_dfbInterface->GetDisplayLayer(m_dfbInterface,DLID_PRIMARY, &m_dfbDisplayLayer); - } -void QDirectFbInput::runInputEventLoop() +void QDirectFbInput::run() { - while (true) { - m_eventBuffer->WaitForEvent(m_eventBuffer); - if (m_shouldStop) { - m_waitStop.release(); - break; - } - handleEvents(); + while (!m_shouldStop) { + if (m_eventBuffer->WaitForEvent(m_eventBuffer.data()) == DFB_OK) + handleEvents(); } } void QDirectFbInput::stopInputEventLoop() { m_shouldStop = true; - m_waitStop.acquire(); + m_eventBuffer->WakeUp(m_eventBuffer.data()); } -void QDirectFbInput::addWindow(DFBWindowID id, QWidget *tlw) +void QDirectFbInput::addWindow(IDirectFBWindow *window, QWidget *platformWindow) { - m_tlwMap.insert(id,tlw); - IDirectFBWindow *window; - m_dfbDisplayLayer->GetWindow(m_dfbDisplayLayer,id,&window); + DFBResult res; + DFBWindowID id; - window->AttachEventBuffer(window,m_eventBuffer); + res = window->GetID(window, &id); + if (res != DFB_OK) { + DirectFBError("QDirectFbInput::addWindow", res); + return; + } + + m_tlwMap.insert(id, platformWindow); + window->AttachEventBuffer(window, m_eventBuffer.data()); } -void QDirectFbInput::removeWindow(WId wId) +void QDirectFbInput::removeWindow(IDirectFBWindow *window) { - IDirectFBWindow *window; - m_dfbDisplayLayer->GetWindow(m_dfbDisplayLayer,wId, &window); + DFBResult res; + DFBWindowID id; - window->DetachEventBuffer(window,m_eventBuffer); - m_tlwMap.remove(wId); + res = window->GetID(window, &id); + if (res != DFB_OK) { + DirectFBError("QDirectFbInput::removeWindow", res); + return; + } + + window->DetachEventBuffer(window, m_eventBuffer.data()); + m_tlwMap.remove(id); } void QDirectFbInput::handleEvents() { - DFBResult hasEvent = m_eventBuffer->HasEvent(m_eventBuffer); + DFBResult hasEvent = m_eventBuffer->HasEvent(m_eventBuffer.data()); while(hasEvent == DFB_OK){ DFBEvent event; - DFBResult ok = m_eventBuffer->GetEvent(m_eventBuffer,&event); + DFBResult ok = m_eventBuffer->GetEvent(m_eventBuffer.data(), &event); if (ok != DFB_OK) DirectFBError("Failed to get event",ok); if (event.clazz == DFEC_WINDOW) { @@ -131,7 +137,7 @@ void QDirectFbInput::handleEvents() } - hasEvent = m_eventBuffer->HasEvent(m_eventBuffer); + hasEvent = m_eventBuffer->HasEvent(m_eventBuffer.data()); } } @@ -141,17 +147,12 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event) QPoint globalPos = globalPoint(event); Qt::MouseButtons buttons = QDirectFbConvenience::mouseButtons(event.window.buttons); - IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); - IDirectFBWindow *window; - layer->GetWindow(layer,event.window.window_id,&window); + QDirectFBPointer<IDirectFBDisplayLayer> layer(QDirectFbConvenience::dfbDisplayLayer()); + QDirectFBPointer<IDirectFBWindow> window; + layer->GetWindow(layer.data(), event.window.window_id, window.outPtr()); long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); - if (event.window.type == DWET_BUTTONDOWN) { - window->GrabPointer(window); - } else if (event.window.type == DWET_BUTTONUP) { - window->UngrabPointer(window); - } QWidget *tlw = m_tlwMap.value(event.window.window_id); QWindowSystemInterface::handleMouseEvent(tlw, timestamp, p, globalPos, buttons); } @@ -199,10 +200,11 @@ void QDirectFbInput::handleEnterLeaveEvents(const DFBEvent &event) inline QPoint QDirectFbInput::globalPoint(const DFBEvent &event) const { - IDirectFBWindow *window; - m_dfbDisplayLayer->GetWindow(m_dfbDisplayLayer,event.window.window_id,&window); + QDirectFBPointer<IDirectFBWindow> window; + m_dfbDisplayLayer->GetWindow(m_dfbDisplayLayer, event.window.window_id, window.outPtr()); int x,y; - window->GetPosition(window,&x,&y); + window->GetPosition(window.data(), &x, &y); return QPoint(event.window.cx +x, event.window.cy + y); } +QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbinput.h b/src/plugins/platforms/directfb/qdirectfbinput.h index 3b8008f..698ee3a 100644 --- a/src/plugins/platforms/directfb/qdirectfbinput.h +++ b/src/plugins/platforms/directfb/qdirectfbinput.h @@ -42,30 +42,30 @@ #ifndef QDIRECTFBINPUT_H #define QDIRECTFBINPUT_H -#include <QSemaphore> -#include <QObject> +#include <QThread> #include <QHash> #include <QPoint> #include <QEvent> #include <QtGui/qwindowdefs.h> -#include <directfb.h> +#include "qdirectfbconvenience.h" -class QDirectFbInput : public QObject +class QDirectFbInput : public QThread { Q_OBJECT public: - QDirectFbInput(QObject *parent); - void addWindow(DFBWindowID id, QWidget *tlw); - void removeWindow(WId wId); + QDirectFbInput(IDirectFB *dfb, IDirectFBDisplayLayer *dfbLayer); + void addWindow(IDirectFBWindow *window, QWidget *platformWindow); + void removeWindow(IDirectFBWindow *window); -public slots: - void runInputEventLoop(); void stopInputEventLoop(); - void handleEvents(); + +protected: + void run(); private: + void handleEvents(); void handleMouseEvents(const DFBEvent &event); void handleWheelEvent(const DFBEvent &event); void handleKeyEvents(const DFBEvent &event); @@ -75,11 +75,9 @@ private: IDirectFB *m_dfbInterface; IDirectFBDisplayLayer *m_dfbDisplayLayer; - IDirectFBEventBuffer *m_eventBuffer; + QDirectFBPointer<IDirectFBEventBuffer> m_eventBuffer; bool m_shouldStop; - QSemaphore m_waitStop; - QHash<DFBWindowID,QWidget *>m_tlwMap; }; diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp index 06b0b51..15f0036 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp +++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp @@ -46,43 +46,27 @@ #include "qdirectfbcursor.h" #include "qdirectfbwindow.h" -#include "qgenericunixfontdatabase.h" - -#include <private/qwindowsurface_raster_p.h> -#include <private/qpixmap_raster_p.h> - #include <QtGui/private/qpixmap_blitter_p.h> -#include <QtGui/private/qpixmapdata_p.h> +#include <QtGui/private/qpixmap_raster_p.h> #include <QtCore/QCoreApplication> #include <QtCore/QThread> -QT_BEGIN_NAMESPACE - -QDirectFbScreen::QDirectFbScreen(int display) - :QPlatformScreen() -{ - m_layer = QDirectFbConvenience::dfbDisplayLayer(display); - m_layer->SetCooperativeLevel(m_layer,DLSCL_SHARED); - - DFBDisplayLayerConfig config; - m_layer->GetConfiguration(m_layer, &config); +#include "qgenericunixfontdatabase.h" - m_format = QDirectFbConvenience::imageFormatFromSurfaceFormat(config.pixelformat, config.surface_caps); - m_geometry = QRect(0,0,config.width,config.height); - const int dpi = 72; - const qreal inch = 25.4; - m_depth = QDirectFbConvenience::colorDepthForSurface(config.pixelformat); - m_physicalSize = QSize(qRound(config.width * inch / dpi), qRound(config.height *inch / dpi)); +QT_BEGIN_NAMESPACE - cursor = new QDirectFBCursor(this); -} +QDirectFbIntegration::QDirectFbIntegration() + : m_fontDb(new QGenericUnixFontDatabase()) +{} -QDirectFbScreen::~QDirectFbScreen() +void QDirectFbIntegration::initialize() { + initializeDirectFB(); + initializeScreen(); + initializeInput(); } -QDirectFbIntegration::QDirectFbIntegration() - : mFontDb(new QGenericUnixFontDatabase()) +void QDirectFbIntegration::initializeDirectFB() { const QStringList args = QCoreApplication::arguments(); int argc = args.size(); @@ -96,26 +80,31 @@ QDirectFbIntegration::QDirectFbIntegration() DirectFBError("QDirectFBScreen: error initializing DirectFB", result); } + + for (int i = 0; i < argc; ++i) + delete[] argv[i]; delete[] argv; + // This must happen after DirectFBInit. + m_dfb.reset(QDirectFbConvenience::dfbInterface()); +} - QDirectFbScreen *primaryScreen = new QDirectFbScreen(0); - mScreens.append(primaryScreen); +void QDirectFbIntegration::initializeScreen() +{ + m_primaryScreen.reset(new QDirectFbScreen(0)); + mScreens.append(m_primaryScreen.data()); +} - mInputRunner = new QThread; - mInput = new QDirectFbInput(0); - mInput->moveToThread(mInputRunner); - QObject::connect(mInputRunner,SIGNAL(started()),mInput,SLOT(runInputEventLoop())); - mInputRunner->start(); +void QDirectFbIntegration::initializeInput() +{ + m_input.reset(new QDirectFbInput(m_dfb.data(), m_primaryScreen->dfbLayer())); + m_input->start(); } QDirectFbIntegration::~QDirectFbIntegration() { - mInput->stopInputEventLoop(); - mInputRunner->quit(); - mInputRunner->wait(); - delete mInputRunner; - delete mInput; + m_input->stopInputEventLoop(); + m_input->wait(); } QPixmapData *QDirectFbIntegration::createPixmapData(QPixmapData::PixelType type) const @@ -123,24 +112,22 @@ QPixmapData *QDirectFbIntegration::createPixmapData(QPixmapData::PixelType type) if (type == QPixmapData::BitmapType) return new QRasterPixmapData(type); else - return new QDirectFbBlitterPixmapData; + return new QDirectFbBlitterPlatformPixmap; } -QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWidget *widget, WId winId) const +QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWidget *window, WId) const { - Q_UNUSED(winId); - QDirectFbInput *input = const_cast<QDirectFbInput *>(mInput);//gah - return new QDirectFbWindow(widget,input); + return new QDirectFbWindow(window,m_input.data()); } -QWindowSurface *QDirectFbIntegration::createWindowSurface(QWidget *widget, WId winId) const +QWindowSurface *QDirectFbIntegration::createWindowSurface(QWidget *window, WId) const { - return new QDirectFbWindowSurface(widget,winId); + return new QDirectFbWindowSurface(window); } QPlatformFontDatabase *QDirectFbIntegration::fontDatabase() const { - return mFontDb; + return m_fontDb.data(); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.h b/src/plugins/platforms/directfb/qdirectfbintegration.h index 0e8337a..93e3d60 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.h +++ b/src/plugins/platforms/directfb/qdirectfbintegration.h @@ -43,6 +43,7 @@ #define QPLATFORMINTEGRATION_DIRECTFB_H #include "qdirectfbinput.h" +#include "qdirectfbscreen.h" #include <QtGui/QPlatformIntegration> #include <directfb.h> @@ -51,32 +52,6 @@ QT_BEGIN_NAMESPACE class QThread; -class QDirectFBCursor; - -class QDirectFbScreen : public QPlatformScreen -{ -Q_OBJECT -public: - QDirectFbScreen(int display); - ~QDirectFbScreen(); - - QRect geometry() const { return m_geometry; } - int depth() const { return m_depth; } - QImage::Format format() const { return m_format; } - QSize physicalSize() const { return m_physicalSize; } - -public: - QRect m_geometry; - int m_depth; - QImage::Format m_format; - QSize m_physicalSize; - - IDirectFBDisplayLayer *m_layer; - -private: - QDirectFBCursor * cursor; - -}; class QDirectFbIntegration : public QPlatformIntegration { @@ -92,11 +67,20 @@ public: QPlatformFontDatabase *fontDatabase() const; -private: + void initialize(); + +protected: + virtual void initializeDirectFB(); + virtual void initializeScreen(); + virtual void initializeInput(); + +protected: QList<QPlatformScreen *> mScreens; - QDirectFbInput *mInput; - QThread *mInputRunner; - QPlatformFontDatabase *mFontDb; + QDirectFBPointer<IDirectFB> m_dfb; + QScopedPointer<QDirectFbScreen> m_primaryScreen; + QScopedPointer<QDirectFbInput> m_input; + QScopedPointer<QThread> m_inputRunner; + QScopedPointer<QPlatformFontDatabase> m_fontDb; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbscreen.cpp b/src/plugins/platforms/directfb/qdirectfbscreen.cpp new file mode 100644 index 0000000..1d4b701 --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbscreen.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdirectfbscreen.h" +#include "qdirectfbcursor.h" + +QT_BEGIN_NAMESPACE + +QDirectFbScreen::QDirectFbScreen(int display) + : QPlatformScreen() + , m_layer(QDirectFbConvenience::dfbDisplayLayer(display)) +{ + m_layer->SetCooperativeLevel(m_layer.data(), DLSCL_SHARED); + + DFBDisplayLayerConfig config; + m_layer->GetConfiguration(m_layer.data(), &config); + + m_format = QDirectFbConvenience::imageFormatFromSurfaceFormat(config.pixelformat, config.surface_caps); + m_geometry = QRect(0, 0, config.width, config.height); + const int dpi = 72; + const qreal inch = 25.4; + m_depth = QDirectFbConvenience::colorDepthForSurface(config.pixelformat); + m_physicalSize = QSize(config.width, config.height) * inch / dpi; + + m_cursor.reset(new QDirectFBCursor(this)); +} + +IDirectFBDisplayLayer *QDirectFbScreen::dfbLayer() const +{ + return m_layer.data(); +} + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbscreen.h b/src/plugins/platforms/directfb/qdirectfbscreen.h new file mode 100644 index 0000000..1ec3a48 --- /dev/null +++ b/src/plugins/platforms/directfb/qdirectfbscreen.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDIRECTFBSCREEN_H +#define QDIRECTFBSCREEN_H + +#include "qdirectfbconvenience.h" +#include "qdirectfbcursor.h" + +#include <QtGui/QPlatformIntegration> + +#include <directfb.h> + +QT_BEGIN_NAMESPACE + + +class QDirectFbScreen : public QPlatformScreen +{ +public: + QDirectFbScreen(int display); + + QRect geometry() const { return m_geometry; } + int depth() const { return m_depth; } + QImage::Format format() const { return m_format; } + QSize physicalSize() const { return m_physicalSize; } + + // DirectFb helpers + IDirectFBDisplayLayer *dfbLayer() const; + +public: + QRect m_geometry; + int m_depth; + QImage::Format m_format; + QSize m_physicalSize; + + QDirectFBPointer<IDirectFBDisplayLayer> m_layer; + +private: + QScopedPointer<QDirectFBCursor> m_cursor; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.cpp b/src/plugins/platforms/directfb/qdirectfbwindow.cpp index d2c411e..0b6be91 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindow.cpp +++ b/src/plugins/platforms/directfb/qdirectfbwindow.cpp @@ -40,21 +40,23 @@ ****************************************************************************/ #include "qdirectfbwindow.h" +#include "qdirectfbwindowsurface.h" #include "qdirectfbinput.h" -#include "qdirectfbglcontext.h" - -#include <QWidget> +#include "qdirectfbscreen.h" -#include "qdirectfbwindowsurface.h" #include <directfb.h> +QT_BEGIN_NAMESPACE + QDirectFbWindow::QDirectFbWindow(QWidget *tlw, QDirectFbInput *inputhandler) - : QPlatformWindow(tlw), m_inputHandler(inputhandler), m_context(0) + : QPlatformWindow(tlw), m_inputHandler(inputhandler) { - IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); DFBDisplayLayerConfig layerConfig; - layer->GetConfiguration(layer,&layerConfig); + IDirectFBDisplayLayer *layer; + + layer = toDfbScreen(tlw)->dfbLayer(); + toDfbScreen(tlw)->dfbLayer()->GetConfiguration(layer, &layerConfig); DFBWindowDescription description; memset(&description,0,sizeof(DFBWindowDescription)); @@ -63,10 +65,10 @@ QDirectFbWindow::QDirectFbWindow(QWidget *tlw, QDirectFbInput *inputhandler) |DWDESC_OPTIONS #endif |DWDESC_CAPS); - description.width = tlw->rect().width(); - description.height = tlw->rect().height(); - description.posx = tlw->rect().x(); - description.posy = tlw->rect().y(); + description.width = tlw->width(); + description.height = tlw->height(); + description.posx = tlw->x(); + description.posy = tlw->y(); if (layerConfig.surface_caps & DSCAPS_PREMULTIPLIED) description.surface_caps = DSCAPS_PREMULTIPLIED; @@ -78,34 +80,32 @@ QDirectFbWindow::QDirectFbWindow(QWidget *tlw, QDirectFbInput *inputhandler) description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER|DWCAPS_ALPHACHANNEL); description.surface_caps = DSCAPS_PREMULTIPLIED; - DFBResult result = layer->CreateWindow(layer,&description,&m_dfbWindow); + DFBResult result = layer->CreateWindow(layer, &description, m_dfbWindow.outPtr()); if (result != DFB_OK) { DirectFBError("QDirectFbGraphicsSystemScreen: failed to create window",result); } - m_dfbWindow->SetOpacity(m_dfbWindow,0xff); + m_dfbWindow->SetOpacity(m_dfbWindow.data(), 0xff); setVisible(widget()->isVisible()); - DFBWindowID id; - m_dfbWindow->GetID(m_dfbWindow, &id); - m_inputHandler->addWindow(id,tlw); + m_inputHandler->addWindow(m_dfbWindow.data(), tlw); } QDirectFbWindow::~QDirectFbWindow() { - m_inputHandler->removeWindow(winId()); - m_dfbWindow->Destroy(m_dfbWindow); + m_inputHandler->removeWindow(m_dfbWindow.data()); + m_dfbWindow->Destroy(m_dfbWindow.data()); } void QDirectFbWindow::setGeometry(const QRect &rect) { bool isMoveOnly = (rect.topLeft() != geometry().topLeft()) && (rect.size() == geometry().size()); + QPlatformWindow::setGeometry(rect); if (widget()->isVisible() && !(widget()->testAttribute(Qt::WA_DontShowOnScreen))) { - m_dfbWindow->SetBounds(m_dfbWindow, rect.x(),rect.y(), + m_dfbWindow->SetBounds(m_dfbWindow.data(), rect.x(),rect.y(), rect.width(), rect.height()); - //Hack. When moving since the WindowSurface of a window becomes invalid when moved if (isMoveOnly) { //if resize then windowsurface is updated. widget()->windowSurface()->resize(rect.size()); @@ -117,7 +117,7 @@ void QDirectFbWindow::setGeometry(const QRect &rect) void QDirectFbWindow::setOpacity(qreal level) { const quint8 windowOpacity = quint8(level * 0xff); - m_dfbWindow->SetOpacity(m_dfbWindow,windowOpacity); + m_dfbWindow->SetOpacity(m_dfbWindow.data(), windowOpacity); } void QDirectFbWindow::setVisible(bool visible) @@ -125,14 +125,14 @@ void QDirectFbWindow::setVisible(bool visible) if (visible) { int x = geometry().x(); int y = geometry().y(); - m_dfbWindow->MoveTo(m_dfbWindow,x,y); + m_dfbWindow->MoveTo(m_dfbWindow.data(), x, y); } else { - IDirectFBDisplayLayer *displayLayer; - QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY,&displayLayer); + QDirectFBPointer<IDirectFBDisplayLayer> displayLayer; + QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(), DLID_PRIMARY, displayLayer.outPtr()); DFBDisplayLayerConfig config; - displayLayer->GetConfiguration(displayLayer,&config); - m_dfbWindow->MoveTo(m_dfbWindow,config.width+1,config.height + 1); + displayLayer->GetConfiguration(displayLayer.data(), &config); + m_dfbWindow->MoveTo(m_dfbWindow.data(), config. width + 1, config.height + 1); } } @@ -141,51 +141,73 @@ Qt::WindowFlags QDirectFbWindow::setWindowFlags(Qt::WindowFlags flags) switch (flags & Qt::WindowType_Mask) { case Qt::ToolTip: { DFBWindowOptions options; - m_dfbWindow->GetOptions(m_dfbWindow,&options); + m_dfbWindow->GetOptions(m_dfbWindow.data(), &options); options = DFBWindowOptions(options | DWOP_GHOST); - m_dfbWindow->SetOptions(m_dfbWindow,options); + m_dfbWindow->SetOptions(m_dfbWindow.data(), options); break; } default: break; } - m_dfbWindow->SetStackingClass(m_dfbWindow, flags & Qt::WindowStaysOnTopHint ? DWSC_UPPER : DWSC_MIDDLE); + m_dfbWindow->SetStackingClass(m_dfbWindow.data(), flags & Qt::WindowStaysOnTopHint ? DWSC_UPPER : DWSC_MIDDLE); return flags; } void QDirectFbWindow::raise() { - m_dfbWindow->RaiseToTop(m_dfbWindow); + m_dfbWindow->RaiseToTop(m_dfbWindow.data()); } void QDirectFbWindow::lower() { - m_dfbWindow->LowerToBottom(m_dfbWindow); + m_dfbWindow->LowerToBottom(m_dfbWindow.data()); } WId QDirectFbWindow::winId() const { DFBWindowID id; - m_dfbWindow->GetID(m_dfbWindow, &id); + m_dfbWindow->GetID(m_dfbWindow.data(), &id); return WId(id); } -QPlatformGLContext *QDirectFbWindow::glContext() const +bool QDirectFbWindow::setKeyboardGrabEnabled(bool grab) { - if (!m_context) { - IDirectFBSurface *surface; - DFBResult result = m_dfbWindow->GetSurface(m_dfbWindow,&surface); - if (result != DFB_OK) { - qWarning("could not retrieve surface in QDirectFbWindow::glContext()"); - return 0; - } - IDirectFBGL *gl; - result = surface->GetGL(surface,&gl); - if (result != DFB_OK) { - qWarning("could not retrieve IDirectFBGL in QDirectFbWindow::glContext()"); - return 0; - } - const_cast<QDirectFbWindow *>(this)->m_context = new QDirectFbGLContext(gl); + DFBResult res; + + if (grab) + res = m_dfbWindow->GrabKeyboard(m_dfbWindow.data()); + else + res = m_dfbWindow->UngrabKeyboard(m_dfbWindow.data()); + + return res == DFB_OK; +} + +bool QDirectFbWindow::setMouseGrabEnabled(bool grab) +{ + DFBResult res; + + if (grab) + res = m_dfbWindow->GrabPointer(m_dfbWindow.data()); + else + res = m_dfbWindow->UngrabPointer(m_dfbWindow.data()); + + return res == DFB_OK; +} + +IDirectFBWindow *QDirectFbWindow::dfbWindow() const +{ + return m_dfbWindow.data(); +} + +IDirectFBSurface *QDirectFbWindow::dfbSurface() +{ + if (!m_dfbSurface) { + DFBResult res = m_dfbWindow->GetSurface(m_dfbWindow.data(), m_dfbSurface.outPtr()); + if (res != DFB_OK) + DirectFBError(QDFB_PRETTY, res); } - return m_context; + + return m_dfbSurface.data(); } + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.h b/src/plugins/platforms/directfb/qdirectfbwindow.h index 4f839a0..349d8c8 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindow.h +++ b/src/plugins/platforms/directfb/qdirectfbwindow.h @@ -61,17 +61,21 @@ public: void setVisible(bool visible); Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); + bool setKeyboardGrabEnabled(bool grab); + bool setMouseGrabEnabled(bool grab); void raise(); void lower(); WId winId() const; - QPlatformGLContext *glContext() const; + IDirectFBWindow *dfbWindow() const; + + // helper to get access to DirectFB types + IDirectFBSurface *dfbSurface(); private: - IDirectFBWindow *m_dfbWindow; + QDirectFBPointer<IDirectFBSurface> m_dfbSurface; + QDirectFBPointer<IDirectFBWindow> m_dfbWindow; QDirectFbInput *m_inputHandler; - - QPlatformGLContext *m_context; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp index 730f01f..bf98e1d 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/platforms/directfb/qdirectfbwindowsurface.cpp @@ -43,39 +43,29 @@ #include "qdirectfbintegration.h" #include "qdirectfbblitter.h" #include "qdirectfbconvenience.h" +#include "qdirectfbwindow.h" #include <private/qpixmap_blitter_p.h> #include <QtCore/qdebug.h> QT_BEGIN_NAMESPACE -QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window, WId wId) - : QWindowSurface(window), m_pixmap(0), m_pmdata(0), m_dfbSurface(0) +QDirectFbWindowSurface::QDirectFbWindowSurface(QWidget *window) + : QWindowSurface(window), m_pixmap(0), m_pmdata(0) { + IDirectFBWindow *dfbWindow = static_cast<QDirectFbWindow *>(window->platformWindow())->dfbWindow(); + dfbWindow->GetSurface(dfbWindow, m_dfbSurface.outPtr()); - IDirectFBDisplayLayer *layer = QDirectFbConvenience::dfbDisplayLayer(); - - DFBWindowID id(wId); - IDirectFBWindow *dfbWindow; - - layer->GetWindow(layer,id,&dfbWindow); - - dfbWindow->GetSurface(dfbWindow,&m_dfbSurface); //WRONGSIZE - QDirectFbBlitter *blitter = new QDirectFbBlitter(window->rect().size(), m_dfbSurface); - m_pmdata = new QDirectFbBlitterPixmapData; + QDirectFbBlitter *blitter = new QDirectFbBlitter(window->size(), m_dfbSurface.data()); + m_pmdata = new QDirectFbBlitterPlatformPixmap; m_pmdata->setBlittable(blitter); - m_pixmap = new QPixmap(m_pmdata); -} - -QDirectFbWindowSurface::~QDirectFbWindowSurface() -{ - delete m_pixmap; + m_pixmap.reset(new QPixmap(m_pmdata)); } QPaintDevice *QDirectFbWindowSurface::paintDevice() { - return m_pixmap; + return m_pixmap.data(); } void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) @@ -87,17 +77,13 @@ void QDirectFbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const for (int i = 0 ; i < rects.size(); i++) { const QRect rect = rects.at(i); DFBRegion dfbReg = { rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y()}; - m_dfbSurface->Flip(m_dfbSurface, &dfbReg, DFBSurfaceFlipFlags(DSFLIP_BLIT|DSFLIP_ONSYNC)); + m_dfbSurface->Flip(m_dfbSurface.data(), &dfbReg, DFBSurfaceFlipFlags(DSFLIP_BLIT|DSFLIP_ONSYNC)); } } void QDirectFbWindowSurface::resize(const QSize &size) { - QWindowSurface::resize(size); - - //Have to add 1 ref ass it will be removed by deleting the old blitter in setBlittable - m_dfbSurface->AddRef(m_dfbSurface); - QDirectFbBlitter *blitter = new QDirectFbBlitter(size,m_dfbSurface); + QDirectFbBlitter *blitter = new QDirectFbBlitter(size, m_dfbSurface.data()); m_pmdata->setBlittable(blitter); } @@ -115,14 +101,14 @@ bool QDirectFbWindowSurface::scroll(const QRegion &area, int dx, int dy) if (!m_dfbSurface || area.isEmpty()) return false; - m_dfbSurface->SetBlittingFlags(m_dfbSurface, DSBLIT_NOFX); + m_dfbSurface->SetBlittingFlags(m_dfbSurface.data(), DSBLIT_NOFX); if (area.rectCount() == 1) { - scrollSurface(m_dfbSurface, area.boundingRect(), dx, dy); + scrollSurface(m_dfbSurface.data(), area.boundingRect(), dx, dy); } else { const QVector<QRect> rects = area.rects(); const int n = rects.size(); for (int i=0; i<n; ++i) { - scrollSurface(m_dfbSurface, rects.at(i), dx, dy); + scrollSurface(m_dfbSurface.data(), rects.at(i), dx, dy); } } return true; diff --git a/src/plugins/platforms/directfb/qdirectfbwindowsurface.h b/src/plugins/platforms/directfb/qdirectfbwindowsurface.h index 7f1140d..dd0354d 100644 --- a/src/plugins/platforms/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/platforms/directfb/qdirectfbwindowsurface.h @@ -44,16 +44,16 @@ #include <QtGui/private/qwindowsurface_p.h> #include <private/qpixmap_blitter_p.h> - #include <directfb.h> +#include "qdirectfbconvenience.h" + QT_BEGIN_NAMESPACE class QDirectFbWindowSurface : public QWindowSurface { public: - QDirectFbWindowSurface(QWidget *window, WId wid); - ~QDirectFbWindowSurface(); + QDirectFbWindowSurface(QWidget *window); QPaintDevice *paintDevice(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); @@ -66,10 +66,9 @@ public: private: void lockSurfaceToImage(); - QPixmap *m_pixmap; + QScopedPointer<QPixmap> m_pixmap; QBlittablePixmapData *m_pmdata; - - IDirectFBSurface *m_dfbSurface; + QDirectFBPointer<IDirectFBSurface> m_dfbSurface; }; QT_END_NAMESPACE diff --git a/src/s60installs/bwins/QtOpenVGu.def b/src/s60installs/bwins/QtOpenVGu.def index dc1ddce..547931e 100644 --- a/src/s60installs/bwins/QtOpenVGu.def +++ b/src/s60installs/bwins/QtOpenVGu.def @@ -159,7 +159,7 @@ EXPORTS ?hibernate@QVGImagePool@@UAEXXZ @ 158 NONAME ; void QVGImagePool::hibernate(void) ?qt_vg_destroy_context@@YAXPAVQEglContext@@H@Z @ 159 NONAME ; void qt_vg_destroy_context(class QEglContext *, int) ??0QVGImagePool@@QAE@XZ @ 160 NONAME ; QVGImagePool::QVGImagePool(void) - ?setImagePool@QVGImagePool@@SAXPAV1@@Z @ 161 NONAME ABSENT ; void QVGImagePool::setImagePool(class QVGImagePool *) + ?setImagePool@QVGImagePool@@SAXPAV1@@Z @ 161 NONAME ; void QVGImagePool::setImagePool(class QVGImagePool *) ?pixmapLRU@QVGImagePool@@IAEPAVQVGPixmapData@@XZ @ 162 NONAME ; class QVGPixmapData * QVGImagePool::pixmapLRU(void) ?qt_vg_create_context@@YAPAVQEglContext@@PAVQPaintDevice@@H@Z @ 163 NONAME ; class QEglContext * qt_vg_create_context(class QPaintDevice *, int) ?reclaimImages@QVGPixmapData@@UAEXXZ @ 164 NONAME ; void QVGPixmapData::reclaimImages(void) diff --git a/src/s60installs/eabi/QtOpenVGu.def b/src/s60installs/eabi/QtOpenVGu.def index f87c71d..a66df98 100644 --- a/src/s60installs/eabi/QtOpenVGu.def +++ b/src/s60installs/eabi/QtOpenVGu.def @@ -176,7 +176,7 @@ EXPORTS _ZN12QVGImagePool11detachImageEP13QVGPixmapData @ 175 NONAME _ZN12QVGImagePool12reclaimSpaceE13VGImageFormatllP13QVGPixmapData @ 176 NONAME _ZN12QVGImagePool12releaseImageEP13QVGPixmapDatam @ 177 NONAME - _ZN12QVGImagePool12setImagePoolEPS_ @ 178 NONAME ABSENT + _ZN12QVGImagePool12setImagePoolEPS_ @ 178 NONAME _ZN12QVGImagePool13removeFromLRUEP13QVGPixmapData @ 179 NONAME _ZN12QVGImagePool15moveToHeadOfLRUEP13QVGPixmapData @ 180 NONAME _ZN12QVGImagePool20createImageForPixmapE13VGImageFormatllmP13QVGPixmapData @ 181 NONAME diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index 38e4a63..8294a55 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -104,7 +104,6 @@ class QSQLiteDriverPrivate public: inline QSQLiteDriverPrivate() : access(0) {} sqlite3 *access; - QList <QSQLiteResult *> results; }; @@ -287,12 +286,10 @@ QSQLiteResult::QSQLiteResult(const QSQLiteDriver* db) { d = new QSQLiteResultPrivate(this); d->access = db->d->access; - db->d->results.append(this); } QSQLiteResult::~QSQLiteResult() { - qobject_cast<const QSQLiteDriver *>(driver())->d->results.removeOne(this); d->cleanup(); delete d; } @@ -556,10 +553,6 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c void QSQLiteDriver::close() { if (isOpen()) { - foreach (QSQLiteResult *result, d->results) { - result->d->finalize(); - } - if (sqlite3_close(d->access) != SQLITE_OK) setLastError(qMakeError(d->access, tr("Error closing database"), QSqlError::ConnectionError)); diff --git a/tests/auto/corelib.pro b/tests/auto/corelib.pro index 6810f76..cb1f2ef 100644 --- a/tests/auto/corelib.pro +++ b/tests/auto/corelib.pro @@ -105,6 +105,10 @@ SUBDIRS=\ qfilesystementry \ qabstractfileengine +!contains(QT_CONFIG, private_tests): SUBDIRS -= \ + qfileinfo \ + qfilesystementry \ + symbian:SUBDIRS -= \ qtconcurrentfilter \ qtconcurrentiteratekernel \ diff --git a/tests/auto/dbus.pro b/tests/auto/dbus.pro index 31b46a3..7470bf8 100644 --- a/tests/auto/dbus.pro +++ b/tests/auto/dbus.pro @@ -17,3 +17,5 @@ SUBDIRS=\ qdbusthreading \ qdbusxmlparser \ +!contains(QT_CONFIG, private_tests): SUBDIRS -= \ + qdbusmarshall \ diff --git a/tests/auto/gui.pro b/tests/auto/gui.pro index 17f56f2..cde39c2 100644 --- a/tests/auto/gui.pro +++ b/tests/auto/gui.pro @@ -209,11 +209,26 @@ SUBDIRS=\ win32:SUBDIRS -= qtextpiecetable !contains(QT_CONFIG, private_tests): SUBDIRS -= \ - qgraphicssceneindex \ - qnetworkreply \ - qpathclipper \ - qstylesheetstyle \ - qtextpiecetable \ + qcolumnview \ + qgraphicsanchorlayout \ + qgraphicsanchorlayout1 \ + qgraphicsitem \ + qgraphicsscene \ + qgraphicssceneindex \ + qlistwidget \ + qmainwindow \ + qnetworkreply \ + qpathclipper \ + qpixmapcache \ + qsidebar \ + qstatictext \ + qstylesheetstyle \ + qtcpsocket \ + qtextlayout \ + qtextpiecetable \ + qtipc \ + qtoolbar \ + qtreeview \ symbian:SUBDIRS -= \ qsystemtrayicon \ diff --git a/tests/auto/network.pro b/tests/auto/network.pro index e4cecce..9eb358f 100644 --- a/tests/auto/network.pro +++ b/tests/auto/network.pro @@ -46,9 +46,15 @@ SUBDIRS=\ !contains(QT_CONFIG, private_tests): SUBDIRS -= \ qauthenticator \ + qhostinfo \ qhttpnetworkconnection \ qhttpnetworkreply \ + qhttpsocketengine \ + qnetworkreply \ platformsocketengine \ qsocketnotifier \ qsocks5socketengine \ + qsslsocket \ + qsslsocket_onDemandCertificates_member \ + qsslsocket_onDemandCertificates_static \ diff --git a/tests/auto/other.pro b/tests/auto/other.pro index 655d666..b50e169 100644 --- a/tests/auto/other.pro +++ b/tests/auto/other.pro @@ -60,5 +60,7 @@ symbian { # Following tests depends on private API !contains(QT_CONFIG, private_tests): SUBDIRS -= \ + qcombobox \ qcssparser \ + qtextedit \ diff --git a/tests/auto/qscriptextensionplugin/qscriptextensionplugin.pro b/tests/auto/qscriptextensionplugin/qscriptextensionplugin.pro index d4671c8..48f0eb9 100644 --- a/tests/auto/qscriptextensionplugin/qscriptextensionplugin.pro +++ b/tests/auto/qscriptextensionplugin/qscriptextensionplugin.pro @@ -1,3 +1,4 @@ TEMPLATE = subdirs CONFIG -= app_bundle +test.depends = simpleplugin staticplugin SUBDIRS = simpleplugin staticplugin test diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 652a82e..3cbdb63 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -215,8 +215,6 @@ private slots: void QTBUG_14132(); void QTBUG_21884_data() { generic_data("QSQLITE"); } void QTBUG_21884(); - void QTBUG_16967_data() { generic_data("QSQLITE"); } - void QTBUG_16967(); //clean close void sqlite_constraint_data() { generic_data("QSQLITE"); } void sqlite_constraint(); @@ -3152,53 +3150,6 @@ void tst_QSqlQuery::QTBUG_21884() } } -/** - * This test case test sqlite driver close function. Sqlite driver should close cleanly - * even if there is still outstanding prepared statement. - */ -void tst_QSqlQuery::QTBUG_16967() -{ - QFETCH(QString, dbName); - { - QSqlDatabase db = QSqlDatabase::database(dbName); - CHECK_DATABASE(db); - db.close(); - QCOMPARE(db.lastError().type(), QSqlError::NoError); - } - { - QSqlDatabase db = QSqlDatabase::database(dbName); - CHECK_DATABASE(db); - QSqlQuery q(db); - q.prepare("CREATE TABLE t1 (id INTEGER PRIMARY KEY, str TEXT);"); - db.close(); - QCOMPARE(db.lastError().type(), QSqlError::NoError); - } - { - QSqlDatabase db = QSqlDatabase::database(dbName); - CHECK_DATABASE(db); - QSqlQuery q(db); - q.prepare("CREATE TABLE t1 (id INTEGER PRIMARY KEY, str TEXT);"); - q.exec(); - db.close(); - QCOMPARE(db.lastError().type(), QSqlError::NoError); - } - { - QSqlDatabase db = QSqlDatabase::database(dbName); - CHECK_DATABASE(db); - QSqlQuery q(db); - q.exec("INSERT INTO t1 (id, str) VALUES(1, \"test1\");"); - db.close(); - QCOMPARE(db.lastError().type(), QSqlError::NoError); - } - { - QSqlDatabase db = QSqlDatabase::database(dbName); - CHECK_DATABASE(db); - QSqlQuery q(db); - q.exec("SELECT * FROM t1;"); - db.close(); - QCOMPARE(db.lastError().type(), QSqlError::NoError); - } -} void tst_QSqlQuery::oraOCINumber() { diff --git a/tests/auto/qtipc/qsharedmemory/qsharedmemory.pro b/tests/auto/qtipc/qsharedmemory/qsharedmemory.pro index 9fef8e4..3193caa 100644 --- a/tests/auto/qtipc/qsharedmemory/qsharedmemory.pro +++ b/tests/auto/qtipc/qsharedmemory/qsharedmemory.pro @@ -1,4 +1,6 @@ TEMPLATE = subdirs SUBDIRS = test qsystemlock - +!contains(QT_CONFIG, private_tests): SUBDIRS -= \ + test \ + qsystemlock \ diff --git a/tests/auto/qtipc/qtipc.pro b/tests/auto/qtipc/qtipc.pro index 60037d2..fb32e51 100644 --- a/tests/auto/qtipc/qtipc.pro +++ b/tests/auto/qtipc/qtipc.pro @@ -4,3 +4,7 @@ SUBDIRS=\ qsharedmemory \ qsystemsemaphore \ +!contains(QT_CONFIG, private_tests): SUBDIRS -= \ + lackey \ + qsharedmemory \ + qsystemsemaphore \ diff --git a/tests/auto/script.pro b/tests/auto/script.pro index c4d0544..80d259d 100644 --- a/tests/auto/script.pro +++ b/tests/auto/script.pro @@ -16,3 +16,5 @@ SUBDIRS=\ qscriptvaluegenerated \ qscriptvalueiterator \ +!contains(QT_CONFIG, private_tests): SUBDIRS -= \ + qscriptcontext \ diff --git a/tests/auto/xmlpatterns.pro b/tests/auto/xmlpatterns.pro index b9244d6..4940cc4 100644 --- a/tests/auto/xmlpatterns.pro +++ b/tests/auto/xmlpatterns.pro @@ -46,4 +46,5 @@ xmlpatternsxqts.depends = xmlpatternssdk xmlpatternssdk \ xmlpatternsxqts \ xmlpatternsxslts \ + xmlpatternsschemats \ diff --git a/tests/benchmarks/corelib/io/io.pro b/tests/benchmarks/corelib/io/io.pro index 97445d7..15ae0d2 100644 --- a/tests/benchmarks/corelib/io/io.pro +++ b/tests/benchmarks/corelib/io/io.pro @@ -3,7 +3,7 @@ SUBDIRS = \ qdir \ qdiriterator \ qfile \ - qfileinfo \ + #qfileinfo \ # FIXME: broken qiodevice \ qtemporaryfile diff --git a/tests/benchmarks/corelib/io/qdiriterator/main.cpp b/tests/benchmarks/corelib/io/qdiriterator/main.cpp index 0d0251f..8b1dbe2 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/main.cpp +++ b/tests/benchmarks/corelib/io/qdiriterator/main.cpp @@ -44,7 +44,6 @@ #ifdef Q_OS_WIN # include <windows.h> -# include <atlbase.h> #else # include <sys/stat.h> # include <sys/types.h> @@ -176,7 +175,9 @@ void tst_qdiriterator::posix() QString path(dirpath); QBENCHMARK { #ifdef Q_OS_WIN - count = posix_helper(path.utf16()); + wchar_t wPath[MAX_PATH]; + path.toWCharArray(wPath); + count = posix_helper(wPath); #else count = posix_helper(dirpath.constData()); #endif diff --git a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro index 17d164d..a501b1b 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro +++ b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro @@ -7,8 +7,6 @@ INCLUDEPATH += . QT -= gui CONFIG += release -CONFIG += debug - SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp index 935bccd..ede398d 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp +++ b/tests/benchmarks/corelib/io/qdiriterator/qfilesystemiterator.cpp @@ -229,7 +229,7 @@ void QFileSystemIteratorPrivate::pushSubDirectory(const QByteArray &path) #ifdef Q_OS_WIN wchar_t szSearchPath[MAX_PATH]; - wcscpy(szSearchPath, QString(path).utf16()); + QString::fromAscii(path).toWCharArray(szSearchPath); wcscat(szSearchPath, L"\\*"); HANDLE dir = FindFirstFile(szSearchPath, &m_fileSearchResult); m_bFirstSearchResult = true; diff --git a/tests/benchmarks/corelib/io/qfile/main.cpp b/tests/benchmarks/corelib/io/qfile/main.cpp index 6211751..e22637a 100644 --- a/tests/benchmarks/corelib/io/qfile/main.cpp +++ b/tests/benchmarks/corelib/io/qfile/main.cpp @@ -51,7 +51,6 @@ #ifdef Q_OS_WIN # include <windows.h> -# include <atlbase.h> #endif #define BUFSIZE 1024*512 diff --git a/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/qtimer_vs_qmetaobject.pro b/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/qtimer_vs_qmetaobject.pro index 5ecb94c..3f1272d 100644 --- a/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/qtimer_vs_qmetaobject.pro +++ b/tests/benchmarks/corelib/kernel/qtimer_vs_qmetaobject/qtimer_vs_qmetaobject.pro @@ -5,8 +5,6 @@ DEPENDPATH += . INCLUDEPATH += . CONFIG += release -#CONFIG += debug - SOURCES += tst_qtimer_vs_qmetaobject.cpp QT -= gui diff --git a/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro b/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro index f3dd66a..59e0070 100644 --- a/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro +++ b/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro @@ -5,7 +5,5 @@ DEPENDPATH += . INCLUDEPATH += . CONFIG += release -#CONFIG += debug - SOURCES += tst_qvariant.cpp diff --git a/tests/benchmarks/corelib/tools/qregexp/qregexp.pro b/tests/benchmarks/corelib/tools/qregexp/qregexp.pro index ffdad12..eea5d87 100644 --- a/tests/benchmarks/corelib/tools/qregexp/qregexp.pro +++ b/tests/benchmarks/corelib/tools/qregexp/qregexp.pro @@ -12,7 +12,7 @@ CONFIG += release # Input SOURCES += main.cpp -include( $${QT_SOURCE_TREE}/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri ) +include( $${QT_SOURCE_TREE}/src/3rdparty/webkit/Source/JavaScriptCore/JavaScriptCore.pri ) exists( /usr/include/boost/regex.hpp ){ DEFINES+=HAVE_BOOST diff --git a/tests/benchmarks/corelib/tools/qstring/main.cpp b/tests/benchmarks/corelib/tools/qstring/main.cpp index daefe12..943302c 100644 --- a/tests/benchmarks/corelib/tools/qstring/main.cpp +++ b/tests/benchmarks/corelib/tools/qstring/main.cpp @@ -58,6 +58,11 @@ #include <unistd.h> #endif +// MAP_ANON is deprecated on Linux, and MAP_ANONYMOUS is not present on Mac +#ifndef MAP_ANONYMOUS +# define MAP_ANONYMOUS MAP_ANON +#endif + #include <private/qsimd_p.h> #include "data.h" @@ -789,7 +794,7 @@ static void __attribute__((noinline)) equals2_selftest() void *page1, *page3; ushort *page2; page1 = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - page2 = (ushort *)mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0); + page2 = (ushort *)mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); page3 = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); Q_ASSERT(quintptr(page2) == quintptr(page1) + pagesize || quintptr(page2) == quintptr(page1) - pagesize); @@ -938,7 +943,7 @@ static inline int ucstrncmp_short_tail(const ushort *p1, const ushort *p2, int l return 0; } -static inline int bsf_nonzero(register long val) +static inline int bsf_nonzero(register int val) { int result; # ifdef Q_CC_GNU @@ -1346,7 +1351,7 @@ void tst_QString::ucstrncmp() const void *page1, *page3; ushort *page2; page1 = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - page2 = (ushort *)mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0); + page2 = (ushort *)mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); page3 = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); Q_ASSERT(quintptr(page2) == quintptr(page1) + pagesize || quintptr(page2) == quintptr(page1) - pagesize); diff --git a/tests/benchmarks/corelib/tools/qstringlist/qstringlist.pro b/tests/benchmarks/corelib/tools/qstringlist/qstringlist.pro index 06a5836..b4a4622 100644 --- a/tests/benchmarks/corelib/tools/qstringlist/qstringlist.pro +++ b/tests/benchmarks/corelib/tools/qstringlist/qstringlist.pro @@ -1,6 +1,5 @@ load(qttest_p4) TARGET = tst_bench_qstringlist -CONFIG -= debug CONFIG += release QT -= gui SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/tools/tools.pro b/tests/benchmarks/corelib/tools/tools.pro index 83a9411..9ad3950 100644 --- a/tests/benchmarks/corelib/tools/tools.pro +++ b/tests/benchmarks/corelib/tools/tools.pro @@ -6,8 +6,10 @@ SUBDIRS = \ qline \ qlist \ qrect \ - qregexp \ + #qregexp \ # FIXME: broken qstring \ qstringbuilder \ qstringlist \ qvector + +!*g++*: SUBDIRS -= qstring diff --git a/tests/benchmarks/declarative/declarative.pro b/tests/benchmarks/declarative/declarative.pro index 73e40b2..4534d81 100644 --- a/tests/benchmarks/declarative/declarative.pro +++ b/tests/benchmarks/declarative/declarative.pro @@ -12,4 +12,10 @@ SUBDIRS += \ contains(QT_CONFIG, opengl): SUBDIRS += painting qmlshadersplugin +!contains(QT_CONFIG, private_tests): SUBDIRS -= \ + creation \ + pointers \ + qdeclarativeimage \ + script \ + include(../trusted-benchmarks.pri) diff --git a/tests/benchmarks/gui/animation/qanimation/qanimation.pro b/tests/benchmarks/gui/animation/qanimation/qanimation.pro index 53a139a..e42a830 100644 --- a/tests/benchmarks/gui/animation/qanimation/qanimation.pro +++ b/tests/benchmarks/gui/animation/qanimation/qanimation.pro @@ -5,8 +5,6 @@ DEPENDPATH += . INCLUDEPATH += . CONFIG += release -#CONFIG += debug - SOURCES += main.cpp \ dummyobject.cpp \ diff --git a/tests/benchmarks/gui/graphicsview/graphicsview.pro b/tests/benchmarks/gui/graphicsview/graphicsview.pro index 1509466..cd7d88e 100644 --- a/tests/benchmarks/gui/graphicsview/graphicsview.pro +++ b/tests/benchmarks/gui/graphicsview/graphicsview.pro @@ -1,6 +1,6 @@ TEMPLATE = subdirs SUBDIRS = \ - functional \ + #functional \ # FIXME: broken qgraphicsanchorlayout \ qgraphicsitem \ qgraphicslayout \ diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 3b690da..9497227 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -40,11 +40,8 @@ ****************************************************************************/ #include <qtest.h> +#include <QtGui> #include <QDebug> -#include <QGraphicsItem> -#include <QGraphicsScene> -#include <QGraphicsView> -#include <QImage> #include "chiptester/chiptester.h" //#define CALLGRIND_DEBUG diff --git a/tests/benchmarks/gui/kernel/qapplication/main.cpp b/tests/benchmarks/gui/kernel/qapplication/main.cpp index 6399168..6231980 100644 --- a/tests/benchmarks/gui/kernel/qapplication/main.cpp +++ b/tests/benchmarks/gui/kernel/qapplication/main.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include <QApplication> +#include <QtGui> #include <qtest.h> diff --git a/tests/benchmarks/network/kernel/kernel.pro b/tests/benchmarks/network/kernel/kernel.pro index 1ec3071..13345a5 100644 --- a/tests/benchmarks/network/kernel/kernel.pro +++ b/tests/benchmarks/network/kernel/kernel.pro @@ -1,3 +1,6 @@ TEMPLATE = subdirs SUBDIRS = \ qhostinfo + +!contains(QT_CONFIG, private_tests): SUBDIRS -= \ + qhostinfo |