From e903b5cddaaa606300292ad2cf26c2b6ee111cdd Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 26 Nov 2013 10:45:53 +0100 Subject: [PATCH 01/31] Fix for co-existence of QtDeclarative and QtQml As a follow-up to commit 2f87fde9bb4bad6787101c0d135419b350b201a5, we also need to change "hack" in the QGraphicsItem and QWidget destructor for early item destruction to support the _qml1 variant of the QObject destroyed callback. Task-number: QTBUG-35006 Change-Id: I65e37b1e9ddd8d14267aaba024408611b8cd3d77 Reviewed-by: Lars Knoll --- src/widgets/graphicsview/qgraphicsitem.cpp | 5 ++++- src/widgets/kernel/qwidget.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 7cab132a2e8..fffc8056377 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -1414,7 +1414,10 @@ QGraphicsItem::~QGraphicsItem() QObjectPrivate *p = QObjectPrivate::get(o); p->wasDeleted = true; if (p->declarativeData) { - QAbstractDeclarativeData::destroyed(p->declarativeData, o); + if (QAbstractDeclarativeData::destroyed) + QAbstractDeclarativeData::destroyed(p->declarativeData, o); + if (QAbstractDeclarativeData::destroyed_qml1) + QAbstractDeclarativeData::destroyed_qml1(p->declarativeData, o); p->declarativeData = 0; } } diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 1da0be97817..421ce570966 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1464,7 +1464,10 @@ QWidget::~QWidget() } if (d->declarativeData) { - QAbstractDeclarativeData::destroyed(d->declarativeData, this); + if (QAbstractDeclarativeData::destroyed) + QAbstractDeclarativeData::destroyed(d->declarativeData, this); + if (QAbstractDeclarativeData::destroyed_qml1) + QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this); d->declarativeData = 0; // don't activate again in ~QObject } From 939a001c3ac33ebf801d2594ac9073da28d09a46 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 26 Nov 2013 10:13:04 +0100 Subject: [PATCH 02/31] Android: Remove invalid error message All usage of context menus prints out an error message because onContextMenuClosed() is called more than once. We just return silently instead if the method is called after the menu has already been closed. Change-Id: Ifa27ed42d188fdf670f09c4b1450b9fec0d5941f Reviewed-by: BogDan Vatra --- .../jar/src/org/qtproject/qt5/android/QtActivityDelegate.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 3dcffeb07d0..3bcd6eaea3a 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -858,10 +858,8 @@ public class QtActivityDelegate public void onContextMenuClosed(Menu menu) { - if (!m_contextMenuVisible) { - Log.e(QtNative.QtTAG, "invalid onContextMenuClosed call"); + if (!m_contextMenuVisible) return; - } m_contextMenuVisible = false; QtNative.onContextMenuClosed(menu); } From 08f3177fdfc9aefbd4232dcd1529b537b2ca9402 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 25 Nov 2013 13:41:49 +0100 Subject: [PATCH 03/31] CoreWLan: Fix potential unhandled exception assert -[QNSListener notificationHandler:] was declared as not taking any parameter, but used as taking a single NSNotification. This would lead to an 'unrecognized selector' exception raised by Cocoa. Task-number: QTBUG-26844 Change-Id: I56d03a7738c2a1b9dcf3cdecc696b01e65d7b233 Reviewed-by: Liang Qi --- src/plugins/bearer/corewlan/qcorewlanengine.mm | 5 +++-- src/plugins/bearer/corewlan/qcorewlanengine_10_6.mm | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index b0ed4076daa..dc2920360d1 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -71,7 +71,7 @@ extern "C" { // Otherwise it won't find CWKeychain* symbols at link time QCoreWlanEngine *engine; NSLock *locker; } -- (void)notificationHandler;//:(NSNotification *)notification; +- (void)notificationHandler:(NSNotification *)notification; - (void)remove; - (void)setEngine:(QCoreWlanEngine *)coreEngine; - (QCoreWlanEngine *)engine; @@ -120,8 +120,9 @@ extern "C" { // Otherwise it won't find CWKeychain* symbols at link time [locker unlock]; } -- (void)notificationHandler//:(NSNotification *)notification +- (void)notificationHandler:(NSNotification *)notification { + Q_UNUSED(notification); engine->requestUpdate(); } @end diff --git a/src/plugins/bearer/corewlan/qcorewlanengine_10_6.mm b/src/plugins/bearer/corewlan/qcorewlanengine_10_6.mm index 1b95ae29ad6..7044e9696bb 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine_10_6.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine_10_6.mm @@ -48,7 +48,7 @@ QCoreWlanEngine *engine; NSLock *locker; } -- (void)notificationHandler;//:(NSNotification *)notification; +- (void)notificationHandler:(NSNotification *)notification; - (void)remove; - (void)setEngine:(QCoreWlanEngine *)coreEngine; - (QCoreWlanEngine *)engine; @@ -97,8 +97,9 @@ [locker unlock]; } -- (void)notificationHandler//:(NSNotification *)notification +- (void)notificationHandler:(NSNotification *)notification { + Q_UNUSED(notification); engine->requestUpdate(); } @end From f03fd0d82a50361c0b89165b3f8d98d66b0a4e16 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 26 Nov 2013 15:06:20 +0100 Subject: [PATCH 04/31] Remove leading '/' from target paths. This is inappropriate on Windows, and breaks non-prefix builds there. This is only needed when we calculate a relative path from a sysroot, so only add it in that case. Task-number: QTBUG-34880 Change-Id: I0e3b3d977a7b56649e4ba0077ac574aabf1dc915 Reviewed-by: Oswald Buddenhagen Reviewed-by: Stephen Kelly --- mkspecs/features/cmake_functions.prf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/cmake_functions.prf b/mkspecs/features/cmake_functions.prf index a9b0c86cade..1e6b05c78e9 100644 --- a/mkspecs/features/cmake_functions.prf +++ b/mkspecs/features/cmake_functions.prf @@ -27,9 +27,9 @@ defineReplace(cmakeModuleList) { defineReplace(cmakeTargetPath) { SYSR = $$[QT_SYSROOT] - !isEmpty(SYSR): path = $$relative_path($$1, $$[QT_SYSROOT]) + !isEmpty(SYSR): path = /$$relative_path($$1, $$[QT_SYSROOT]) else: path = $$1 - return($$clean_path(/$$path)) + return($$clean_path($$path)) } defineReplace(cmakeTargetPaths) { From 94c17dce04c7726afbdd6ac67c569eedc629a81a Mon Sep 17 00:00:00 2001 From: Frank Osterfeld Date: Fri, 22 Nov 2013 10:43:49 +0100 Subject: [PATCH 05/31] QNX: Fix retrieving the window group name The code assumes that there is a root window, and crashed otherwise. Task-number: QTBUG-35121 Change-Id: Idbf0e0bfc03cd427f0aab81db88b34fe94228c81 Reviewed-by: Rafael Roquetto --- src/plugins/platforms/qnx/qqnxnativeinterface.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp index 8958a5c1e26..24af5c26835 100644 --- a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp +++ b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp @@ -52,11 +52,13 @@ QT_BEGIN_NAMESPACE void *QQnxNativeInterface::nativeResourceForWindow(const QByteArray &resource, QWindow *window) { if (resource == "windowGroup" && window && window->screen()) { - const QQnxScreen * const screen = static_cast(window->screen()->handle()); + QQnxScreen * const screen = static_cast(window->screen()->handle()); if (screen) { + screen_window_t screenWindow = reinterpret_cast(window->winId()); + QQnxWindow *qnxWindow = screen->findWindow(screenWindow); // We can't just call data() instead of constData() here, since that would detach // and the lifetime of the char * would not be long enough. Therefore the const_cast. - return const_cast(screen->rootWindow()->groupName().constData()); + return qnxWindow ? const_cast(qnxWindow->groupName().constData()) : 0; } } From 4fbe50e77a8d24d42581cdeabd1e93cb993b0d8d Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Fri, 22 Nov 2013 18:45:49 +0100 Subject: [PATCH 06/31] Revert "Store the font's scalability in QFontEngine." This reverts commit 65b12fbdb13d34c61bcadd5cc8fd6ee28a8dfafd. QFontEngine is not always loaded from QFontDatabase, resulting in the flag not being set. Change-Id: I39bc5bd4a8dea153d191cfc55f4324195f75f64c Reviewed-by: Konstantin Ritt Reviewed-by: Mitch Curtis Reviewed-by: Lars Knoll --- src/gui/text/qfontdatabase_qpa.cpp | 1 - src/gui/text/qfontengine.cpp | 3 +-- src/gui/text/qfontengine_p.h | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp index fddbb11122a..6c0be950dc9 100644 --- a/src/gui/text/qfontdatabase_qpa.cpp +++ b/src/gui/text/qfontdatabase_qpa.cpp @@ -184,7 +184,6 @@ QFontEngine *loadSingleEngine(int script, if (!engine) { engine = pfdb->fontEngine(def, QChar::Script(script), size->handle); if (engine) { - engine->smoothScalable = style->smoothScalable; QFontCache::Key key(def,script); QFontCache::instance()->instance()->insertEngine(key,engine); } diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 7d1afbbfb65..303c85ce75b 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -208,8 +208,7 @@ Q_AUTOTEST_EXPORT QList QFontEngine_stopCollectingEngines() QFontEngine::QFontEngine() : ref(0), font_(0), font_destroy_func(0), - face_(0), face_destroy_func(0), - smoothScalable(false) + face_(0), face_destroy_func(0) { cache_cost = 0; fsType = 0; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 07be498764e..c181d61d738 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -302,8 +302,6 @@ public: inline QVariant userData() const { return m_userData; } - bool smoothScalable; - protected: QFixed lastRightBearing(const QGlyphLayout &glyphs, bool round = false); From 09466a942e7b940c64b7b4bd64a0069247961501 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 26 Nov 2013 14:25:11 +0100 Subject: [PATCH 07/31] windows: Set forward compatibility bit properly The bit should be set when QSurfaceFormat::DeprecatedFunctions is _not_ specified. The documentation was correct, the implementation was not. Change-Id: If7202d3a59d5336fff255a290b65fb4bfa7b79c9 Reviewed-by: Friedemann Kleint Reviewed-by: Gunnar Sletta --- src/plugins/platforms/windows/qwindowsglcontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index d1ede39549d..b7de368fa8a 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -589,7 +589,7 @@ static HGLRC createContext(const QOpenGLStaticContext &staticContext, if (requestedVersion >= 0x0300) { attributes[attribIndex++] = WGL_CONTEXT_FLAGS_ARB; attributes[attribIndex] = 0; - if (format.testOption(QSurfaceFormat::DeprecatedFunctions)) + if (!format.testOption(QSurfaceFormat::DeprecatedFunctions)) attributes[attribIndex] |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; if (format.testOption(QSurfaceFormat::DebugContext)) attributes[attribIndex] |= WGL_CONTEXT_DEBUG_BIT_ARB; From 94f1b85cf7e3f8983779a09b55cd22a47ab9203a Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 26 Nov 2013 13:09:42 +0100 Subject: [PATCH 08/31] Check the thread in QOffscreenSurface The QWindow-based fallback will not work when the QOffscreenSurface is created outside the main thread. Show a warning in this case. Note that it is fine to use the QOffscreenSurface instance in another thread. It is just the creation that must happen on the main thread. Change-Id: If80da39e610813755b9ba2f6831b187b258b8266 Reviewed-by: Yoann Lopes Reviewed-by: Gunnar Sletta --- src/gui/kernel/qoffscreensurface.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp index e2306050dd0..ce913a98af8 100644 --- a/src/gui/kernel/qoffscreensurface.cpp +++ b/src/gui/kernel/qoffscreensurface.cpp @@ -160,6 +160,8 @@ void QOffscreenSurface::create() d->platformOffscreenSurface = QGuiApplicationPrivate::platformIntegration()->createPlatformOffscreenSurface(this); // No platform offscreen surface, fallback to an invisible window if (!d->platformOffscreenSurface) { + if (QThread::currentThread() != qGuiApp->thread()) + qWarning("Attempting to create QWindow-based QOffscreenSurface outside the gui thread. Expect failures."); d->offscreenWindow = new QWindow(d->screen); d->offscreenWindow->setSurfaceType(QWindow::OpenGLSurface); d->offscreenWindow->setFormat(d->requestedFormat); From 75f22e219e71850405ebd6c5423899ff0677880d Mon Sep 17 00:00:00 2001 From: hjk Date: Sat, 9 Nov 2013 20:40:17 +0100 Subject: [PATCH 09/31] Fix coding style in QLabel example code Change-Id: I13838c1759b14089ba9f4daf442048fb5c8da738 Reviewed-by: Friedemann Kleint Reviewed-by: Jerome Pasion --- .../doc/snippets/code/src_gui_widgets_qlabel.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qlabel.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qlabel.cpp index 7263a723025..c7dd00407d4 100644 --- a/src/widgets/doc/snippets/code/src_gui_widgets_qlabel.cpp +++ b/src/widgets/doc/snippets/code/src_gui_widgets_qlabel.cpp @@ -47,18 +47,18 @@ label->setAlignment(Qt::AlignBottom | Qt::AlignRight); //! [1] -QLineEdit* phoneEdit = new QLineEdit(this); -QLabel* phoneLabel = new QLabel("&Phone:", this); +QLineEdit *phoneEdit = new QLineEdit(this); +QLabel *phoneLabel = new QLabel("&Phone:", this); phoneLabel->setBuddy(phoneEdit); //! [1] //! [2] -QLineEdit *nameEd = new QLineEdit(this); -QLabel *nameLb = new QLabel("&Name:", this); -nameLb->setBuddy(nameEd); -QLineEdit *phoneEd = new QLineEdit(this); -QLabel *phoneLb = new QLabel("&Phone:", this); -phoneLb->setBuddy(phoneEd); +QLineEdit *nameEdit = new QLineEdit(this); +QLabel *nameLabel = new QLabel("&Name:", this); +nameLabel->setBuddy(nameEdit); +QLineEdit *phoneEdit = new QLineEdit(this); +QLabel *phoneLabel = new QLabel("&Phone:", this); +phoneLabel->setBuddy(phoneEdit); // (layout setup not shown) //! [2] From 1aa4ac61f980b2044069e9b89b001d5d07430ac6 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 26 Nov 2013 16:27:17 +0100 Subject: [PATCH 10/31] QCocoaFileDialogHelper: Cache directory until delegate has been created MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-34393 Change-Id: Idee9e879e586afe25fd099d157ed7af88c17c4a3 Reviewed-by: Friedemann Kleint Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoafiledialoghelper.h | 1 + src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h index 8a8b1d946cd..16d1ffbe851 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h @@ -82,6 +82,7 @@ public: private: void *mDelegate; + QUrl mDir; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 1ad833ee44f..08505d91a28 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -610,6 +610,8 @@ void QCocoaFileDialogHelper::setDirectory(const QUrl &directory) QNSOpenSavePanelDelegate *delegate = static_cast(mDelegate); if (delegate) [delegate->mSavePanel setDirectoryURL:[NSURL fileURLWithPath:QCFString::toNSString(directory.toLocalFile())]]; + else + mDir = directory; } QUrl QCocoaFileDialogHelper::directory() const @@ -619,7 +621,7 @@ QUrl QCocoaFileDialogHelper::directory() const QString path = QCFString::toQString([[delegate->mSavePanel directoryURL] path]).normalized(QString::NormalizationForm_C); return QUrl::fromLocalFile(path); } - return QUrl(); + return mDir; } void QCocoaFileDialogHelper::selectFile(const QUrl &filename) @@ -707,7 +709,7 @@ void QCocoaFileDialogHelper::createNSOpenSavePanelDelegate() QCocoaAutoReleasePool pool; const SharedPointerFileDialogOptions &opts = options(); const QList selectedFiles = opts->initiallySelectedFiles(); - const QUrl directory = opts->initialDirectory(); + const QUrl directory = mDir.isEmpty() ? opts->initialDirectory() : mDir; const bool selectDir = selectedFiles.isEmpty(); QString selection(selectDir ? directory.toLocalFile() : selectedFiles.front().toLocalFile()); QNSOpenSavePanelDelegate *delegate = [[QNSOpenSavePanelDelegate alloc] From 95ffd606f8a632a8a963486ce340e7e1b707be0a Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Tue, 19 Nov 2013 16:53:21 +0100 Subject: [PATCH 11/31] Do not disable egl on desktop gl automatically MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit desktop opengl and egl are not incompatible with eachother, so there is no need to disable egl when on desktop opengl Task-number: QTBUG-34949 Change-Id: I757c38674a480910d1cb23853c255eb993e107ff Reviewed-by: Oswald Buddenhagen Reviewed-by: Andrew Knight Reviewed-by: Jørgen Lind --- configure | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 120150ca876..72c13ab75d3 100755 --- a/configure +++ b/configure @@ -5267,11 +5267,13 @@ elif [ "$CFG_XKBCOMMON" = "no" ]; then fi # EGL Support -if [ "$CFG_EGL" = "yes" ] && [ "$CFG_OPENGL" = "no" ]; then +if [ "$CFG_EGL" != "no" ]; then + if [ "$CFG_EGL" = "yes" ] && [ "$CFG_OPENGL" = "no" ]; then echo "EGL support was requested but OpenGL support is disabled." - echo "Either disable EGL support or enable OpenGL ES support." + echo "Either disable EGL support or enable OpenGL support." exit 101 -elif [ "$CFG_EGL" != "no" ]; then + fi + if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists egl 2>/dev/null; then QMAKE_INCDIR_EGL=`$PKG_CONFIG --cflags-only-I egl 2>/dev/null | sed -e 's,^-I,,g' -e 's, -I, ,g'` QMAKE_LIBS_EGL=`$PKG_CONFIG --libs egl 2>/dev/null` From 82a2d28d841c7f59fa76fae6a67e1712a5fb4740 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 27 Nov 2013 12:22:54 +0100 Subject: [PATCH 12/31] CMake: Parse the output of new CMake versions. As of CMake 3.0, the output of `cmake --version` now has a second line showing that it is maintained by Kitware. Change the version parsing to look only at the first line of output. Change-Id: I347de4c376e0bde25a43a38d59587d9b63f6b43a Reviewed-by: Oswald Buddenhagen --- mkspecs/features/ctest_testcase_common.prf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mkspecs/features/ctest_testcase_common.prf b/mkspecs/features/ctest_testcase_common.prf index 118eed1e94b..a9461eb4ae3 100644 --- a/mkspecs/features/ctest_testcase_common.prf +++ b/mkspecs/features/ctest_testcase_common.prf @@ -1,10 +1,11 @@ win32 { - CMAKE_VERSION = $$system(cmake --version 2>NUL) + CMAKE_VERSION = $$system(cmake --version 2>NUL, lines) } else { - CMAKE_VERSION = $$system(cmake --version 2>/dev/null) + CMAKE_VERSION = $$system(cmake --version 2>/dev/null, lines) } +CMAKE_VERSION = $$member(CMAKE_VERSION, 0, 0) check.commands = QMAKE_EXTRA_TARGETS *= check From ca73f493a1c902bb4ddf5ce21a24c1ca2a29ba87 Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Wed, 27 Nov 2013 13:34:55 +0100 Subject: [PATCH 13/31] Allow resetting Qt::WindowFullscreenButtonHint Currently Qt::WindowFulscreenButtonHint is only respected on window creation. But flags can also be adjusted later on. Further setWindowShadow can be removed from within createNSWindow, as it operates on a Nil object in that case. It is however called by recreateWindow / setWindowFlags subsequently. Change-Id: I507d6fde5ad2f0ee5b9db322325ede99b70e151e Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.mm | 24 ++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 4da47f4f1fb..b5b9cec2bed 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -522,6 +522,20 @@ void QCocoaWindow::setWindowFlags(Qt::WindowFlags flags) if (!(styleMask & NSBorderlessWindowMask)) { setWindowTitle(window()->title()); } + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) { + Qt::WindowType type = window()->type(); + if ((type & Qt::Popup) != Qt::Popup && (type & Qt::Dialog) != Qt::Dialog) { + NSWindowCollectionBehavior behavior = [m_nsWindow collectionBehavior]; + if (flags & Qt::WindowFullscreenButtonHint) + behavior |= NSWindowCollectionBehaviorFullScreenPrimary; + else + behavior &= ~NSWindowCollectionBehaviorFullScreenPrimary; + [m_nsWindow setCollectionBehavior:behavior]; + } + } +#endif } m_windowFlags = flags; @@ -871,8 +885,6 @@ NSWindow * QCocoaWindow::createNSWindow() // before the window is shown and needs a proper window.). if ((type & Qt::Popup) == Qt::Popup) [window setHasShadow:YES]; - else - setWindowShadow(flags); [window setHidesOnDeactivate: NO]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 @@ -894,14 +906,6 @@ NSWindow * QCocoaWindow::createNSWindow() defer:NO]; // Deferring window creation breaks OpenGL (the GL context is set up // before the window is shown and needs a proper window.). window->m_cocoaPlatformWindow = this; - setWindowShadow(flags); - -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 - if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) { - if (flags & Qt::WindowFullscreenButtonHint) - [window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; - } -#endif createdWindow = window; } From b8ff073c0d0a955776038fde1c16d471c875a4c3 Mon Sep 17 00:00:00 2001 From: Louai Al-Khanji Date: Wed, 27 Nov 2013 14:56:19 +0200 Subject: [PATCH 14/31] Fix directwrite font engine compile Add missing comma that prevented compilation. Change-Id: If771366adf3a31427c2beefa09c0206653f8ec84 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 7407d88f8b4..d81848fcc7e 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -276,7 +276,7 @@ bool QWindowsFontEngineDirectWrite::getSfntTableData(uint tag, uchar *buffer, ui UINT32 tableSize; void *tableContext = 0; BOOL exists; - HRESULT hr = m_directWriteFontFace->TryGetFontTable(qbswap(tag) + HRESULT hr = m_directWriteFontFace->TryGetFontTable(qbswap(tag), &tableData, &tableSize, &tableContext, &exists); if (SUCCEEDED(hr)) { From dc03e0c429c4398ca7905285a30741a7ad8c9daf Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Wed, 27 Nov 2013 15:18:59 +0100 Subject: [PATCH 15/31] Return the xcb_screen_t and not the QPlatformScreen from QXcbNativeInterface. The QPlatformScreen is available from QScreen::handle() Change-Id: If81daf34c07f4a49c85c43d3755d1a9167626d6d Reviewed-by: Gunnar Sletta Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index aeda1e11d16..33ae60a0177 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -212,7 +212,7 @@ void *QXcbNativeInterface::nativeResourceForWindow(const QByteArray &resourceStr result = connectionForWindow(window); break; case Screen: - result = qPlatformScreenForWindow(window); + result = screenForWindow(window); break; default: break; From 73ef64fb5fabb60101a3cac6e43f0c5bb2298000 Mon Sep 17 00:00:00 2001 From: John Layt Date: Sat, 23 Nov 2013 15:42:56 +0100 Subject: [PATCH 16/31] QPrinter - Make PDF support required for QPrinter Most of QPrinter assumes that QPdf is available as the fall back engine in case either the plugin fails to load or there are no real printers configured. Make this assumption explicit in the feature configure and remove the two places where QT_NO_PDF is actually checked. Change-Id: Ibb1bdf3bafa5809fbc844c84d7127911a1685506 Reviewed-by: Gunnar Sletta --- src/corelib/global/qfeatures.txt | 2 +- src/printsupport/kernel/qprinter.cpp | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 84c9379bbc1..fb6e56ec7d3 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -748,7 +748,7 @@ Name: QPdf Feature: PRINTER Description: Supports printing Section: Painting -Requires: PICTURE TEMPORARYFILE +Requires: PICTURE TEMPORARYFILE PDF Name: QPrinter Feature: CUPS diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index 0905cbb59f4..819f9343f73 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -55,10 +55,7 @@ #include - -#ifndef QT_NO_PDF #include "qprintengine_pdf_p.h" -#endif #include #include @@ -618,8 +615,6 @@ QPrinter::~QPrinter() */ void QPrinter::setOutputFormat(OutputFormat format) { - -#ifndef QT_NO_PDF Q_D(QPrinter); if (d->validPrinter && d->outputFormat == format) return; @@ -651,9 +646,6 @@ void QPrinter::setOutputFormat(OutputFormat format) if (d->outputFormat == QPrinter::PdfFormat) d->validPrinter = true; -#else - Q_UNUSED(format); -#endif } /*! From 76580659e6468e0b87cdd877d06c6df7ad9f8a9d Mon Sep 17 00:00:00 2001 From: Kurt Pattyn Date: Mon, 18 Nov 2013 00:15:02 +0100 Subject: [PATCH 17/31] tests: fix tst_QSettings on Mac * Add a check for the case sensitivity of the file system, so that unit tests can determine whether names of preference files with different case should generate an error or not. * Add check for OS X native file format in rainersSyncBugOnMac(). Task-number: QTBUG-32655 Done-with: Liang Qi Change-Id: I76821653dd4ebc00e20abdbb5b79c1a80290dece Reviewed-by: Liang Qi --- .../corelib/io/qsettings/tst_qsettings.cpp | 45 +++++++++---------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index dc83cf2fc4a..c5a9b421eef 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -507,32 +507,26 @@ void tst_QSettings::ctor() QCOMPARE(settings1.value("%General/%General").toInt(), 11); /* - Test that the organization and product parameters is - case-insensitive on Windows and Mac, case-sensitive on - Unix. + Test that the organization and product parameters are + case-insensitive on case-insensitive file systems. */ QSettings settings5(format, QSettings::UserScope, "SoftWare.ORG", "killerApp"); + + bool caseSensitive = true; +#if defined(Q_OS_MAC) if (format == QSettings::NativeFormat) { -#if defined(Q_OS_WIN) || defined(Q_OS_DARWIN) -# ifdef Q_OS_OSX - if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8) - QEXPECT_FAIL("native", "See QTBUG-32655", Continue); -# endif // Q_OS_OSX - QCOMPARE(settings5.value("key 1").toString(), QString("gurgle")); -#else - QVERIFY(!settings5.contains("key 1")); -#endif + // more details in QMacSettingsPrivate::QMacSettingsPrivate(), organization was comify()-ed + caseSensitive = settings5.fileName().contains("SoftWare.ORG");; } else { -#if defined(Q_OS_WIN) || defined(Q_OS_DARWIN) -# ifdef Q_OS_OSX - if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8) - QEXPECT_FAIL("", "See QTBUG-32655", Continue); -# endif // Q_OS_OSX - QCOMPARE(settings5.value("key 1").toString(), QString("gurgle")); -#else - QVERIFY(!settings5.contains("key 1")); -#endif + caseSensitive = pathconf(QDir::currentPath().toLatin1().constData(), _PC_CASE_SENSITIVE); } +#elif defined(Q_OS_WIN32) + caseSensitive = false; +#endif + if (caseSensitive) + QVERIFY(!settings5.contains("key 1")); + else + QVERIFY(settings5.contains("key 1")); } { @@ -3168,6 +3162,11 @@ void tst_QSettings::rainersSyncBugOnMac() { QFETCH(QSettings::Format, format); +#ifdef Q_OS_OSX + if (format == QSettings::NativeFormat) + QSKIP("OSX does not support direct reads from and writes to .plist files, due to caching and background syncing. See QTBUG-34899."); +#endif + QString fileName; { @@ -3183,10 +3182,6 @@ void tst_QSettings::rainersSyncBugOnMac() { QSettings s3(format, QSettings::UserScope, "software.org", "KillerAPP"); -#ifdef Q_OS_OSX - if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8) - QEXPECT_FAIL("native", "See QTBUG-32655", Continue); -#endif QCOMPARE(s3.value("key1", 30).toInt(), 25); } } From e82951611c6d965cc8ef9cbf4ee7fbccf615bb3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Wed, 27 Nov 2013 15:04:09 +0100 Subject: [PATCH 18/31] Fix problem with QNetworkAddressEntry returning a invalid netmask. The ip address should be set before the netmask. The reason for this is that QNetworkAddressEntry::setNetmask() compares the protocol of the netmask and the ip, if they don't match the netmask won't be set. Task-number: QTBUG-33911 Change-Id: Ic344b3653c5dfdc5df912dee16e4dbe069d57d24 Reviewed-by: Peter Hartmann Reviewed-by: Thiago Macieira --- src/network/kernel/qnetworkinterface_unix.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/network/kernel/qnetworkinterface_unix.cpp b/src/network/kernel/qnetworkinterface_unix.cpp index 01c082059fd..d3c830a66f3 100644 --- a/src/network/kernel/qnetworkinterface_unix.cpp +++ b/src/network/kernel/qnetworkinterface_unix.cpp @@ -277,18 +277,18 @@ static QList interfaceListing() } } - // Get the interface netmask - if (qt_safe_ioctl(socket, SIOCGIFNETMASK, &req) >= 0) { - sockaddr *sa = &req.ifr_addr; - entry.setNetmask(addressFromSockaddr(sa)); - } - // Get the address of the interface if (qt_safe_ioctl(socket, SIOCGIFADDR, &req) >= 0) { sockaddr *sa = &req.ifr_addr; entry.setIp(addressFromSockaddr(sa)); } + // Get the interface netmask + if (qt_safe_ioctl(socket, SIOCGIFNETMASK, &req) >= 0) { + sockaddr *sa = &req.ifr_addr; + entry.setNetmask(addressFromSockaddr(sa)); + } + iface->addressEntries << entry; } From 7216387370203fc8f49d76cc2cb68bb5286c8dff Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Wed, 27 Nov 2013 12:46:18 +0100 Subject: [PATCH 19/31] Fix sub-second handling in MySQL driver As stated in http://dev.mysql.com/doc/refman/5.7/en/c-api-prepared-statement-data-structures.html the content of MYSQL_TIME.second_part field is supposed to be in microseconds not milliseconds. Task-number: QTBUG-31124 [ChangeLog][QtSql][QMYSQL] Fix sub-second handling Change-Id: I5718868029bdedab9508213e800d2dcf3da9be9a Reviewed-by: Giuseppe D'Angelo Reviewed-by: Mark Brand --- src/sql/drivers/mysql/qsql_mysql.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp index 0e20cf539e6..1b1cb2ac91c 100644 --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/sql/drivers/mysql/qsql_mysql.cpp @@ -857,7 +857,7 @@ static MYSQL_TIME *toMySqlDate(QDate date, QTime time, QVariant::Type type) myTime->hour = time.hour(); myTime->minute = time.minute(); myTime->second = time.second(); - myTime->second_part = time.msec(); + myTime->second_part = time.msec() * 1000; } if (type == QVariant::Date || type == QVariant::DateTime) { myTime->year = date.year(); From 9e64fc9e1cebf1e11694c4f536881128f5aee288 Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Wed, 27 Nov 2013 13:11:01 +0100 Subject: [PATCH 20/31] Fix sub-second handling in SQLite driver Use explicit format string, that contains milliseconds, when converting an QDateTime/QTime to a SQLite field content. Task-number: QTBUG-24200 [ChangeLog][QtSql][QSQLITE] Fix sub-second handling Change-Id: Ib89152b7c3dd780b57a8826beff8b6b118e9d3d6 Reviewed-by: Giuseppe D'Angelo Reviewed-by: Mark Brand --- src/sql/drivers/sqlite/qsql_sqlite.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index 0a8b71aa8a8..27bc80e63fb 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -42,6 +42,7 @@ #include "qsql_sqlite_p.h" #include +#include #include #include #include @@ -447,6 +448,20 @@ bool QSQLiteResult::exec() case QVariant::LongLong: res = sqlite3_bind_int64(d->stmt, i + 1, value.toLongLong()); break; + case QVariant::DateTime: { + const QDateTime dateTime = value.toDateTime(); + const QString str = dateTime.toString(QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz")); + res = sqlite3_bind_text16(d->stmt, i + 1, str.utf16(), + str.size() * sizeof(ushort), SQLITE_TRANSIENT); + break; + } + case QVariant::Time: { + const QTime time = value.toTime(); + const QString str = time.toString(QStringLiteral("hh:mm:ss.zzz")); + res = sqlite3_bind_text16(d->stmt, i + 1, str.utf16(), + str.size() * sizeof(ushort), SQLITE_TRANSIENT); + break; + } case QVariant::String: { // lifetime of string == lifetime of its qvariant const QString *str = static_cast(value.constData()); From dc80838a378268a13ccbe74b481528f1ad631918 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Wed, 27 Nov 2013 09:11:28 +0100 Subject: [PATCH 21/31] Improve digitToCLocale sign char handling This patch adds more char tests for the plus and minus signs to ensure that e.g. number input widgets can be used with the locale and the known sign chars. [ChangeLog][QtCore] Fixed a bug that caused negative number input using '-' to be rejected because the current locale uses e.g. 0x2212. QIntValidator and QDoubleValidator now accepts both signs as well as the locale minus sign. Task-number: QTBUG-35069 Change-Id: I857105ca38b1d3826e27eb64645fef07149d74bc Reviewed-by: Thiago Macieira --- src/corelib/tools/qlocale_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index 4b4606ffab1..581a12e0c72 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -360,10 +360,10 @@ inline char QLocalePrivate::digitToCLocale(QChar in) const if (in.unicode() >= '0' && in.unicode() <= '9') return in.toLatin1(); - if (in == plus()) + if (in == plus() || in == QLatin1Char('+')) return '+'; - if (in == minus()) + if (in == minus() || in == QLatin1Char('-') || in == QChar(0x2212)) return '-'; if (in == decimal()) From f29e38f9a433ce7e47eb9ec88927b184c856dd6d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 27 Nov 2013 16:32:28 +0100 Subject: [PATCH 22/31] Fix font lookup. Change match() to return an index and use that to reintroduce the blacklist bookkeeping for fonts for which font engine creation fails (for example, due to missing open type support). Change the algorithm to retry search if that happens. Add empty string as fallback for non-common scripts indicating 'try to find any font matching the script' as is done in Qt 4. Task-number: QTBUG-34908 Change-Id: I9ac81ff1c275ebb635675dc26b52394789fca60c Reviewed-by: Konstantin Ritt Reviewed-by: Lars Knoll --- src/gui/text/qfontdatabase.cpp | 15 +++++++++------ src/gui/text/qfontdatabase_qpa.cpp | 30 ++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index ff050d1758d..24288489c6a 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -562,9 +562,9 @@ struct QtFontDesc int familyIndex; }; -static void match(int script, const QFontDef &request, - const QString &family_name, const QString &foundry_name, int force_encoding_id, - QtFontDesc *desc, const QList &blacklistedFamilies = QList()); +static int match(int script, const QFontDef &request, + const QString &family_name, const QString &foundry_name, int force_encoding_id, + QtFontDesc *desc, const QList &blacklisted); static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef, bool multi) { @@ -846,11 +846,12 @@ static bool matchFamilyName(const QString &familyName, QtFontFamily *f) Tries to find the best match for a given request and family/foundry */ -static void match(int script, const QFontDef &request, - const QString &family_name, const QString &foundry_name, int force_encoding_id, - QtFontDesc *desc, const QList &blacklistedFamilies) +static int match(int script, const QFontDef &request, + const QString &family_name, const QString &foundry_name, int force_encoding_id, + QtFontDesc *desc, const QList &blacklistedFamilies) { Q_UNUSED(force_encoding_id); + int result = -1; QtFontStyle::Key styleKey; styleKey.style = request.style; @@ -925,12 +926,14 @@ static void match(int script, const QFontDef &request, newscore += score_adjust; if (newscore < score) { + result = x; score = newscore; *desc = test; } if (newscore < 10) // xlfd instead of FT... just accept it break; } + return result; } static QString styleStringHelper(int weight, QFont::Style style) diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp index fddbb11122a..98e89a8327e 100644 --- a/src/gui/text/qfontdatabase_qpa.cpp +++ b/src/gui/text/qfontdatabase_qpa.cpp @@ -306,9 +306,12 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, } QtFontDesc desc; - match(script, request, family_name, foundry_name, force_encoding_id, &desc); - if (desc.family != 0 && desc.foundry != 0 && desc.style != 0) { + QList blackListed; + int index = match(script, request, family_name, foundry_name, force_encoding_id, &desc, blackListed); + if (index >= 0) { engine = loadEngine(script, request, desc.family, desc.foundry, desc.style, desc.size); + if (!engine) + blackListed.append(index); } else { FM_DEBUG(" NO MATCH FOUND\n"); } @@ -332,6 +335,8 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, QFont::Style(request.style), QFont::StyleHint(request.styleHint), QChar::Script(script)); + if (script > QChar::Script_Common) + fallbacks += QString(); // Find the first font matching the specified script. for (int i = 0; !engine && i < fallbacks.size(); i++) { QFontDef def = request; @@ -340,14 +345,19 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp, engine = QFontCache::instance()->findEngine(key); if (!engine) { QtFontDesc desc; - match(script, def, def.family, QLatin1String(""), 0, &desc); - if (desc.family == 0 && desc.foundry == 0 && desc.style == 0) { - continue; - } - engine = loadEngine(script, def, desc.family, desc.foundry, desc.style, desc.size); - if (engine) { - initFontDef(desc, def, &engine->fontDef, engine->type() == QFontEngine::Multi); - } + do { + index = match(script, def, def.family, QLatin1String(""), 0, &desc, blackListed); + if (index >= 0) { + QFontDef loadDef = def; + if (loadDef.family.isEmpty()) + loadDef.family = desc.family->name; + engine = loadEngine(script, loadDef, desc.family, desc.foundry, desc.style, desc.size); + if (engine) + initFontDef(desc, loadDef, &engine->fontDef, engine->type() == QFontEngine::Multi); + else + blackListed.append(index); + } + } while (index >= 0 && !engine); } } } From 75c9a058b3524de0e7b0575ead85b60be745e874 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Tue, 26 Nov 2013 15:21:56 +0100 Subject: [PATCH 23/31] Remove stale xcb_dri2 code in QXcbNativeInterface Change-Id: Ifc8dc8d84fc60b70f8a49282dfe32cd248bef9ba Reviewed-by: Gunnar Sletta --- src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 2 +- src/plugins/platforms/xcb/qxcbnativeinterface.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 33ae60a0177..7d69564c57e 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -76,7 +76,7 @@ static int resourceType(const QByteArray &key) static const QByteArray names[] = { // match QXcbNativeInterface::ResourceType QByteArrayLiteral("display"), QByteArrayLiteral("egldisplay"), QByteArrayLiteral("connection"), QByteArrayLiteral("screen"), - QByteArrayLiteral("graphicsdevice"), QByteArrayLiteral("eglcontext"), + QByteArrayLiteral("eglcontext"), QByteArrayLiteral("glxcontext"), QByteArrayLiteral("apptime"), QByteArrayLiteral("appusertime"), QByteArrayLiteral("hintstyle"), QByteArrayLiteral("startupid"), QByteArrayLiteral("traywindow"), diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index aec78087f58..9c4fa44d3b3 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -62,7 +62,6 @@ public: EglDisplay, Connection, Screen, - GraphicsDevice, EglContext, GLXContext, AppTime, @@ -90,7 +89,6 @@ public: void *eglDisplayForWindow(QWindow *window); void *connectionForWindow(QWindow *window); void *screenForWindow(QWindow *window); - void *graphicsDeviceForWindow(QWindow *window); void *appTime(const QXcbScreen *screen); void *appUserTime(const QXcbScreen *screen); void *getTimestamp(const QXcbScreen *screen); From d34cae51fa7b3952b651401c9e43ffd7b3d0d32c Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Thu, 28 Nov 2013 13:07:09 +0200 Subject: [PATCH 24/31] Add new configure parameter for Xcb-Xlib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds a new configuration parameter, xcb-xlib, which allows overriding the configure test for that existing configuration option. The use of xcb-xlib in the xcb platform plugin becomes the preferred path for non-OpenGL ES 2 builds, while the EGL codepath is used otherwise. This has the advantage that EGL can be used with Desktop OpenGL if Qt is configured with -no-xcb-xlib. Change-Id: I5018e31fe0399b94f020c671eff9414d00431c44 Reviewed-by: Jørgen Lind --- configure | 18 ++++++++++++++++-- src/plugins/platforms/xcb/xcb-plugin.pro | 18 +++++++++--------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 72c13ab75d3..a20fdaa0bc2 100755 --- a/configure +++ b/configure @@ -647,6 +647,7 @@ CFG_XINPUT=runtime CFG_XKB=auto CFG_XKBCOMMON=auto CFG_XCB=auto +CFG_XCB_XLIB=auto CFG_XCB_GLX=no CFG_EGLFS=auto CFG_DIRECTFB=auto @@ -1690,6 +1691,13 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; + xcb-xlib) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_XCB_XLIB="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; wayland) CFG_OBSOLETE_WAYLAND=yes ;; @@ -2335,6 +2343,9 @@ Third Party Libraries: -no-xinput2 ........ Do not compile XInput2 support. * -xinput2 ........... Compile XInput2 support. + -no-xcb-xlib........ Do not compile Xcb-Xlib support. + * -xcb-xlib........... Compile Xcb-Xlib support. + -no-glib ........... Do not compile Glib support. + -glib .............. Compile Glib support. @@ -5128,8 +5139,10 @@ if [ "$CFG_XCB" != "no" ]; then exit 1 fi - if compileTest qpa/xcb-xlib "xcb-xlib" $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then - QT_CONFIG="$QT_CONFIG xcb-xlib" + if [ "$CFG_XCB_XLIB" != "no" ]; then + if compileTest qpa/xcb-xlib "xcb-xlib" $QMAKE_CFLAGS_XCB $QMAKE_LIBS_XCB; then + QT_CONFIG="$QT_CONFIG xcb-xlib" + fi fi if [ "$CFG_SM" != "no" ] && [ -n "$PKG_CONFIG" ]; then @@ -6694,6 +6707,7 @@ report_support " LinuxFB .............." "$CFG_LINUXFB" report_support " XCB .................." "$CFG_XCB" system "system library" qt "bundled copy" if [ "$CFG_XCB" != "no" ]; then report_support " MIT-SHM ............" "$CFG_MITSHM" + report_support " Xcb-Xlib ..........." "$CFG_XCB_XLIB" report_support " Xcursor ............" "$CFG_XCURSOR" runtime "loaded at runtime" report_support " Xfixes ............." "$CFG_XFIXES" runtime "loaded at runtime" report_support " Xi ................." "$CFG_XINPUT" runtime "loaded at runtime" diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro index 4f69ca8aab6..8968d020c48 100644 --- a/src/plugins/platforms/xcb/xcb-plugin.pro +++ b/src/plugins/platforms/xcb/xcb-plugin.pro @@ -81,15 +81,7 @@ contains(QT_CONFIG, xcb-sm) { } contains(QT_CONFIG, opengl) { - contains(QT_CONFIG, opengles2) { - DEFINES += XCB_USE_EGL - CONFIG += egl - HEADERS += qxcbeglsurface.h - - # EGL on MeeGo 1.2 Harmattan needs this macro to map EGLNativeDisplayType - # and other types to the correct X11 types - DEFINES += SUPPORT_X11 - } else:contains(QT_CONFIG, xcb-xlib) { + contains(QT_CONFIG, xcb-xlib):!contains(QT_CONFIG, opengles2) { DEFINES += XCB_USE_GLX HEADERS += qglxintegration.h SOURCES += qglxintegration.cpp @@ -98,6 +90,14 @@ contains(QT_CONFIG, opengl) { DEFINES += XCB_HAS_XCB_GLX LIBS += -lxcb-glx } + } else:contains(QT_CONFIG, egl) { + DEFINES += XCB_USE_EGL + CONFIG += egl + HEADERS += qxcbeglsurface.h + + # EGL on MeeGo 1.2 Harmattan needs this macro to map EGLNativeDisplayType + # and other types to the correct X11 types + DEFINES += SUPPORT_X11 } } From a2d3b7c99165cb5c4be6f0dd83a967e1119cf732 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Thu, 28 Nov 2013 11:06:29 +0100 Subject: [PATCH 25/31] Move the glxfbconfig configtest to qpa and rename it to glx We require glx version 1.3 which is where fbconfig is first defined. Also make use of the configure test and report the glx status. GLX support should always take precedence when compiling the xcb backend Change-Id: Ie46834210bf5cd2ac4006ff08379e0d3434ffa2b Reviewed-by: Laszlo Agocs --- .../glxfbconfig.cpp => qpa/glx/glx.cpp} | 1 + .../glxfbconfig.pro => qpa/glx/glx.pro} | 2 +- configure | 59 +++++++++++-------- src/plugins/platforms/xcb/xcb-plugin.pro | 2 +- 4 files changed, 38 insertions(+), 26 deletions(-) rename config.tests/{x11/glxfbconfig/glxfbconfig.cpp => qpa/glx/glx.cpp} (98%) rename config.tests/{x11/glxfbconfig/glxfbconfig.pro => qpa/glx/glx.pro} (84%) diff --git a/config.tests/x11/glxfbconfig/glxfbconfig.cpp b/config.tests/qpa/glx/glx.cpp similarity index 98% rename from config.tests/x11/glxfbconfig/glxfbconfig.cpp rename to config.tests/qpa/glx/glx.cpp index 77bedb41c89..03af3f61312 100644 --- a/config.tests/x11/glxfbconfig/glxfbconfig.cpp +++ b/config.tests/qpa/glx/glx.cpp @@ -44,6 +44,7 @@ int main(int, char **) { + //We require glxfbconfig, ie. glx 1.3 GLXFBConfig config; config = 0; diff --git a/config.tests/x11/glxfbconfig/glxfbconfig.pro b/config.tests/qpa/glx/glx.pro similarity index 84% rename from config.tests/x11/glxfbconfig/glxfbconfig.pro rename to config.tests/qpa/glx/glx.pro index 65f855a5f2d..da51a6d231b 100644 --- a/config.tests/x11/glxfbconfig/glxfbconfig.pro +++ b/config.tests/qpa/glx/glx.pro @@ -1,4 +1,4 @@ -SOURCES = glxfbconfig.cpp +SOURCES = glx.cpp CONFIG += x11 INCLUDEPATH += $$QMAKE_INCDIR_OPENGL diff --git a/configure b/configure index a20fdaa0bc2..3879f6674cf 100755 --- a/configure +++ b/configure @@ -611,6 +611,7 @@ CFG_OPENVG_LC_INCLUDES=no CFG_OPENVG_SHIVA=auto CFG_OPENVG_ON_OPENGL=auto CFG_EGL=auto +CFG_GLX=auto CFG_SSE=auto CFG_FONTCONFIG=auto CFG_FREETYPE=auto @@ -1480,6 +1481,13 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; + glx) + if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then + CFG_GLX="$VAL" + else + UNKNOWN_OPT=yes + fi + ;; pch) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then CFG_PRECOMPILE="$VAL" @@ -4902,19 +4910,6 @@ if [ "$XPLATFORM_MINGW" = "yes" ]; then fi CFG_OPENGL=no fi - case "$PLATFORM" in - hpux*) - # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct. - if [ "$CFG_OPENGL" = "desktop" ]; then - compileTest x11/glxfbconfig "OpenGL" - if [ $? != "0" ]; then - QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT - fi - fi - ;; - *) - ;; - esac elif [ "$CFG_OPENGL" = "es2" ]; then #OpenGL ES 2.x compileTest unix/opengles2 "OpenGL ES 2.x" @@ -4935,17 +4930,6 @@ if [ "$XPLATFORM_MINGW" = "yes" ]; then echo " ${XQMAKESPEC}." exit 1 fi - case "$PLATFORM" in - hpux*) - # HP-UX have buggy glx headers; check if we really need to define the GLXFBConfig struct. - compileTest x11/glxfbconfig "OpenGL" - if [ $? != "0" ]; then - QMakeVar add DEFINES QT_DEFINE_GLXFBCONFIG_STRUCT - fi - ;; - *) - ;; - esac fi fi # X11/MINGW OpenGL @@ -5307,6 +5291,24 @@ if [ "$CFG_EGL" != "no" ]; then fi fi +# GLX Support +if [ "$CFG_GLX" != "no" ]; then + if [ "$CFG_GLX" = "yes" ] && [ "$CFG_OPENGL" = "no" ]; then + echo "GLX support was requested but OpenGL support is disabled." + echo "Either disable GLX support or enable OpenGL support." + exit 101 + fi + if compileTest qpa/glx "GLX"; then + CFG_GLX=yes + elif [ "$CFG_GLX" = "yes" ]; then + echo " The GLX functionality test failed; GLX is required by the xcb plugin to manage contexts & surfaces." + exit 1 + else + CFG_GLX=no + fi +fi + + if [ "$CFG_EGLFS" != "no" ]; then if [ "$XPLATFORM_QNX" = "no" ]; then CFG_EGLFS="$CFG_EGL" @@ -5668,6 +5670,13 @@ else QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EGL" fi +# enable glx +if [ "$CFG_GLX" = "yes" ]; then + QT_CONFIG="$QT_CONFIG glx" +else + QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GLX" +fi + # enable eglfs if [ "$CFG_EGLFS" = "yes" ]; then QT_CONFIG="$QT_CONFIG eglfs" @@ -6699,6 +6708,8 @@ else report_support " pkg-config ............. no" fi report_support " PulseAudio ............." "$CFG_PULSEAUDIO" +report_support " EGL ...................." "$CFG_EGL" +report_support " GLX ...................." "$CFG_GLX" report_support " QPA backends:" report_support " DirectFB ............." "$CFG_DIRECTFB" report_support " EGLFS ................" "$CFG_EGLFS" diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro index 8968d020c48..49a1c1b320a 100644 --- a/src/plugins/platforms/xcb/xcb-plugin.pro +++ b/src/plugins/platforms/xcb/xcb-plugin.pro @@ -81,7 +81,7 @@ contains(QT_CONFIG, xcb-sm) { } contains(QT_CONFIG, opengl) { - contains(QT_CONFIG, xcb-xlib):!contains(QT_CONFIG, opengles2) { + contains(QT_CONFIG, xcb-xlib):contains(QT_CONFIG, glx) { DEFINES += XCB_USE_GLX HEADERS += qglxintegration.h SOURCES += qglxintegration.cpp From cb6c51f026cfe35c6dc42fed20dd6919795649c6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 28 Nov 2013 09:06:26 +0100 Subject: [PATCH 26/31] Remove unused variable in font match() function. Change-Id: I0752901556a44c3b7fb4440e3ba0ca88559c1fe2 Reviewed-by: Konstantin Ritt --- src/gui/text/qfontdatabase.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 24288489c6a..9ff23cd3258 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -896,8 +896,6 @@ static int match(int script, const QFontDef &request, if (family_name.isEmpty()) load(test.family->name, script); - uint score_adjust = 0; - bool supported = (script == QChar::Script_Common); for (int ws = 1; !supported && ws < QFontDatabase::WritingSystemsCount; ++ws) { if (scriptForWritingSystem[ws] != script) @@ -923,7 +921,6 @@ static int match(int script, const QFontDef &request, QString(), styleKey, request.pixelSize, pitch, &test, force_encoding_id); } - newscore += score_adjust; if (newscore < score) { result = x; From 6aa496c3665f8c337f5484515770dab47260c1fc Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 28 Nov 2013 09:07:36 +0100 Subject: [PATCH 27/31] Streamline font match() function. Determine writing system before executing the loop. Change-Id: I6c462bdef4d70860e76c7cc9d939e3e92983b173 Reviewed-by: Konstantin Ritt --- src/gui/text/qfontdatabase.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 9ff23cd3258..61c93dc2ac0 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -499,6 +499,8 @@ static const int scriptForWritingSystem[] = { QChar::Script_Nko // Nko }; +Q_STATIC_ASSERT(sizeof(scriptForWritingSystem) / sizeof(scriptForWritingSystem[0]) == QFontDatabase::WritingSystemsCount); + int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem) { return scriptForWritingSystem[writingSystem]; @@ -882,6 +884,8 @@ static int match(int script, const QFontDef &request, load(family_name, script); + const size_t writingSystem = std::find(scriptForWritingSystem, scriptForWritingSystem + QFontDatabase::WritingSystemsCount, script) - scriptForWritingSystem; + QFontDatabasePrivate *db = privateDb(); for (int x = 0; x < db->count; ++x) { if (blacklistedFamilies.contains(x)) @@ -896,17 +900,9 @@ static int match(int script, const QFontDef &request, if (family_name.isEmpty()) load(test.family->name, script); - bool supported = (script == QChar::Script_Common); - for (int ws = 1; !supported && ws < QFontDatabase::WritingSystemsCount; ++ws) { - if (scriptForWritingSystem[ws] != script) - continue; - if (test.family->writingSystems[ws] & QtFontFamily::Supported) - supported = true; - } - if (!supported) { - // family not supported in the script we want + // Check if family is supported in the script we want + if (script != QChar::Script_Common && !(test.family->writingSystems[writingSystem] & QtFontFamily::Supported)) continue; - } // as we know the script is supported, we can be sure // to find a matching font here. From ed9e954f4be7d5fb07cf4ef223d0986fa17da212 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Sun, 10 Nov 2013 15:42:05 +0200 Subject: [PATCH 28/31] QSystemSemaphore: Clear error after successful operation Change-Id: I5c1021b2329439e3aefaa1c0d9c0b8a298d285de Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/kernel/qsystemsemaphore.cpp | 3 +-- src/corelib/kernel/qsystemsemaphore_p.h | 5 +++++ src/corelib/kernel/qsystemsemaphore_unix.cpp | 1 + src/corelib/kernel/qsystemsemaphore_win.cpp | 1 + .../kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp | 7 +++++++ 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qsystemsemaphore.cpp b/src/corelib/kernel/qsystemsemaphore.cpp index 6f0e5ee011c..82e14e6f3fc 100644 --- a/src/corelib/kernel/qsystemsemaphore.cpp +++ b/src/corelib/kernel/qsystemsemaphore.cpp @@ -229,8 +229,7 @@ void QSystemSemaphore::setKey(const QString &key, int initialValue, AccessMode m { if (key == d->key && mode == Open) return; - d->error = NoError; - d->errorString = QString(); + d->clearError(); #if !defined(Q_OS_WIN) // optimization to not destroy/create the file & semaphore if (key == d->key && mode == Create && d->createdSemaphore && d->createdFile) { diff --git a/src/corelib/kernel/qsystemsemaphore_p.h b/src/corelib/kernel/qsystemsemaphore_p.h index c809ba58c1b..b34ec1b9a7d 100644 --- a/src/corelib/kernel/qsystemsemaphore_p.h +++ b/src/corelib/kernel/qsystemsemaphore_p.h @@ -75,6 +75,11 @@ public: return QSharedMemoryPrivate::makePlatformSafeKey(key, QLatin1String("qipc_systemsem_")); } + inline void setError(QSystemSemaphore::SystemSemaphoreError e, const QString &message) + { error = e; errorString = message; } + inline void clearError() + { setError(QSystemSemaphore::NoError, QString()); } + #ifdef Q_OS_WIN Qt::HANDLE handle(QSystemSemaphore::AccessMode mode = QSystemSemaphore::Open); void setErrorString(const QString &function); diff --git a/src/corelib/kernel/qsystemsemaphore_unix.cpp b/src/corelib/kernel/qsystemsemaphore_unix.cpp index 073bd020ba0..8f439c94a09 100644 --- a/src/corelib/kernel/qsystemsemaphore_unix.cpp +++ b/src/corelib/kernel/qsystemsemaphore_unix.cpp @@ -229,6 +229,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) return false; } + clearError(); return true; } diff --git a/src/corelib/kernel/qsystemsemaphore_win.cpp b/src/corelib/kernel/qsystemsemaphore_win.cpp index 55df20b24e6..edf90a31ac5 100644 --- a/src/corelib/kernel/qsystemsemaphore_win.cpp +++ b/src/corelib/kernel/qsystemsemaphore_win.cpp @@ -136,6 +136,7 @@ bool QSystemSemaphorePrivate::modifySemaphore(int count) } } + clearError(); return true; } diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp index d2b6848dab4..a3d90c2dc1b 100644 --- a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp +++ b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp @@ -145,12 +145,19 @@ void tst_QSystemSemaphore::complexacquire() { QSystemSemaphore sem("QSystemSemaphore_complexacquire", 2, QSystemSemaphore::Create); QVERIFY(sem.acquire()); + QCOMPARE(sem.error(), QSystemSemaphore::NoError); QVERIFY(sem.release()); + QCOMPARE(sem.error(), QSystemSemaphore::NoError); QVERIFY(sem.acquire()); + QCOMPARE(sem.error(), QSystemSemaphore::NoError); QVERIFY(sem.release()); + QCOMPARE(sem.error(), QSystemSemaphore::NoError); QVERIFY(sem.acquire()); + QCOMPARE(sem.error(), QSystemSemaphore::NoError); QVERIFY(sem.acquire()); + QCOMPARE(sem.error(), QSystemSemaphore::NoError); QVERIFY(sem.release()); + QCOMPARE(sem.error(), QSystemSemaphore::NoError); QVERIFY(sem.release()); QCOMPARE(sem.error(), QSystemSemaphore::NoError); QCOMPARE(sem.errorString(), QString()); From ad684ff2a7d91a948ad9d2f3765dd08c78d81020 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Sun, 10 Nov 2013 15:34:36 +0200 Subject: [PATCH 29/31] Add QSystemSemaphore::release() auto-tests Change-Id: I4c48f9ad8c60307e4b922d6a6b82e03e455f14d9 Reviewed-by: Oswald Buddenhagen Reviewed-by: Konstantin Ritt --- .../test/tst_qsystemsemaphore.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp index a3d90c2dc1b..9e33f56a34f 100644 --- a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp +++ b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp @@ -65,6 +65,7 @@ private slots: void basicacquire(); void complexacquire(); + void release(); #ifndef QT_NO_PROCESS void basicProcesses(); @@ -163,6 +164,24 @@ void tst_QSystemSemaphore::complexacquire() QCOMPARE(sem.errorString(), QString()); } +void tst_QSystemSemaphore::release() +{ + QSystemSemaphore sem("QSystemSemaphore_release", 0, QSystemSemaphore::Create); + QVERIFY(sem.release()); + QCOMPARE(sem.error(), QSystemSemaphore::NoError); + QVERIFY(sem.release()); + QCOMPARE(sem.error(), QSystemSemaphore::NoError); + QVERIFY(sem.acquire()); + QCOMPARE(sem.error(), QSystemSemaphore::NoError); + QVERIFY(sem.acquire()); + QCOMPARE(sem.error(), QSystemSemaphore::NoError); + QVERIFY(sem.release()); + QCOMPARE(sem.error(), QSystemSemaphore::NoError); + QVERIFY(sem.release()); + QCOMPARE(sem.error(), QSystemSemaphore::NoError); + QCOMPARE(sem.errorString(), QString()); +} + #ifndef QT_NO_PROCESS void tst_QSystemSemaphore::basicProcesses() { From d55db6dd535149adca77a5d5a1bb61823aee94b5 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 28 Nov 2013 14:42:56 +0100 Subject: [PATCH 30/31] Cocoa: avoid a crash in QCocoaDrag NSEvent needs to be copied. Reference: http://lists.apple.com/archives/cocoa-dev/2007/Dec/msg00678.html Task-number: QTBUG-33533 Change-Id: I73709545573e59aab6875a8c3dd903cb171e858f Reviewed-by: Jake Petroules Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoadrag.h | 1 + src/plugins/platforms/cocoa/qcocoadrag.mm | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoadrag.h b/src/plugins/platforms/cocoa/qcocoadrag.h index 80259df6006..6810a21944c 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.h +++ b/src/plugins/platforms/cocoa/qcocoadrag.h @@ -55,6 +55,7 @@ class QCocoaDrag : public QPlatformDrag { public: QCocoaDrag(); + virtual ~QCocoaDrag(); virtual QMimeData *platformDropData(); virtual Qt::DropAction drag(QDrag *m_drag); diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm index a37552d8442..a22830f64e6 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.mm +++ b/src/plugins/platforms/cocoa/qcocoadrag.mm @@ -53,9 +53,15 @@ QCocoaDrag::QCocoaDrag() : m_lastView = 0; } +QCocoaDrag::~QCocoaDrag() +{ + [m_lastEvent release]; +} + void QCocoaDrag::setLastMouseEvent(NSEvent *event, NSView *view) { - m_lastEvent = event; + [m_lastEvent release]; + m_lastEvent = [event copy]; m_lastView = view; } From af1dbfd2239c7834187f3a702fb2029dc78d4526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 28 Nov 2013 23:45:36 +0100 Subject: [PATCH 31/31] Make OpenGL examples work on retina displays. glViewport expects device pixels, but the various geometry accessors returns values in device-independent pixels. Change-Id: I8004692de82251e4f1f25bf8f2698895f222ede3 Reviewed-by: Gunnar Sletta --- examples/opengl/hellowindow/hellowindow.cpp | 2 +- examples/opengl/paintedwindow/paintedwindow.cpp | 4 ++-- examples/opengl/pbuffers/glwidget.cpp | 2 +- examples/opengl/pbuffers2/glwidget.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/opengl/hellowindow/hellowindow.cpp b/examples/opengl/hellowindow/hellowindow.cpp index b5ffbd63a24..2864883f5eb 100644 --- a/examples/opengl/hellowindow/hellowindow.cpp +++ b/examples/opengl/hellowindow/hellowindow.cpp @@ -142,7 +142,7 @@ void Renderer::render() m_initialized = true; } - glViewport(0, 0, viewSize.width(), viewSize.height()); + glViewport(0, 0, viewSize.width() * surface->devicePixelRatio(), viewSize.height() * surface->devicePixelRatio()); glClearColor(0.1f, 0.1f, 0.2f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); diff --git a/examples/opengl/paintedwindow/paintedwindow.cpp b/examples/opengl/paintedwindow/paintedwindow.cpp index c8f1f236bac..d44b6308b3f 100644 --- a/examples/opengl/paintedwindow/paintedwindow.cpp +++ b/examples/opengl/paintedwindow/paintedwindow.cpp @@ -175,9 +175,9 @@ void PaintedWindow::paint() { m_context->makeCurrent(this); - QRect rect(0, 0, width(), height()); + QRect rect(0, 0, width() * devicePixelRatio(), height() * devicePixelRatio()); - QOpenGLPaintDevice device(size()); + QOpenGLPaintDevice device(size() * devicePixelRatio()); QPainter painter(&device); QPainterPath path; diff --git a/examples/opengl/pbuffers/glwidget.cpp b/examples/opengl/pbuffers/glwidget.cpp index d3b82ff23f5..b319951ccd9 100644 --- a/examples/opengl/pbuffers/glwidget.cpp +++ b/examples/opengl/pbuffers/glwidget.cpp @@ -198,7 +198,7 @@ void GLWidget::orthographicProjection() void GLWidget::resizeGL(int width, int height) { - glViewport(0, 0, width, height); + glViewport(0, 0, width * devicePixelRatio(), height * devicePixelRatio()); aspect = (qreal)width / (qreal)(height ? height : 1); perspectiveProjection(); } diff --git a/examples/opengl/pbuffers2/glwidget.cpp b/examples/opengl/pbuffers2/glwidget.cpp index d1bb5013861..de30bb8b217 100644 --- a/examples/opengl/pbuffers2/glwidget.cpp +++ b/examples/opengl/pbuffers2/glwidget.cpp @@ -156,7 +156,7 @@ void GLWidget::draw() glTranslatef(0.0f, 0.0f, -15.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - glViewport(0, 0, width(), height()); + glViewport(0, 0, width() * devicePixelRatio(), height() * devicePixelRatio()); glBindTexture(GL_TEXTURE_2D, dynamicTexture); glEnable(GL_TEXTURE_2D);