From bc108d7c7ea491bfc8618a8389d4806aea44bfbf Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 3 Jan 2016 14:51:07 -0200 Subject: Work around GCC 6 warning about offset outside bounds of string This is a false positive because the only offset that can be outside the bounds was the last one (-1), which could not be reached in this line because of the qBound on the line before limiting the maximum value. The -1 wasn't generated by the Perl script embedded in the file anyway. qdbuserror.cpp:142:64: error: offset outside bounds of constant string [-Werror] Change-Id: I24a735698d3c4a719fc9ffff1425f8aad5e5978e Reviewed-by: Alex Blasche Reviewed-by: Frederik Gladhorn --- src/dbus/qdbuserror.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dbus/qdbuserror.cpp b/src/dbus/qdbuserror.cpp index 40e97ae483..d6a329cfe8 100644 --- a/src/dbus/qdbuserror.cpp +++ b/src/dbus/qdbuserror.cpp @@ -130,11 +130,11 @@ static const int errorMessages_indices[] = { 0, 6, 40, 76, 118, 153, 191, 231, 273, 313, 349, 384, 421, 461, 501, 540, 581, 617, 661, 705, 746, 789, 833, 874, - 916, 961, 1005, -1 + 916, 961, 1005 }; static const int errorMessages_count = sizeof errorMessages_indices / - sizeof errorMessages_indices[0] - 1; + sizeof errorMessages_indices[0]; static inline const char *get(QDBusError::ErrorType code) { -- cgit v1.2.3 From 9d0181f0f740a2c07ff4141f60095c1d7710afee Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 8 Jan 2016 12:01:19 +0100 Subject: windows: bump OpenGL blacklist version Change-Id: If27c36de850b55907143e2b8a412fa8ac458fe97 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/openglblacklists/default.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/openglblacklists/default.json b/src/plugins/platforms/windows/openglblacklists/default.json index 2672711d3a..767eac161c 100644 --- a/src/plugins/platforms/windows/openglblacklists/default.json +++ b/src/plugins/platforms/windows/openglblacklists/default.json @@ -1,6 +1,6 @@ { "name": "Qt built-in GPU driver blacklist", - "version": "5.5", + "version": "5.6", "entries": [ { "id": 1, -- cgit v1.2.3 From 5783a915c4e1825c4d9fd34e3d2ab2ca5b8a0c85 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 17 Dec 2015 11:58:25 +0100 Subject: don't rely on transitive dependencies Change-Id: Ide872b452e02ebefb3eeb51464c8d59e8bf58bc4 Reviewed-by: Joerg Bornemann Reviewed-by: Oswald Buddenhagen --- src/platformsupport/clipboard/clipboard.pri | 2 ++ tests/auto/gui/kernel/qclipboard/test/test.pro | 2 ++ tests/auto/other/macgui/macgui.pro | 2 ++ tests/auto/widgets/widgets/qlineedit/qlineedit.pro | 1 + tests/auto/widgets/widgets/qplaintextedit/qplaintextedit.pro | 1 + tests/auto/widgets/widgets/qtextedit/qtextedit.pro | 2 ++ 6 files changed, 10 insertions(+) diff --git a/src/platformsupport/clipboard/clipboard.pri b/src/platformsupport/clipboard/clipboard.pri index 2532430f1e..cb8315d003 100644 --- a/src/platformsupport/clipboard/clipboard.pri +++ b/src/platformsupport/clipboard/clipboard.pri @@ -1,5 +1,7 @@ mac { HEADERS += $$PWD/qmacmime_p.h OBJECTIVE_SOURCES += $$PWD/qmacmime.mm + + osx: LIBS_PRIVATE += -framework AppKit } diff --git a/tests/auto/gui/kernel/qclipboard/test/test.pro b/tests/auto/gui/kernel/qclipboard/test/test.pro index f27c582de2..40bf9c8d8e 100644 --- a/tests/auto/gui/kernel/qclipboard/test/test.pro +++ b/tests/auto/gui/kernel/qclipboard/test/test.pro @@ -3,6 +3,8 @@ SOURCES += ../tst_qclipboard.cpp TARGET = ../tst_qclipboard QT += testlib +osx: LIBS += -framework AppKit + win32 { CONFIG(debug, debug|release) { TARGET = ../../debug/tst_qclipboard diff --git a/tests/auto/other/macgui/macgui.pro b/tests/auto/other/macgui/macgui.pro index bf805ccd75..a793a304ca 100644 --- a/tests/auto/other/macgui/macgui.pro +++ b/tests/auto/other/macgui/macgui.pro @@ -6,5 +6,7 @@ HEADERS += guitest.h QT = core-private widgets-private testlib +osx: LIBS += -framework ApplicationServices + requires(mac) DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/widgets/qlineedit/qlineedit.pro b/tests/auto/widgets/widgets/qlineedit/qlineedit.pro index 715dcb9550..636208d67a 100644 --- a/tests/auto/widgets/widgets/qlineedit/qlineedit.pro +++ b/tests/auto/widgets/widgets/qlineedit/qlineedit.pro @@ -3,3 +3,4 @@ TARGET = tst_qlineedit QT += gui-private core-private widgets widgets-private testlib SOURCES += tst_qlineedit.cpp +osx: LIBS += -framework AppKit diff --git a/tests/auto/widgets/widgets/qplaintextedit/qplaintextedit.pro b/tests/auto/widgets/widgets/qplaintextedit/qplaintextedit.pro index e98bae2089..be4102ec75 100644 --- a/tests/auto/widgets/widgets/qplaintextedit/qplaintextedit.pro +++ b/tests/auto/widgets/widgets/qplaintextedit/qplaintextedit.pro @@ -9,3 +9,4 @@ INCLUDEPATH += ../ HEADERS += SOURCES += tst_qplaintextedit.cpp +osx: LIBS += -framework AppKit diff --git a/tests/auto/widgets/widgets/qtextedit/qtextedit.pro b/tests/auto/widgets/widgets/qtextedit/qtextedit.pro index 6e0fff17d5..8b39ab59b7 100644 --- a/tests/auto/widgets/widgets/qtextedit/qtextedit.pro +++ b/tests/auto/widgets/widgets/qtextedit/qtextedit.pro @@ -4,3 +4,5 @@ TARGET = tst_qtextedit QT += widgets widgets-private gui-private core-private testlib SOURCES += tst_qtextedit.cpp + +osx: LIBS += -framework AppKit -- cgit v1.2.3 From 2fe363514cf2130ca6135c6c0222e61fc4cb5dc4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 10 Dec 2015 17:22:14 +0100 Subject: don't build with explicitlib on unix judging by the history, this was only ever a workaround for poor rpath handling. we're supposed to be over that. Change-Id: I85601493a05a76ead999e707a2d2e9a430610981 Reviewed-by: Joerg Bornemann Reviewed-by: Oswald Buddenhagen --- mkspecs/features/qt_module.prf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index 1dae370630..3675d7d87f 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -132,7 +132,6 @@ lib_bundle { } mac { - CONFIG += explicitlib macx-g++ { QMAKE_CFLAGS += -fconstant-cfstrings QMAKE_CXXFLAGS += -fconstant-cfstrings @@ -260,7 +259,7 @@ load(qt_targets) QMAKE_PKGCONFIG_INSTALL_REPLACE += pclib_replace unix { - CONFIG += create_libtool explicitlib + CONFIG += create_libtool host_build: \ QMAKE_LIBTOOL_LIBDIR = $$[QT_HOST_LIBS] else: \ -- cgit v1.2.3 From e707d02cc8bd91b49857e3d195fb13b50548fc58 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 10 Dec 2015 17:26:20 +0100 Subject: un-nest enabling .la creation from enabling .pc creation (again) now that we don't create .pc files for private modules any more, the conditionals cannot be nested. amends 6c5d227da, partially reverting aa20e7f9d. Task-number: QTBUG-49763 Change-Id: I2578c83e0c767b6533abdb26bf4e8bcc8c416ef1 Reviewed-by: Joerg Bornemann --- mkspecs/features/qt_module.prf | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index 3675d7d87f..a80eba6607 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -257,19 +257,18 @@ load(qt_targets) pclib_replace.replace = $$QMAKE_PKGCONFIG_LIBDIR pclib_replace.CONFIG = path QMAKE_PKGCONFIG_INSTALL_REPLACE += pclib_replace - - unix { - CONFIG += create_libtool - host_build: \ - QMAKE_LIBTOOL_LIBDIR = $$[QT_HOST_LIBS] - else: \ - QMAKE_LIBTOOL_LIBDIR = "=$$[QT_INSTALL_LIBS/raw]" - ltlib_replace.match = $$lib_replace.match - !isEmpty(lib_replace.replace): \ - ltlib_replace.replace = $$QMAKE_LIBTOOL_LIBDIR - ltlib_replace.CONFIG = path - QMAKE_LIBTOOL_INSTALL_REPLACE += ltlib_replace - } +} +!lib_bundle:unix { + CONFIG += create_libtool + host_build: \ + QMAKE_LIBTOOL_LIBDIR = $$[QT_HOST_LIBS] + else: \ + QMAKE_LIBTOOL_LIBDIR = "=$$[QT_INSTALL_LIBS/raw]" + ltlib_replace.match = $$lib_replace.match + !isEmpty(lib_replace.replace): \ + ltlib_replace.replace = $$QMAKE_LIBTOOL_LIBDIR + ltlib_replace.CONFIG = path + QMAKE_LIBTOOL_INSTALL_REPLACE += ltlib_replace } contains(QT_PRODUCT, OpenSource.*):DEFINES *= QT_OPENSOURCE -- cgit v1.2.3 From 1949f24faf29c9f2dc620d2bda3383932f1f7148 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 8 Jan 2016 16:10:51 +0100 Subject: Fix wrapper batch file names for flex/bison in ANGLE build The wrapper batch files were called wrapper.bat for both, flex and bison. Resolve this conflict by providing proper tool names. Change-Id: I7987f94976abc29302c9f6a696faa5c7d1fb030d Reviewed-by: Friedemann Kleint Reviewed-by: Oswald Buddenhagen --- src/angle/src/config.pri | 1 + 1 file changed, 1 insertion(+) diff --git a/src/angle/src/config.pri b/src/angle/src/config.pri index be61282069..fddb395ab2 100644 --- a/src/angle/src/config.pri +++ b/src/angle/src/config.pri @@ -23,6 +23,7 @@ equals(QMAKE_HOST.os, Windows) { defineReplace(addGnuPath) { gnuPath = $$1 !isEmpty(gnuPath):!isEmpty(gnutools.name) { + QT_TOOL_NAME = $$1 qtAddToolEnv(gnuPath, gnutools) silent: gnuPath = @echo generating sources from ${QMAKE_FILE_IN} && $$gnuPath } -- cgit v1.2.3 From c04cf29b78f3f5747c58dd89ca21523e387ee3ac Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 8 Jan 2016 17:06:43 +0100 Subject: fix docs creation in debug_and_release builds qtAddToolEnv() (via qtPrepareTool()) does not write the tool wrapper scripts during build passes, while qt_docs.prf (which calls it for qdoc and qhelpgenerator) was loaded only during build passes. the consequence was that the makefiles tried calling non-existent scripts. amends 5418d77a1, sort of. Change-Id: I64ab573495ca339be4c7b5e8c6848b298b6cb605 Reviewed-by: Joerg Bornemann --- mkspecs/features/qt_docs.prf | 23 +++++++++++++++-------- mkspecs/features/qt_docs_targets.prf | 20 ++++++++++---------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/mkspecs/features/qt_docs.prf b/mkspecs/features/qt_docs.prf index 37b2f06193..183d0c9502 100644 --- a/mkspecs/features/qt_docs.prf +++ b/mkspecs/features/qt_docs.prf @@ -11,13 +11,6 @@ !exists($$QMAKE_DOCS): error("Cannot find documentation specification file $$QMAKE_DOCS") -load(qt_build_paths) -QMAKE_DOCS_BASE_OUTDIR = $$MODULE_BASE_OUTDIR/doc - -QMAKE_DOCS_TARGET = $$replace(QMAKE_DOCS, ^(.*/)?(.*)\\.qdocconf$, \\2) -isEmpty(QMAKE_DOCS_TARGETDIR): QMAKE_DOCS_TARGETDIR = $$QMAKE_DOCS_TARGET -QMAKE_DOCS_OUTPUTDIR = $$QMAKE_DOCS_BASE_OUTDIR/$$QMAKE_DOCS_TARGETDIR - qtver.name = QT_VERSION qtver.value = $$VERSION isEmpty(qtver.value): qtver.value = $$MODULE_VERSION @@ -31,6 +24,21 @@ qtdocs.value = $$[QT_INSTALL_DOCS/src] QT_TOOL_ENV = qtver qtmver qtvertag qtdocs qtPrepareTool(QDOC, qdoc) QT_TOOL_ENV = + +!build_online_docs: qtPrepareTool(QHELPGENERATOR, qhelpgenerator) + +# qtPrepareTool() must be called outside a build pass, as it protects +# against concurrent wrapper creation by omitting it during build passes. +# However, creating the actual targets is reserved to the build passes. +debug_and_release:!build_pass: return() + +load(qt_build_paths) +QMAKE_DOCS_BASE_OUTDIR = $$MODULE_BASE_OUTDIR/doc + +QMAKE_DOCS_TARGET = $$replace(QMAKE_DOCS, ^(.*/)?(.*)\\.qdocconf$, \\2) +isEmpty(QMAKE_DOCS_TARGETDIR): QMAKE_DOCS_TARGETDIR = $$QMAKE_DOCS_TARGET +QMAKE_DOCS_OUTPUTDIR = $$QMAKE_DOCS_BASE_OUTDIR/$$QMAKE_DOCS_TARGETDIR + QDOC += -outputdir $$shell_quote($$QMAKE_DOCS_OUTPUTDIR) !build_online_docs: \ QDOC += -installdir $$shell_quote($$[QT_INSTALL_DOCS]) @@ -64,7 +72,6 @@ prepare_docs { } !build_online_docs { - qtPrepareTool(QHELPGENERATOR, qhelpgenerator) qch_docs.commands = $$QHELPGENERATOR $$shell_quote($$QMAKE_DOCS_OUTPUTDIR/$${QMAKE_DOCS_TARGET}.qhp) -o $$shell_quote($$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch) inst_html_docs.files = $$QMAKE_DOCS_OUTPUTDIR diff --git a/mkspecs/features/qt_docs_targets.prf b/mkspecs/features/qt_docs_targets.prf index 89f080cc5e..1f9e2b0b47 100644 --- a/mkspecs/features/qt_docs_targets.prf +++ b/mkspecs/features/qt_docs_targets.prf @@ -29,17 +29,17 @@ QMAKE_EXTRA_TARGETS += docs contains(TEMPLATE, subdirs) { for(inst, DOC_TARGETS): \ prepareRecursiveTarget($$inst) -} else:debug_and_release:!build_pass { - sub = $$first(BUILDS) - for(inst, DOC_TARGETS) { - $${inst}.CONFIG = recursive - $${inst}.recurse = $$sub - } } else { - # apps and libs only generate docs if QMAKE_DOCS is set - !isEmpty(QMAKE_DOCS) { - # backwards compat hack - load(qt_docs) + debug_and_release:!build_pass { + sub = $$first(BUILDS) + for(inst, DOC_TARGETS) { + $${inst}.CONFIG = recursive + $${inst}.recurse = $$sub + } } + # Apps and libs request docs creation by setting QMAKE_DOCS. + # This is a backwards compat hack - technically, the modules which need it + # are supposed to load(qt_docs) themselves. + !isEmpty(QMAKE_DOCS): load(qt_docs) } QMAKE_EXTRA_TARGETS += $$DOC_TARGETS -- cgit v1.2.3 From 1bcfc3de7586ddb9f5d1b778b97b26ae3dc9584d Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 6 Jan 2016 11:01:39 +0100 Subject: Use backing store formats with alpha We depend on being able to punch holes in the backing store when integrating with FBO elements. To do that we need a format with an alpha channel. This was only working previously because RGB32 didn't mask when filling or when converting to ARGB32_PM, but other formats didn't. Also unifies the logic for getting alpha versions of QImage formats. Task-number: QTBUG-50281 Change-Id: Ied1325f60e2b67d9ea2dfa9701b06fc2231ebfca Reviewed-by: Laszlo Agocs --- src/gui/image/qimage.cpp | 27 +------------------- src/gui/image/qimage_p.h | 35 ++++++++++++++++++++++++++ src/gui/image/qpixmap_raster.cpp | 27 ++------------------ src/plugins/platforms/xcb/qxcbbackingstore.cpp | 4 +++ 4 files changed, 42 insertions(+), 51 deletions(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index a992ad6fea..6ec1eecfb1 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4623,32 +4623,7 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode if (complex_xform || mode == Qt::SmoothTransformation) { if (d->format < QImage::Format_RGB32 || !hasAlphaChannel()) { - switch(d->format) { - case QImage::Format_RGB16: - target_format = Format_ARGB8565_Premultiplied; - break; - case QImage::Format_RGB555: - target_format = Format_ARGB8555_Premultiplied; - break; - case QImage::Format_RGB666: - target_format = Format_ARGB6666_Premultiplied; - break; - case QImage::Format_RGB444: - target_format = Format_ARGB4444_Premultiplied; - break; - case QImage::Format_RGBX8888: - target_format = Format_RGBA8888_Premultiplied; - break; - case QImage::Format_BGR30: - target_format = Format_A2BGR30_Premultiplied; - break; - case QImage::Format_RGB30: - target_format = Format_A2RGB30_Premultiplied; - break; - default: - target_format = Format_ARGB32_Premultiplied; - break; - } + target_format = qt_alphaVersion(d->format); } } diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h index 3badda0864..f9ad6c0ac0 100644 --- a/src/gui/image/qimage_p.h +++ b/src/gui/image/qimage_p.h @@ -161,10 +161,45 @@ inline int qt_depthForFormat(QImage::Format format) } return depth; } + #if defined(_M_ARM) #pragma optimize("", on) #endif +inline QImage::Format qt_alphaVersion(QImage::Format format) +{ + switch (format) { + case QImage::Format_RGB16: + return QImage::Format_ARGB8565_Premultiplied; + case QImage::Format_RGB555: + return QImage::Format_ARGB8555_Premultiplied; + case QImage::Format_RGB666: + return QImage::Format_ARGB6666_Premultiplied; + case QImage::Format_RGB444: + return QImage::Format_ARGB4444_Premultiplied; + case QImage::Format_RGBX8888: + return QImage::Format_RGBA8888_Premultiplied; + case QImage::Format_BGR30: + return QImage::Format_A2BGR30_Premultiplied; + case QImage::Format_RGB30: + return QImage::Format_A2RGB30_Premultiplied; + default: + break; + } + return QImage::Format_ARGB32_Premultiplied; +} + +inline QImage::Format qt_alphaVersionForPainting(QImage::Format format) +{ + QImage::Format toFormat = qt_alphaVersion(format); +#if defined(__ARM_NEON__) || defined(__SSE2__) + // If we are switching depth anyway and we have optimized ARGB32PM routines, upgrade to that. + if (qt_depthForFormat(format) != qt_depthForFormat(toFormat)) + toFormat = QImage::Format_ARGB32_Premultiplied; +#endif + return toFormat; +} + QT_END_NAMESPACE #endif // QIMAGE_P_H diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index a2b84b358e..bbdf77355e 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -178,20 +178,7 @@ void QRasterPlatformPixmap::fill(const QColor &color) int alpha = color.alpha(); if (alpha != 255) { if (!image.hasAlphaChannel()) { - QImage::Format toFormat; -#if !(defined(__ARM_NEON__) || defined(__SSE2__)) - if (image.format() == QImage::Format_RGB16) - toFormat = QImage::Format_ARGB8565_Premultiplied; - else if (image.format() == QImage::Format_RGB666) - toFormat = QImage::Format_ARGB6666_Premultiplied; - else if (image.format() == QImage::Format_RGB555) - toFormat = QImage::Format_ARGB8555_Premultiplied; - else if (image.format() == QImage::Format_RGB444) - toFormat = QImage::Format_ARGB4444_Premultiplied; - else -#endif - toFormat = QImage::Format_ARGB32_Premultiplied; - + QImage::Format toFormat = qt_alphaVersionForPainting(image.format()); if (!image.isNull() && qt_depthForFormat(image.format()) == qt_depthForFormat(toFormat)) { image.detach(); image.d->format = toFormat; @@ -314,17 +301,7 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC : QImage::Format_RGB32; } else { QImage::Format opaqueFormat = QNativeImage::systemFormat(); - QImage::Format alphaFormat = QImage::Format_ARGB32_Premultiplied; - -#if !defined(__ARM_NEON__) && !defined(__SSE2__) - switch (opaqueFormat) { - case QImage::Format_RGB16: - alphaFormat = QImage::Format_ARGB8565_Premultiplied; - break; - default: // We don't care about the others... - break; - } -#endif + QImage::Format alphaFormat = qt_alphaVersionForPainting(opaqueFormat); if (!sourceImage.hasAlphaChannel()) { format = opaqueFormat; diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index 1825a463d0..006df320fe 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include QT_BEGIN_NAMESPACE @@ -172,6 +173,9 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QI qWarning() << "QXcbBackingStore: Error while marking the shared memory segment to be destroyed"; } + if (QImage::toPixelFormat(format).alphaUsage() == QPixelFormat::IgnoresAlpha) + format = qt_alphaVersionForPainting(format); + m_qimage = QImage( (uchar*) m_xcb_image->data, m_xcb_image->width, m_xcb_image->height, m_xcb_image->stride, format); m_graphics_buffer = new QXcbShmGraphicsBuffer(&m_qimage); } -- cgit v1.2.3 From f8301029183a0ff653243d932b135405adee20b0 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Thu, 24 Dec 2015 13:35:40 +0300 Subject: xcb: Remove QXcbScreen::m_nativeGeometry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is equal to m_geometry since c173a5071906867de9da26ee8f49224b23c2ef1d (Remove QT_DEVICE_PIXEL_RATIO support from xcb). Also remove the declaration for QXcbWindow::screenForNativeGeometry(), which was forgotten to be removed in that commit. Change-Id: I8ec425a3bc111ec579e2e25c4fda8a02f1c8d09c Reviewed-by: Błażej Szczygieł Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/xcb/qxcbscreen.cpp | 13 ++++--------- src/plugins/platforms/xcb/qxcbscreen.h | 2 -- src/plugins/platforms/xcb/qxcbwindow.h | 1 - 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index caddd2b2a5..f3d381b99e 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -70,7 +70,7 @@ QXcbVirtualDesktop::~QXcbVirtualDesktop() QXcbScreen *QXcbVirtualDesktop::screenAt(const QPoint &pos) const { foreach (QXcbScreen *screen, connection()->screens()) { - if (screen->virtualDesktop() == this && screen->nativeGeometry().contains(pos)) + if (screen->virtualDesktop() == this && screen->geometry().contains(pos)) return screen; } return Q_NULLPTR; @@ -198,17 +198,15 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDe } else if (xineramaScreenInfo) { m_geometry = QRect(xineramaScreenInfo->x_org, xineramaScreenInfo->y_org, xineramaScreenInfo->width, xineramaScreenInfo->height); - m_nativeGeometry = m_geometry; m_availableGeometry = m_geometry & m_virtualDesktop->workArea(); m_sizeMillimeters = sizeInMillimeters(m_geometry.size(), virtualDpi()); if (xineramaScreenIdx > -1) m_outputName += QLatin1Char('-') + QString::number(xineramaScreenIdx); } - if (m_geometry.isEmpty()) { + if (m_geometry.isEmpty()) m_geometry = QRect(QPoint(), m_virtualSize); - m_nativeGeometry = QRect(QPoint(), m_virtualSize); - } + if (m_availableGeometry.isEmpty()) m_availableGeometry = m_geometry; @@ -557,7 +555,6 @@ void QXcbScreen::updateGeometry(const QRect &geom, uint8_t rotation) qreal dpi = xGeometry.width() / physicalSize().width() * qreal(25.4); m_pixelDensity = qRound(dpi/96); m_geometry = QRect(xGeometry.topLeft(), xGeometry.size()); - m_nativeGeometry = QRect(xGeometry.topLeft(), xGeometry.size()); m_availableGeometry = xGeometry & m_virtualDesktop->workArea(); QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry); } @@ -828,9 +825,7 @@ QDebug operator<<(QDebug debug, const QXcbScreen *screen) debug << ", screenNumber=" << screen->screenNumber(); debug << ", virtualSize=" << screen->virtualSize().width() << 'x' << screen->virtualSize().height() << " ("; formatSizeF(debug, screen->virtualSize()); - debug << "), nativeGeometry="; - formatRect(debug, screen->nativeGeometry()); - debug << ", orientation=" << screen->orientation(); + debug << "), orientation=" << screen->orientation(); debug << ", depth=" << screen->depth(); debug << ", refreshRate=" << screen->refreshRate(); debug << ", root=" << hex << screen->root(); diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index dd7396aca2..f4de2b9dfd 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -114,7 +114,6 @@ public: QWindow *topLevelAt(const QPoint &point) const Q_DECL_OVERRIDE; QRect geometry() const Q_DECL_OVERRIDE { return m_geometry; } - QRect nativeGeometry() const { return m_nativeGeometry; } QRect availableGeometry() const Q_DECL_OVERRIDE {return m_availableGeometry;} int depth() const Q_DECL_OVERRIDE { return screen()->root_depth; } QImage::Format format() const Q_DECL_OVERRIDE; @@ -186,7 +185,6 @@ private: QSizeF m_outputSizeMillimeters; QSizeF m_sizeMillimeters; QRect m_geometry; - QRect m_nativeGeometry; QRect m_availableGeometry; QSize m_virtualSize; QSizeF m_virtualSizeMillimeters; diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 69c0819959..3cfa71c9e0 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -167,7 +167,6 @@ public: virtual void create(); virtual void destroy(); - QXcbScreen *screenForNativeGeometry(const QRect &newGeometry) const; public Q_SLOTS: void updateSyncRequestCounter(); -- cgit v1.2.3 From 644441eed3997bc8cf7cfe5b4f56adee6e232ffd Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 8 Jan 2016 17:12:50 +0100 Subject: Windows: Output resulting DPI awareness in debug and warning output. Fix the signature of QWindowsShcoreDLL::GetProcessDpiAwareness and output the value in the warning about failures of SetProcessDpiAwareness and in debug output. Failures occur when Qt is embedded into another application, for example Active Qt servers. Task-number: QTBUG-41186 Task-number: QTBUG-50206 Change-Id: I3fd6cba26826ee8bbfa0a34f129deb64797c947f Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowscontext.cpp | 19 +++++++++++++++++-- src/plugins/platforms/windows/qwindowscontext.h | 3 ++- src/plugins/platforms/windows/qwindowsintegration.cpp | 3 ++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index f2f6402889..4934b6c6e4 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -405,14 +405,29 @@ void QWindowsContext::setTabletAbsoluteRange(int a) #endif } +int QWindowsContext::processDpiAwareness() +{ +#ifndef Q_OS_WINCE + int result; + if (QWindowsContext::shcoredll.getProcessDpiAwareness + && SUCCEEDED(QWindowsContext::shcoredll.getProcessDpiAwareness(NULL, &result))) { + return result; + } +#endif // !Q_OS_WINCE + return -1; +} + void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiAwareness) { #ifndef Q_OS_WINCE qCDebug(lcQpaWindows) << __FUNCTION__ << dpiAwareness; if (QWindowsContext::shcoredll.isValid()) { const HRESULT hr = QWindowsContext::shcoredll.setProcessDpiAwareness(dpiAwareness); - if (FAILED(hr)) - qWarning() << "SetProcessDpiAwareness failed:" << QWindowsContext::comErrorString(hr); + if (FAILED(hr)) { + qWarning().noquote().nospace() << "SetProcessDpiAwareness(" + << dpiAwareness << ") failed: " << QWindowsContext::comErrorString(hr) + << ", using " << QWindowsContext::processDpiAwareness(); + } } else { if (dpiAwareness != QtWindows::ProcessDpiUnaware && QWindowsContext::user32dll.setProcessDPIAware) { if (!QWindowsContext::user32dll.setProcessDPIAware()) diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index d08fc8f726..14baec96d8 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -148,7 +148,7 @@ struct QWindowsShcoreDLL { void init(); inline bool isValid() const { return getProcessDpiAwareness && setProcessDpiAwareness && getDpiForMonitor; } - typedef HRESULT (WINAPI *GetProcessDpiAwareness)(HANDLE,int); + typedef HRESULT (WINAPI *GetProcessDpiAwareness)(HANDLE,int *); typedef HRESULT (WINAPI *SetProcessDpiAwareness)(int); typedef HRESULT (WINAPI *GetDpiForMonitor)(HMONITOR,int,UINT *,UINT *); @@ -219,6 +219,7 @@ public: void setTabletAbsoluteRange(int a); void setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiAwareness); + static int processDpiAwareness(); // Returns a combination of SystemInfoFlags unsigned systemInfo() const; diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 55e6d55e5b..bd2014b8f2 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -224,7 +224,8 @@ QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList ¶mL dpiAwarenessSet = true; } qCDebug(lcQpaWindows) - << __FUNCTION__ << "DpiAwareness=" << dpiAwareness; + << __FUNCTION__ << "DpiAwareness=" << dpiAwareness + << "effective process DPI awareness=" << QWindowsContext::processDpiAwareness(); m_context.initTouch(m_options); } -- cgit v1.2.3 From c3d3604f4c7213d61e44ba0c310c270d08f881dd Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 15 Dec 2015 21:14:29 +0900 Subject: Make QUrl::removeAllQueryItems actually remove the query items We forgot to setQuery() after the query was modified. Task-number: QTBUG-49963 Change-Id: I11f559ef75544c50b3f8ffff1420148ba3092200 Reviewed-by: Oswald Buddenhagen Reviewed-by: David Faure --- src/corelib/io/qurlquery.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qurlquery.h b/src/corelib/io/qurlquery.h index ae3a79c119..8fcc1b13d5 100644 --- a/src/corelib/io/qurlquery.h +++ b/src/corelib/io/qurlquery.h @@ -121,7 +121,7 @@ inline QStringList QUrl::allQueryItemValues(const QString &key) const inline void QUrl::removeQueryItem(const QString &key) { QUrlQuery q(*this); q.removeQueryItem(key); setQuery(q); } inline void QUrl::removeAllQueryItems(const QString &key) -{ QUrlQuery q(*this); q.removeAllQueryItems(key); } +{ QUrlQuery q(*this); q.removeAllQueryItems(key); setQuery(q); } inline void QUrl::addEncodedQueryItem(const QByteArray &key, const QByteArray &value) { QUrlQuery q(*this); q.addQueryItem(fromEncodedComponent_helper(key), fromEncodedComponent_helper(value)); setQuery(q); } @@ -132,7 +132,7 @@ inline QByteArray QUrl::encodedQueryItemValue(const QByteArray &key) const inline void QUrl::removeEncodedQueryItem(const QByteArray &key) { QUrlQuery q(*this); q.removeQueryItem(fromEncodedComponent_helper(key)); setQuery(q); } inline void QUrl::removeAllEncodedQueryItems(const QByteArray &key) -{ QUrlQuery q(*this); q.removeAllQueryItems(fromEncodedComponent_helper(key)); } +{ QUrlQuery q(*this); q.removeAllQueryItems(fromEncodedComponent_helper(key)); setQuery(q); } inline void QUrl::setEncodedQueryItems(const QList > &qry) { -- cgit v1.2.3 From 49c743bdb972587e03944b68aa0290650163c5b1 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 4 Jan 2016 16:31:31 -0200 Subject: QDate: fix calculation of the week number for the last days of 2020 Off-by-one error: we should have calculated whether the current year is leap, not the next year. This affected any 53-week leap years. Task-number: QTBUG-50273 Change-Id: I134ce5db2f82468585ffffff14264cb9f12998fd Reviewed-by: Martin Klapetek Reviewed-by: Lars Knoll --- src/corelib/tools/qdatetime.cpp | 2 +- tests/auto/corelib/tools/qdate/tst_qdate.cpp | 41 +++++++++++++++++++++------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 9bbf5b8944..241b02df1b 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -583,7 +583,7 @@ int QDate::weekNumber(int *yearNumber) const Q_ASSERT(week == 52 || week == 53); } else if (week == 53) { // maybe first week of next year - int w = (yday - 365 - (QDate::isLeapYear(year + 1) ? 1 : 0) - wday + 10) / 7; + int w = (yday - 365 - (QDate::isLeapYear(year) ? 1 : 0) - wday + 10) / 7; if (w > 0) { ++year; week = w; diff --git a/tests/auto/corelib/tools/qdate/tst_qdate.cpp b/tests/auto/corelib/tools/qdate/tst_qdate.cpp index e515fcf5b9..937a490da2 100644 --- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp +++ b/tests/auto/corelib/tools/qdate/tst_qdate.cpp @@ -392,16 +392,37 @@ void tst_QDate::weekNumber_data() QTest::addColumn("month"); QTest::addColumn("day"); - //next we fill it with data - QTest::newRow( "data0" ) << 10 << 2002 << 2002 << 3 << 8; - QTest::newRow( "data1" ) << 10 << 2002 << 2002 << 3 << 8; - QTest::newRow( "data2" ) << 52 << 1999 << 2000 << 1 << 1; - QTest::newRow( "data3" ) << 52 << 1999 << 1999 << 12 << 31; - QTest::newRow( "data4" ) << 1 << 2001 << 2001 << 1 << 1; - QTest::newRow( "data5" ) << 53 << 1998 << 1998 << 12 << 31; - QTest::newRow( "data6" ) << 1 << 1985 << 1984 << 12 << 31; - QTest::newRow( "data7" ) << 52 << 2006 << 2006 << 12 << 31; - QTest::newRow( "data8" ) << 53 << 2004 << 2005 << 1 << 1; + enum { Thursday = 4 }; + bool wasLastYearLong = false; // 1999 was not a long (53-week) year + bool isLongYear; + + // full 400-year cycle for Jan 1, 4 and Dec 28, 31 + for (int yr = 2000; yr < 2400; ++yr, wasLastYearLong = isLongYear) { + QByteArray yrstr = QByteArray::number(yr); + int wday = QDate(yr, 1, 1).dayOfWeek(); + + // the year is 53-week long if Jan 1 is Thursday or, if it's a leap year, a Wednesday + isLongYear = (wday == Thursday) || (QDate::isLeapYear(yr) && wday == Thursday - 1); + + // Jan 4 is always on week 1 + QTest::newRow(yrstr + "-01-04") << 1 << yr << yr << 1 << 4; + + // Dec 28 is always on the last week + QTest::newRow(yrstr + "-12-28") << (52 + isLongYear) << yr << yr << 12 << 28; + + // Jan 1 is on either on week 1 or on the last week of the previous year + QTest::newRow(yrstr + "-01-01") + << (wday <= Thursday ? 1 : 52 + wasLastYearLong) + << (wday <= Thursday ? yr : yr - 1) + << yr << 1 << 1; + + // Dec 31 is either on the last week or week 1 of the next year + wday = QDate(yr, 12, 31).dayOfWeek(); + QTest::newRow(yrstr + "-12-31") + << (wday >= Thursday ? 52 + isLongYear : 1) + << (wday >= Thursday ? yr : yr + 1) + << yr << 12 << 31; + } } void tst_QDate::weekNumber() -- cgit v1.2.3 From 000c4358ceca78dc962a8ac287afdbb54e8b9837 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Fri, 8 Jan 2016 15:58:16 +0100 Subject: CMake: Make all tests link to Qt libraries This is needed as of commit v5.6.0-beta1~483 (Add an automatic use of the ELF-versioned QtCore symbol, 2015-10-20). Even if a translation unit only contains #include int main(int,char**) { return 0; } it must link to QtCore which provides the qt_version_tag symbol. Change-Id: I827c0a7403320e7e5b384d8608face20fcecdaea Reviewed-by: Stephen Kelly --- tests/auto/cmake/test_multiple_find_package/CMakeLists.txt | 4 ++-- tests/auto/cmake/test_multiple_find_package/subdir1/CMakeLists.txt | 2 +- tests/auto/cmake/test_platform_defs_include/CMakeLists.txt | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/auto/cmake/test_multiple_find_package/CMakeLists.txt b/tests/auto/cmake/test_multiple_find_package/CMakeLists.txt index c0fdfd6b9a..6b11c09e7b 100644 --- a/tests/auto/cmake/test_multiple_find_package/CMakeLists.txt +++ b/tests/auto/cmake/test_multiple_find_package/CMakeLists.txt @@ -9,5 +9,5 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") add_subdirectory(subdir1) -add_executable(exe1 "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp") -include_directories(${Qt5Core_INCLUDE_DIRS}) +add_executable(exe1 main.cpp) +target_link_libraries(exe1 Qt5::Core) diff --git a/tests/auto/cmake/test_multiple_find_package/subdir1/CMakeLists.txt b/tests/auto/cmake/test_multiple_find_package/subdir1/CMakeLists.txt index 0c7a113f50..dfcc35d735 100644 --- a/tests/auto/cmake/test_multiple_find_package/subdir1/CMakeLists.txt +++ b/tests/auto/cmake/test_multiple_find_package/subdir1/CMakeLists.txt @@ -2,4 +2,4 @@ find_package(Qt5Core REQUIRED) add_executable(exe2 "${CMAKE_CURRENT_SOURCE_DIR}/../main.cpp") -include_directories(${Qt5Core_INCLUDE_DIRS}) +target_link_libraries(exe2 Qt5::Core) diff --git a/tests/auto/cmake/test_platform_defs_include/CMakeLists.txt b/tests/auto/cmake/test_platform_defs_include/CMakeLists.txt index 2b32a419e7..e2f72842f6 100644 --- a/tests/auto/cmake/test_platform_defs_include/CMakeLists.txt +++ b/tests/auto/cmake/test_platform_defs_include/CMakeLists.txt @@ -11,3 +11,4 @@ add_definitions(${Qt5Core_DEFINITIONS}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") add_executable(myobject main.cpp) +target_link_libraries(myobject Qt5::Core) -- cgit v1.2.3 From 1bbf7fb4e39fd1382e3956e2bb5fbebaca01cf53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Sat, 9 Jan 2016 19:58:06 +0000 Subject: Fix a few container detachments Change-Id: I018a1fe4bdbbe42b683793d7ddbf19f464d6e3b0 Reviewed-by: Marc Mutz --- src/gui/painting/qpaintengine_raster.cpp | 2 +- src/widgets/kernel/qdesktopwidget.cpp | 2 +- src/widgets/util/qcompleter.cpp | 6 +++--- src/widgets/widgets/qdialogbuttonbox.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index d71297bd60..05ccff5de0 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -4193,7 +4193,7 @@ protected: void QGradientCache::generateGradientColorTable(const QGradient& gradient, QRgba64 *colorTable, int size, int opacity) const { - QGradientStops stops = gradient.stops(); + const QGradientStops stops = gradient.stops(); int stopCount = stops.count(); Q_ASSERT(stopCount > 0); diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp index a1c2aebbe6..2ddd025239 100644 --- a/src/widgets/kernel/qdesktopwidget.cpp +++ b/src/widgets/kernel/qdesktopwidget.cpp @@ -203,7 +203,7 @@ int QDesktopWidget::screenNumber(const QWidget *w) const return primaryScreen(); // If there is more than one virtual desktop - if (screens.count() != screens.first()->virtualSiblings().count()) { + if (screens.count() != screens.constFirst()->virtualSiblings().count()) { // Find the root widget, get a QScreen from it and use the // virtual siblings for checking the window position. const QWidget *root = w; diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index ba56f004b7..4382abaf50 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -432,7 +432,7 @@ void QCompletionEngine::filter(const QStringList& parts) QModelIndex parent; for (int i = 0; i < curParts.count() - 1; i++) { - QString part = curParts[i]; + QString part = curParts.at(i); int emi = filter(part, parent, -1).exactMatchIndex; if (emi == -1) return; @@ -442,10 +442,10 @@ void QCompletionEngine::filter(const QStringList& parts) // Note that we set the curParent to a valid parent, even if we have no matches // When filtering is disabled, we show all the items under this parent curParent = parent; - if (curParts.last().isEmpty()) + if (curParts.constLast().isEmpty()) curMatch = QMatchData(QIndexMapper(0, model->rowCount(curParent) - 1), -1, false); else - curMatch = filter(curParts.last(), curParent, 1); // build at least one + curMatch = filter(curParts.constLast(), curParent, 1); // build at least one curRow = curMatch.isValid() ? 0 : -1; } diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index 5b6bfb3b3c..4d2c32d43e 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -261,7 +261,7 @@ void QDialogButtonBoxPrivate::layoutButtons() if (center) buttonLayout->addStretch(); - QList acceptRoleList = buttonLists[QPlatformDialogHelper::AcceptRole]; + const QList &acceptRoleList = buttonLists[QPlatformDialogHelper::AcceptRole]; while (*currentLayout != QPlatformDialogHelper::EOL) { int role = (*currentLayout & ~QPlatformDialogHelper::Reverse); -- cgit v1.2.3 From 71c0bb3fd12650f44bb6095d4915e2551fc11e11 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 7 Jan 2016 19:56:41 +0000 Subject: Revert "dbus: Add method serial() and replySerial() to class DBusMessage." This reverts commit 618e2cc081e09d9222418bd933876224675a7530. The original commit has a section of code that I failed to review properly and is of questionable functionality. Change-Id: I61c53d7b8b2aa7c3312292b017a18aba7da11bc5 Reviewed-by: Thiago Macieira --- src/dbus/qdbus_symbols_p.h | 2 -- src/dbus/qdbusmessage.cpp | 41 ---------------------- src/dbus/qdbusmessage.h | 2 -- src/dbus/qdbusmessage_p.h | 2 -- .../dbus/qdbusconnection/tst_qdbusconnection.cpp | 7 ---- 5 files changed, 54 deletions(-) diff --git a/src/dbus/qdbus_symbols_p.h b/src/dbus/qdbus_symbols_p.h index 67680f6b82..1991a462e9 100644 --- a/src/dbus/qdbus_symbols_p.h +++ b/src/dbus/qdbus_symbols_p.h @@ -286,8 +286,6 @@ DEFINEFUNC(const char* , dbus_message_get_sender, (DBusMessage *message), (message), return) DEFINEFUNC(dbus_uint32_t , dbus_message_get_serial, (DBusMessage *message), (message), return) -DEFINEFUNC(dbus_uint32_t , dbus_message_get_reply_serial, (DBusMessage *message), - (message), return) DEFINEFUNC(const char* , dbus_message_get_signature, (DBusMessage *message), (message), return) DEFINEFUNC(int , dbus_message_get_type, (DBusMessage *message), diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp index 078442f3f1..43a562e92e 100644 --- a/src/dbus/qdbusmessage.cpp +++ b/src/dbus/qdbusmessage.cpp @@ -188,12 +188,7 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB // check if everything is ok if (marshaller.ok) - { - QDBusMessage *m = (QDBusMessage*)&message; - q_dbus_message_ref(msg); - m->d_ptr->msg = msg; return msg; - } // not ok; q_dbus_message_unref(msg); @@ -322,16 +317,6 @@ QDBusMessage QDBusMessagePrivate::makeLocalReply(const QDBusConnectionPrivate &c return QDBusMessage(); // failed } -uint QDBusMessagePrivate::serial() -{ - return msg ? q_dbus_message_get_serial(msg) : reply ? q_dbus_message_get_serial(reply) : 0; -} - -uint QDBusMessagePrivate::replySerial() -{ - return msg ? q_dbus_message_get_reply_serial(msg) : reply ? q_dbus_message_get_reply_serial(reply) : 0; -} - /*! \class QDBusMessage \inmodule QtDBus @@ -647,32 +632,6 @@ QString QDBusMessage::signature() const return d_ptr->signature; } -/*! - Returns the serial of the message or 0 if undefined. - - The serial number is a unique identifier of a message coming from a - given connection. - - The serial is set to a non zero value after the message has been sent - over a D-Bus connection. -*/ -uint QDBusMessage::serial() const -{ - return d_ptr->serial(); -} - -/*! - Returns the serial of the message this is a reply to or 0 if undefined. - - The serial number is a unique identifier of a message coming from a - given connection and D-Bus messages of 'method return' or 'error' type - use them to match the reply to the method call message. -*/ -uint QDBusMessage::replySerial() const -{ - return d_ptr->replySerial(); -} - /*! Returns the flag that indicates if this message should see a reply or not. This is only meaningful for \l {MethodCallMessage}{method diff --git a/src/dbus/qdbusmessage.h b/src/dbus/qdbusmessage.h index f6538bd2cf..e85d600080 100644 --- a/src/dbus/qdbusmessage.h +++ b/src/dbus/qdbusmessage.h @@ -104,8 +104,6 @@ public: QString errorMessage() const; MessageType type() const; QString signature() const; - uint serial() const; - uint replySerial() const; bool isReplyRequired() const; diff --git a/src/dbus/qdbusmessage_p.h b/src/dbus/qdbusmessage_p.h index 0ad9924cac..5abd490502 100644 --- a/src/dbus/qdbusmessage_p.h +++ b/src/dbus/qdbusmessage_p.h @@ -93,8 +93,6 @@ public: const QDBusMessage &asSent); static QDBusMessage makeLocalReply(const QDBusConnectionPrivate &conn, const QDBusMessage &asSent); - uint serial(); - uint replySerial(); }; QT_END_NAMESPACE diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp index a1530a8b86..e91f87d6c8 100644 --- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp +++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp @@ -71,7 +71,6 @@ void tst_QDBusConnection::noConnection() QVERIFY(con.callWithCallback(msg, &spy, SLOT(asyncReply)) == 0); QDBusMessage reply = con.call(msg); - QCOMPARE(msg.serial(), reply.replySerial()); QVERIFY(reply.type() == QDBusMessage::ErrorMessage); QDBusReply voidreply(reply); @@ -153,7 +152,6 @@ void tst_QDBusConnection::send() QDBusMessage reply = con.call(msg); - QCOMPARE(msg.serial(), reply.replySerial()); QCOMPARE(reply.arguments().count(), 1); QCOMPARE(reply.arguments().at(0).typeName(), "QStringList"); QVERIFY(reply.arguments().at(0).toStringList().contains(con.baseService())); @@ -173,7 +171,6 @@ void tst_QDBusConnection::sendWithGui() QDBusMessage reply = con.call(msg, QDBus::BlockWithGui); - QCOMPARE(msg.serial(), reply.replySerial()); QCOMPARE(reply.arguments().count(), 1); QCOMPARE(reply.arguments().at(0).typeName(), "QStringList"); QVERIFY(reply.arguments().at(0).toStringList().contains(con.baseService())); @@ -843,7 +840,6 @@ void tst_QDBusConnection::callSelf() QString(), "test3"); msg << 44; reply = connection.call(msg); - QCOMPARE(msg.serial(), reply.replySerial()); QCOMPARE(reply.arguments().value(0).toInt(), 45); } @@ -911,7 +907,6 @@ void tst_QDBusConnection::callSelfByAnotherName() QString(), "test0"); QDBusMessage reply = con.call(msg, QDBus::Block, 1000); - QCOMPARE(msg.serial(), reply.replySerial()); QVERIFY(reply.type() == QDBusMessage::ReplyMessage); } @@ -927,7 +922,6 @@ void tst_QDBusConnection::multipleInterfacesInQObject() QDBusMessage msg = QDBusMessage::createMethodCall(con.baseService(), "/p1", "local.BaseObject", "anotherMethod"); QDBusMessage reply = con.call(msg, QDBus::Block); - QCOMPARE(msg.serial(), reply.replySerial()); QCOMPARE(reply.type(), QDBusMessage::ReplyMessage); QVERIFY(reply.arguments().count() == 0); } @@ -1208,7 +1202,6 @@ void tst_QDBusConnection::callVirtualObjectLocal() QDBusMessage message = QDBusMessage::createMethodCall(con.baseService(), path, QString(), "hello"); QDBusMessage reply = con.call(message, QDBus::Block, 5000); - QCOMPARE(message.serial(), reply.replySerial()); QCOMPARE(obj.callCount, 1); QCOMPARE(obj.lastMessage.service(), con.baseService()); QCOMPARE(obj.lastMessage.interface(), QString()); -- cgit v1.2.3 From 15b65e7a5f6f5ca962a6688116641502ff41ae00 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 7 Jan 2016 19:56:35 +0000 Subject: Revert "dbus: Print out 'serial' and 'serial reply to' with DBusMessage operator<<." This reverts commit d3fe4f066f70bc8e4aef06b963444ecdbc3dd00f. Required to revert the parent commit. Change-Id: I1039e2ee65c0cd2c3209ea18bd3bd2d84a8daef3 Reviewed-by: Thiago Macieira --- src/dbus/qdbusintegrator.cpp | 4 ++-- src/dbus/qdbusmessage.cpp | 10 ++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 0c0109b6b6..f6221d51b6 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1819,8 +1819,8 @@ bool QDBusConnectionPrivate::send(const QDBusMessage& message) } q_dbus_message_set_no_reply(msg, true); // the reply would not be delivered to anything - emit messageNeedsSending(Q_NULLPTR, msg); qDBusDebug() << this << "sending message (no reply):" << message; + emit messageNeedsSending(Q_NULLPTR, msg); return true; } @@ -2019,8 +2019,8 @@ QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusM lastError = error; processFinishedCall(pcall); } else { - emit messageNeedsSending(pcall, msg, timeout); qDBusDebug() << this << "sending message:" << message; + emit messageNeedsSending(pcall, msg, timeout); } return pcall; } diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp index 43a562e92e..32b7787514 100644 --- a/src/dbus/qdbusmessage.cpp +++ b/src/dbus/qdbusmessage.cpp @@ -820,16 +820,10 @@ QDebug operator<<(QDebug dbg, const QDBusMessage &msg) msg.type() == QDBusMessage::SignalMessage) dbg.nospace() << ", path=" << msg.path() << ", interface=" << msg.interface() - << ", member=" << msg.member() - << ", serial=" << msg.serial(); + << ", member=" << msg.member(); if (msg.type() == QDBusMessage::ErrorMessage) dbg.nospace() << ", error name=" << msg.errorName() - << ", error message=" << msg.errorMessage() - << ", serial=" << msg.serial() - << ", reply serial=" << msg.replySerial(); - else if (msg.type() == QDBusMessage::ReplyMessage) - dbg.nospace() << ", serial=" << msg.serial() - << ", reply serial=" << msg.replySerial(); + << ", error message=" << msg.errorMessage(); dbg.nospace() << ", signature=" << msg.signature() << ", contents=("; debugVariantList(dbg, msg.arguments()); -- cgit v1.2.3 From 29f41e5e3858c7fdb51909eb7cc9a0bb440600ff Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 2 Jan 2016 18:55:14 -0200 Subject: Change the ELF linker version script creator to take no parameters It only needs stdin now, instead of stdin plus a separate file containing a list of file names. Change-Id: I9f3db030001e47e4a4e5ffff1425b76884cc7ca0 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/data/unix/findclasslist.pl | 42 ++++++++++------------------- mkspecs/features/qt_module.prf | 12 +++++---- 2 files changed, 21 insertions(+), 33 deletions(-) diff --git a/mkspecs/features/data/unix/findclasslist.pl b/mkspecs/features/data/unix/findclasslist.pl index ac010ae0a7..adec22d58d 100644 --- a/mkspecs/features/data/unix/findclasslist.pl +++ b/mkspecs/features/data/unix/findclasslist.pl @@ -1,7 +1,7 @@ #!/usr/bin/env perl ############################################################################# ## -## Copyright (C) 2015 Intel Corporation +## Copyright (C) 2016 Intel Corporation ## Contact: http://www.qt.io/licensing/ ## ## This file is part of the build configuration tools of the Qt Toolkit. @@ -33,40 +33,26 @@ ############################################################################# use strict; -my $syntax = "findclasslist.pl \n" . - "Replaces \@CLASSLIST\@ with the classes found in the header files\n"; - -die("Expected exactly one argument") if (@ARGV != 1); - -my @headers = (); - -# Expand contents of the command-line arguments file -open ARGFILE, "<$ARGV[0]" or die("Could not open arguments file $ARGV[0]: $!"); -while (my $line = ) { - chomp($line); - push @headers, $line; -} -close ARGFILE; +my $syntax = "findclasslist.pl\n" . + "Replaces each \@FILE:filename\@ in stdin with the classes found in that file\n"; $\ = $/; while () { chomp; - unless (/\@CLASSLIST\@/) { + unless (/\@FILE:(.*)\@/) { print; next; } - # Replace @CLASSLIST@ with the class list - for my $header (@headers) { - open HDR, "<$header" or die("Could not open header $header: $!"); - my $comment = " /* $header */"; - while (my $line = ) { - # Match a struct or class declaration, but not a forward declaration - $line =~ /^(?:struct|class) (?:Q_.*_EXPORT)? (\w+)(?!;)/ or next; - print $comment if $comment; - printf " *%d%s*;\n", length $1, $1; - $comment = 0; - } - close HDR; + # Replace this line with the class list + open HDR, "<$1" or die("Could not open header $1: $!"); + my $comment = " /* $1 */"; + while (my $line = ) { + # Match a struct or class declaration, but not a forward declaration + $line =~ /^(?:struct|class) (?:Q_.*_EXPORT)? (\w+)(?!;)/ or next; + print $comment if $comment; + printf " *%d%s*;\n", length $1, $1; + $comment = 0; } + close HDR; } diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index a80eba6607..6ed75a4416 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -199,7 +199,10 @@ android: CONFIG += qt_android_deps no_linker_version_script verscript_content = "Qt_$${QT_MAJOR_VERSION}_PRIVATE_API { *; };" } else { verscript_content = "Qt_$${QT_MAJOR_VERSION}_PRIVATE_API {" \ - " qt_private_api_tag*;" "@CLASSLIST@" "};" + " qt_private_api_tag*;" + for(header, SYNCQT.PRIVATE_HEADER_FILES): \ + verscript_content += " @FILE:$${_PRO_FILE_PWD_}/$$header@" + verscript_content += "};" current = Qt_$$QT_MAJOR_VERSION verscript_content += "$$current { *; };" @@ -213,13 +216,12 @@ android: CONFIG += qt_android_deps no_linker_version_script else: verscript_content += "$$current {} $$previous;" } - # Add a post-processing step to replace the @CLASSLIST@ - verscriptprocess.commands = perl $${PWD}/data/unix/findclasslist.pl < $${verscript}.in $${verscript}.in.args > $@ + # Add a post-processing step to replace the @FILE:filename@ + verscriptprocess.commands = perl $${PWD}/data/unix/findclasslist.pl < $${verscript}.in > $@ verscriptprocess.target = $$verscript for(header, SYNCQT.PRIVATE_HEADER_FILES): \ verscriptprocess.depends += $${_PRO_FILE_PWD_}/$$header - write_file($${verscript}.in.args, verscriptprocess.depends)|error("Aborting.") - verscriptprocess.depends += $${verscript}.in $${verscript}.in.args + verscriptprocess.depends += $${verscript}.in QMAKE_EXTRA_TARGETS += verscriptprocess PRE_TARGETDEPS += $$verscript verscript = $${verscript}.in -- cgit v1.2.3 From ac2bde9caf41764eacca4f9ece1b724dc924babf Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 17 Dec 2015 13:07:17 -0800 Subject: QVariant: make sure two floating points compare equal if they are equal Not just fuzzily equal. The fuzzy comparison fails for infinities, since the expression p1 - p2 where p1 = p2 = infinity is NaN. And NaN comparisons are always false. As a nice side-effect, we don't do the more expensive computation of a multiplication if the two numbers really are equal. Task-number: QTBUG-50036 Change-Id: I11f559ef75544c50b3f8ffff1420cec7c7273295 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qvariant.cpp | 2 +- tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index fdcbdb1c45..3e6aefab2a 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -3448,7 +3448,7 @@ static int numericCompare(const QVariant::Private *d1, const QVariant::Private * Q_ASSERT(ok); qreal r2 = qConvertToRealNumber(d2, &ok); Q_ASSERT(ok); - if (qFuzzyCompare(r1, r2)) + if (r1 == r2 || qFuzzyCompare(r1, r2)) return 0; return r1 < r2 ? -1 : 1; } diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 40eb2e5c9d..c91bb21399 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -1711,12 +1711,16 @@ void tst_QVariant::compareNumbers_data() const QTest::newRow("float3") << qVariantFromValue(0.f) << qVariantFromValue(-1.f) << +1; QTest::newRow("float4") << qVariantFromValue(-float(qInf())) << qVariantFromValue(0.f) << -1; QTest::newRow("float5") << qVariantFromValue(0.f) << qVariantFromValue(-float(qInf())) << +1; + QTest::newRow("float6") << qVariantFromValue(-float(qInf())) << qVariantFromValue(-float(qInf())) << 0; + QTest::newRow("float7") << qVariantFromValue(float(qInf())) << qVariantFromValue(float(qInf())) << 0; QTest::newRow("double1") << qVariantFromValue(0.) << qVariantFromValue(0.) << 0; QTest::newRow("double2") << qVariantFromValue(-1.) << qVariantFromValue(0.) << -1; QTest::newRow("double3") << qVariantFromValue(0.) << qVariantFromValue(-1.) << +1; QTest::newRow("double4") << qVariantFromValue(-qInf()) << qVariantFromValue(0.) << -1; QTest::newRow("double5") << qVariantFromValue(0.) << qVariantFromValue(-qInf()) << +1; + QTest::newRow("double6") << qVariantFromValue(-double(qInf())) << qVariantFromValue(-qInf()) << 0; + QTest::newRow("double7") << qVariantFromValue(qInf()) << qVariantFromValue(qInf()) << 0; // mixed comparisons // fp + fp @@ -1725,6 +1729,8 @@ void tst_QVariant::compareNumbers_data() const QTest::newRow("float+double3") << qVariantFromValue(0.f) << qVariantFromValue(-1.) << +1; QTest::newRow("float+double4") << qVariantFromValue(-float(qInf())) << qVariantFromValue(0.) << -1; QTest::newRow("float+double5") << qVariantFromValue(0.f) << qVariantFromValue(-qInf()) << +1; + QTest::newRow("float+double6") << qVariantFromValue(-float(qInf())) << qVariantFromValue(qInf()) << 0; + QTest::newRow("float+double7") << qVariantFromValue(float(qInf())) << qVariantFromValue(qInf()) << 0; // fp + int QTest::newRow("float+int1") << qVariantFromValue(0.f) << qVariantFromValue(0) << 0; @@ -1735,6 +1741,7 @@ void tst_QVariant::compareNumbers_data() const QTest::newRow("double+int3") << qVariantFromValue(0.) << qVariantFromValue(-1) << +1; QTest::newRow("float+int4") << qVariantFromValue(1.5f) << qVariantFromValue(1) << +1; QTest::newRow("double+int4") << qVariantFromValue(1.5) << qVariantFromValue(1) << +1; + QTest::newRow("double+int5") << qVariantFromValue(qInf()) << qVariantFromValue(1) << +1; // fp + uint QTest::newRow("float+uint1") << qVariantFromValue(0.f) << qVariantFromValue(0U) << 0; -- cgit v1.2.3 From 89293e6b195bd56ba0b1daac9d5b248562c9e393 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 4 Nov 2015 10:22:19 +0100 Subject: Make DST-transition test more general. Widen its interval (to work in more TZs) and test spring as well as autumn. Anywhere that does have a DST transition probably has it between August and December; and there's no benefit to using a narrow window. There's also no sense skipping the test if we don't know there's a DST transition: the test should still work, it just won't be testing anything (about DST transitions). Combine date and time checks into date-time checks, so that, when one of them fails, QCOMPARE lets us know how the other changed, too. Task-number: QTBUG-49008 Change-Id: I145b939ffef0dd0b54fd0e3cdf72a159c57ec00b Reviewed-by: Thiago Macieira --- .../auto/corelib/tools/qdatetime/tst_qdatetime.cpp | 46 ++++++++++++++-------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index 833dfe87d7..216c670aee 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -68,6 +68,7 @@ private slots: void timeSpec(); void toTime_t_data(); void toTime_t(); + void daylightSavingsTimeChange_data(); void daylightSavingsTimeChange(); void springForward_data(); void springForward(); @@ -1563,36 +1564,47 @@ void tst_QDateTime::toTime_t() } } +void tst_QDateTime::daylightSavingsTimeChange_data() +{ + QTest::addColumn("inDST"); + QTest::addColumn("outDST"); + QTest::newRow("Autumn") << QDate(2006, 8, 1) << QDate(2006, 12, 1); + QTest::newRow("Spring") << QDate(2006, 5, 1) << QDate(2006, 2, 1); +} + void tst_QDateTime::daylightSavingsTimeChange() { - // This is a regression test for an old bug where starting with a date in - // DST and then moving to a date outside it (or vice-versa) caused 1-hour - // jumps in time when addSecs() was called. + // This has grown from a regression test for an old bug where starting with + // a date in DST and then moving to a date outside it (or vice-versa) caused + // 1-hour jumps in time when addSecs() was called. // // The bug was caused by QDateTime knowing more than it lets show. // Internally, if it knows, QDateTime stores a flag indicating if the time is // DST or not. If it doesn't, it sets to "LocalUnknown". The problem happened // because some functions did not reset the flag when moving in or out of DST. - // WARNING: This test only works if there's a Daylight Savings Time change - // in the current locale between 2006-11-06 and 2006-10-16 - // This is true for Central European Time + // WARNING: This only tests anything if there's a Daylight Savings Time change + // in the current locale between inDST and outDST. + // This is true for Central European Time and may be elsewhere. - if (!europeanTimeZone) - QSKIP("Not tested with timezone other than Central European (CET/CEST)"); + QFETCH(QDate, inDST); + QFETCH(QDate, outDST); - QDateTime dt = QDateTime(QDate(2006, 11, 6), QTime(0, 0, 0), Qt::LocalTime); - dt.setDate(QDate(2006, 10, 16)); + // First with simple construction + QDateTime dt = QDateTime(outDST, QTime(0, 0, 0), Qt::LocalTime); + int outDSTsecs = dt.toTime_t(); + + dt.setDate(inDST); dt = dt.addSecs(1); - QCOMPARE(dt.date(), QDate(2006, 10, 16)); - QCOMPARE(dt.time(), QTime(0, 0, 1)); + QCOMPARE(dt, QDateTime(inDST, QTime(0, 0, 1))); // now using fromTime_t - dt = QDateTime::fromTime_t(1162767600); // 2006-11-06 00:00:00 +0100 - dt.setDate(QDate(2006, 10, 16)); - dt = dt.addSecs (1); - QCOMPARE(dt.date(), QDate(2006, 10, 16)); - QCOMPARE(dt.time(), QTime(0, 0, 1)); + dt = QDateTime::fromTime_t(outDSTsecs); + QCOMPARE(dt, QDateTime(outDST, QTime(0, 0, 0))); + + dt.setDate(inDST); + dt = dt.addSecs(60); + QCOMPARE(dt, QDateTime(inDST, QTime(0, 1, 0))); } void tst_QDateTime::springForward_data() -- cgit v1.2.3 From f186c4a819c209a63de4eb7329addaa6f4bde403 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 7 Jan 2016 15:30:54 +0100 Subject: Diaglib: Fix and extend dumping of native windows (Windows). When recursing over the windows, the code did not take into account that EnumChildWindow enumerates grand children as well. Exclude those by checking for the direct parent in the recursion so that the hierarchy is printed correctly. Add more information about class and module and rearrange the output a bit so that the window title is more prominent. Task-number: QTBUG-50206 Change-Id: Iffb12c44eda9d09da5eb14a8405aee52ed3aa849 Reviewed-by: Oliver Wolff --- tests/manual/diaglib/nativewindowdump_win.cpp | 48 ++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/tests/manual/diaglib/nativewindowdump_win.cpp b/tests/manual/diaglib/nativewindowdump_win.cpp index e3885eb96d..b25f8aa864 100644 --- a/tests/manual/diaglib/nativewindowdump_win.cpp +++ b/tests/manual/diaglib/nativewindowdump_win.cpp @@ -48,9 +48,10 @@ namespace QtDiag { struct DumpContext { - DumpContext() : indentation(0) {} + DumpContext() : indentation(0), parent(0) {} int indentation; + HWND parent; QSharedPointer stream; }; @@ -64,11 +65,19 @@ static void formatNativeWindow(HWND hwnd, QTextStream &str) RECT rect; if (GetWindowRect(hwnd, &rect)) { str << ' ' << (rect.right - rect.left) << 'x' << (rect.bottom - rect.top) - << '+' << rect.left << '+' << rect.top; + << forcesign << rect.left << rect.top << noforcesign; } if (IsWindowVisible(hwnd)) str << " [visible]"; + wchar_t buf[512]; + if (GetWindowText(hwnd, buf, sizeof(buf)/sizeof(buf[0])) && buf[0]) + str << " title=\"" << QString::fromWCharArray(buf) << "\"/"; + else + str << ' '; + if (GetClassName(hwnd, buf, sizeof(buf)/sizeof(buf[0]))) + str << '"' << QString::fromWCharArray(buf) << '"'; + str << hex << showbase; if (const LONG_PTR style = GetWindowLongPtr(hwnd, GWL_STYLE)) { str << " style=" << style; @@ -121,13 +130,31 @@ static void formatNativeWindow(HWND hwnd, QTextStream &str) debugWinStyle(str, exStyle, WS_EX_COMPOSITED) debugWinStyle(str, exStyle, WS_EX_NOACTIVATE) } + + if (const ULONG_PTR classStyle = GetClassLongPtr(hwnd, GCL_STYLE)) { + str << " classStyle=" << classStyle; + debugWinStyle(str, classStyle, CS_BYTEALIGNCLIENT) + debugWinStyle(str, classStyle, CS_BYTEALIGNWINDOW) + debugWinStyle(str, classStyle, CS_CLASSDC) + debugWinStyle(str, classStyle, CS_DBLCLKS) + debugWinStyle(str, classStyle, CS_DROPSHADOW) + debugWinStyle(str, classStyle, CS_GLOBALCLASS) + debugWinStyle(str, classStyle, CS_HREDRAW) + debugWinStyle(str, classStyle, CS_NOCLOSE) + debugWinStyle(str, classStyle, CS_OWNDC) + debugWinStyle(str, classStyle, CS_PARENTDC) + debugWinStyle(str, classStyle, CS_SAVEBITS) + debugWinStyle(str, classStyle, CS_VREDRAW) + } + + if (const ULONG_PTR wndProc = GetClassLongPtr(hwnd, GCLP_WNDPROC)) + str << " wndProc=" << wndProc; + str << noshowbase << dec; - wchar_t buf[512]; - if (GetWindowText(hwnd, buf, sizeof(buf)/sizeof(buf[0]))) - str << " title=\"" << QString::fromWCharArray(buf) << '"'; - if (GetClassName(hwnd, buf, sizeof(buf)/sizeof(buf[0]))) - str << " class=\"" << QString::fromWCharArray(buf) << '"'; + if (GetWindowModuleFileName(hwnd, buf, sizeof(buf)/sizeof(buf[0]))) + str << " module=\"" << QString::fromWCharArray(buf) << '"'; + str << '\n'; } @@ -135,7 +162,11 @@ static void dumpNativeWindowRecursion(HWND hwnd, DumpContext *dc); BOOL CALLBACK dumpWindowEnumChildProc(HWND hwnd, LPARAM lParam) { - dumpNativeWindowRecursion(hwnd, reinterpret_cast(lParam)); + DumpContext *dumpContext = reinterpret_cast(lParam); + // EnumChildWindows enumerates grand children as well, skip these to + // get the hierarchical formatting right. + if (GetAncestor(hwnd, GA_PARENT) == dumpContext->parent) + dumpNativeWindowRecursion(hwnd, dumpContext); return TRUE; } @@ -145,6 +176,7 @@ static void dumpNativeWindowRecursion(HWND hwnd, DumpContext *dc) formatNativeWindow(hwnd, *dc->stream); DumpContext nextLevel = *dc; nextLevel.indentation += 2; + nextLevel.parent = hwnd; EnumChildWindows(hwnd, dumpWindowEnumChildProc, reinterpret_cast(&nextLevel)); } -- cgit v1.2.3 From 1c32b71cd0ea6a05a4d328a7d30f19b49d0d67f1 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Fri, 8 Jan 2016 15:16:45 +0100 Subject: CMake: Fix qt5_use_modules macro for CMake 2.8.11 Note the excessive escaping around "GNU". Otherwise this leaks the -fPIE flag to the target. Change-Id: I340df5d5bce00ebec4e1ff3a557ade67022ba23b Reviewed-by: Stephen Kelly --- src/corelib/Qt5CoreMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index c441d3ad73..9fab04fb26 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -336,7 +336,7 @@ if (NOT CMAKE_VERSION VERSION_LESS 2.8.9) set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG) if (Qt5_POSITION_INDEPENDENT_CODE AND (CMAKE_VERSION VERSION_LESS 2.8.12 - AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL \"GNU\" + AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0))) set_property(TARGET ${_target} PROPERTY POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE}) endif() -- cgit v1.2.3 From 558f69a18b0ac2a54fdbc44377ef963c8db89ad6 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Fri, 8 Jan 2016 15:58:42 +0100 Subject: CMake: Ensure that -fPIC is passed in tests. CMake newer than 2.8.12 automatically adds the appropriate flag, but CI still runs 2.8.11. Change-Id: Ie61375f2feb54a92c9d8f0ed6ad5227a67343bc5 Reviewed-by: Stephen Kelly --- tests/auto/cmake/test_interface/CMakeLists.txt | 2 ++ tests/auto/cmake/test_use_modules_function/CMakeLists.txt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/auto/cmake/test_interface/CMakeLists.txt b/tests/auto/cmake/test_interface/CMakeLists.txt index a8af92da63..2af80ea448 100644 --- a/tests/auto/cmake/test_interface/CMakeLists.txt +++ b/tests/auto/cmake/test_interface/CMakeLists.txt @@ -8,6 +8,8 @@ find_package(Qt5Widgets) set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") + add_executable(test_interface_exe WIN32 main.cpp mainwindow.cpp) # No need to specify include directories, compile definitions, the PIC flag, or to diff --git a/tests/auto/cmake/test_use_modules_function/CMakeLists.txt b/tests/auto/cmake/test_use_modules_function/CMakeLists.txt index bfcdd9d1d7..be05c75054 100644 --- a/tests/auto/cmake/test_use_modules_function/CMakeLists.txt +++ b/tests/auto/cmake/test_use_modules_function/CMakeLists.txt @@ -12,5 +12,7 @@ add_executable(three three.cpp) find_package(Qt5Core) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") + qt5_use_modules(two Test) qt5_use_modules(three Gui Test) -- cgit v1.2.3 From 2b1f01426c1ee47474b4b8e4e53799d992d0711c Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Thu, 7 Jan 2016 13:20:08 +0100 Subject: WinRT: Fix application shutdown Do not create a dummy eglDisplay when the global static is constructed. This causes ANGLE to wrongly set some internals, which breaks usage of EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE as the attribute map might be empty after calling eglGetPlatformDisplayEXT. Furthermore initialize() assigns a new display to it without terminating the old one. This way, the internal suspend handler in ANGLE (Trim11.cpp) will be added to the application. The suspend handler is not invoked when an application suspends though. Reason being that the handler needs to be added from inside the Xaml thread. As we cannot control this inside ANGLE, we will call eglInitialize inside the Xaml thread and hence get the suspend event properly. Task-number: QTBUG-50337 Task-number: QTBUG-50292 Change-Id: I3867377254c37084bf24f18e78af467f6237db57 Reviewed-by: Oliver Wolff --- src/plugins/platforms/winrt/qwinrteglcontext.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/winrt/qwinrteglcontext.cpp b/src/plugins/platforms/winrt/qwinrteglcontext.cpp index 3fd0278360..ebd15d7184 100644 --- a/src/plugins/platforms/winrt/qwinrteglcontext.cpp +++ b/src/plugins/platforms/winrt/qwinrteglcontext.cpp @@ -54,9 +54,6 @@ QT_BEGIN_NAMESPACE struct WinRTEGLDisplay { WinRTEGLDisplay() { - eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); - if (eglDisplay == EGL_NO_DISPLAY) - qCritical("Failed to initialize EGL display: 0x%x", eglGetError()); } ~WinRTEGLDisplay() { eglTerminate(eglDisplay); @@ -117,9 +114,17 @@ void QWinRTEGLContext::initialize() if (g->eglDisplay == EGL_NO_DISPLAY) qCritical("Failed to initialize EGL display: 0x%x", eglGetError()); - if (!eglInitialize(g->eglDisplay, nullptr, nullptr)) - qCritical("Failed to initialize EGL: 0x%x", eglGetError()); - + // eglInitialize checks for EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE + // which adds a suspending handler. This needs to be added from the Xaml + // thread itself, otherwise it will not be invoked. add_Suspending does + // not return an error unfortunately, so it silently fails and causes + // applications to not quit when the system wants to terminate the app + // after suspend. + hr = QEventDispatcherWinRT::runOnXamlThread([]() { + if (!eglInitialize(g->eglDisplay, nullptr, nullptr)) + qCritical("Failed to initialize EGL: 0x%x", eglGetError()); + return S_OK; + }); d->eglConfig = q_configFromGLFormat(g->eglDisplay, d->format); const EGLint flags = d->format.testOption(QSurfaceFormat::DebugContext) -- cgit v1.2.3 From c4ecab7127807eddd820b5c747a805cf5b0fd06d Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Thu, 7 Jan 2016 13:32:09 +0100 Subject: WinRT: Invoke correct remove handler Probably a typo when moving to Xaml. Change-Id: I0739f4561912e1e16df7b124d6d187cd0f60f657 Reviewed-by: Oliver Wolff --- src/plugins/platforms/winrt/qwinrtintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/winrt/qwinrtintegration.cpp b/src/plugins/platforms/winrt/qwinrtintegration.cpp index e94a0aa846..93757d293c 100644 --- a/src/plugins/platforms/winrt/qwinrtintegration.cpp +++ b/src/plugins/platforms/winrt/qwinrtintegration.cpp @@ -124,7 +124,7 @@ QWinRTIntegration::QWinRTIntegration() : d_ptr(new QWinRTIntegrationPrivate) IID_PPV_ARGS(&d->application)); Q_ASSERT_SUCCEEDED(hr); hr = d->application->add_Suspending(Callback(this, &QWinRTIntegration::onSuspended).Get(), - &d->applicationTokens[&ICoreApplication::remove_Resuming]); + &d->applicationTokens[&ICoreApplication::remove_Suspending]); Q_ASSERT_SUCCEEDED(hr); hr = d->application->add_Resuming(Callback(this, &QWinRTIntegration::onResume).Get(), &d->applicationTokens[&ICoreApplication::remove_Resuming]); -- cgit v1.2.3 From becbffe291c1105eb422e8dc66c67c5b6443b96c Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Fri, 8 Jan 2016 12:50:32 +0100 Subject: winphone: Properly close the application When shutting down an application on Windows Phone the SceneGraph tries to create an offscreen surface to render into. If there is no offscreen surface available, it creates a new native window and tries to hide it. As the native event loop is about to shut down, creation fails and exceptions are raised. Instead we create a vanilla QPlatformOffscreenSurface. The SceneGraph recognizes it as such and can handle a proper cleanup on its own. Furthermore removing the suspend/resume handler in the destructor of QWinRTIntegration fails for Windows Phone as the application object itself does not accept this anymore. Hence skip this part for this platform. Task-number: QTBUG-49310 Change-Id: I02acdd5a635ef0b9d6ef8199376537b8f0f1a8fb Reviewed-by: Oliver Wolff --- src/plugins/platforms/winrt/qwinrteglcontext.cpp | 4 ++++ src/plugins/platforms/winrt/qwinrtintegration.cpp | 17 +++++++++++++++++ src/plugins/platforms/winrt/qwinrtintegration.h | 1 + 3 files changed, 22 insertions(+) diff --git a/src/plugins/platforms/winrt/qwinrteglcontext.cpp b/src/plugins/platforms/winrt/qwinrteglcontext.cpp index ebd15d7184..bc77df566e 100644 --- a/src/plugins/platforms/winrt/qwinrteglcontext.cpp +++ b/src/plugins/platforms/winrt/qwinrteglcontext.cpp @@ -46,6 +46,7 @@ #define EGL_EGLEXT_PROTOTYPES #include +#include #include #include @@ -147,6 +148,9 @@ bool QWinRTEGLContext::makeCurrent(QPlatformSurface *windowSurface) Q_D(QWinRTEGLContext); Q_ASSERT(windowSurface->surface()->supportsOpenGL()); + if (windowSurface->surface()->surfaceClass() == QSurface::Offscreen) + return false; + QWinRTWindow *window = static_cast(windowSurface); if (window->eglSurface() == EGL_NO_SURFACE) window->createEglSurface(g->eglDisplay, d->eglConfig); diff --git a/src/plugins/platforms/winrt/qwinrtintegration.cpp b/src/plugins/platforms/winrt/qwinrtintegration.cpp index 93757d293c..71e92f33ca 100644 --- a/src/plugins/platforms/winrt/qwinrtintegration.cpp +++ b/src/plugins/platforms/winrt/qwinrtintegration.cpp @@ -49,6 +49,8 @@ #include #include +#include + #include #include #include @@ -180,10 +182,15 @@ QWinRTIntegration::~QWinRTIntegration() Q_ASSERT_SUCCEEDED(hr); } #endif + // Do not execute this on Windows Phone as the application is already + // shutting down and trying to unregister suspending/resume handler will + // cause exceptions and assert in debug mode +#ifndef Q_OS_WINPHONE for (QHash::const_iterator i = d->applicationTokens.begin(); i != d->applicationTokens.end(); ++i) { hr = (d->application.Get()->*i.key())(i.value()); Q_ASSERT_SUCCEEDED(hr); } +#endif destroyScreen(d->mainScreen); Windows::Foundation::Uninitialize(); } @@ -349,4 +356,14 @@ HRESULT QWinRTIntegration::onResume(IInspectable *, IInspectable *) return S_OK; } +QPlatformOffscreenSurface *QWinRTIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const +{ + // This is only used for shutdown of applications. + // In case we do not return an empty surface the scenegraph will try + // to create a new native window during application exit causing crashes + // or assertions. + return new QPlatformOffscreenSurface(surface); +} + + QT_END_NAMESPACE diff --git a/src/plugins/platforms/winrt/qwinrtintegration.h b/src/plugins/platforms/winrt/qwinrtintegration.h index 5456f6922f..31a3ce7c1c 100644 --- a/src/plugins/platforms/winrt/qwinrtintegration.h +++ b/src/plugins/platforms/winrt/qwinrtintegration.h @@ -98,6 +98,7 @@ public: QStringList themeNames() const Q_DECL_OVERRIDE; QPlatformTheme *createPlatformTheme(const QString &name) const Q_DECL_OVERRIDE; + QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE; private: #ifdef Q_OS_WINPHONE HRESULT onBackButtonPressed(IInspectable *, ABI::Windows::Phone::UI::Input::IBackPressedEventArgs *args); -- cgit v1.2.3 From 14e43c8f42585a8fa07f3fcfea5d9e1255cda0d1 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Fri, 8 Jan 2016 14:03:04 +0100 Subject: winrt: Fix API usage certification According to MSDN Tls* is inline replaced by Fls* on Windows (Phone) 8.1 and beyond. However, this does not seem to be the case for Windows 10. An application links against Tls* and the certification step fails due to using non-allowed APIs. Hence we do the inline replacement manually. QThreadStorage and QThread tests continue to work, so it seems to be an oversight by Microsoft. Task-number: QTBUG-50292 Change-Id: Ice1b6e54fcee238c94af5c6fb1753d903db7476d Reviewed-by: Oliver Wolff --- src/corelib/thread/qthread_win.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 1a4b41fee4..32e8a52a28 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -69,6 +69,30 @@ #ifndef QT_NO_THREAD QT_BEGIN_NAMESPACE +#ifdef Q_OS_WINRT +inline DWORD qWinRTTlsAlloc() { + return FlsAlloc(0); +} + +inline bool qWinRTTlsFree(DWORD dwTlsIndex) { + return FlsFree(dwTlsIndex); +} + +inline LPVOID qWinRTTlsGetValue(DWORD dwTlsIndex) { + return FlsGetValue(dwTlsIndex); +} + +inline bool qWinRTTlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue) { + return FlsSetValue(dwTlsIndex, lpTlsValue); +} + +#define TlsAlloc qWinRTTlsAlloc +#define TlsFree qWinRTTlsFree +#define TlsSetValue qWinRTTlsSetValue +#define TlsGetValue qWinRTTlsGetValue + +#endif // Q_OS_WINRT + void qt_watch_adopted_thread(const HANDLE adoptedThreadHandle, QThread *qthread); DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID); -- cgit v1.2.3 From 0355345398ab1bfc46d56ebab7afbb91afc74ee4 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Fri, 8 Jan 2016 18:08:36 +0100 Subject: winrt: Flush the system event queue when adding/removing windows This has only been identified by WACK for Windows 10. QWinRTWindow::setVisible adds a Window to the screen and immediately tries to set the native visibility. This only works when the system events are handled immediately. While this is the case most of the time, certification tests revealed that this is not always the case. We have to flush before setting the element visibility. Change-Id: Ifce4c045c185c57bc386a4e832074fb84f5d0053 Reviewed-by: Andrew Knight Reviewed-by: Oliver Wolff --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index a642443386..997aa0d86c 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -779,6 +779,7 @@ void QWinRTScreen::addWindow(QWindow *window) d->visibleWindows.prepend(window); QWindowSystemInterface::handleWindowActivated(window, Qt::OtherFocusReason); handleExpose(); + QWindowSystemInterface::flushWindowSystemEvents(); } void QWinRTScreen::removeWindow(QWindow *window) @@ -796,6 +797,7 @@ void QWinRTScreen::removeWindow(QWindow *window) if (wasTopWindow) QWindowSystemInterface::handleWindowActivated(window, Qt::OtherFocusReason); handleExpose(); + QWindowSystemInterface::flushWindowSystemEvents(); } void QWinRTScreen::raise(QWindow *window) -- cgit v1.2.3 From 9002f7f47a9cb29365d122a0984c731a09350853 Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 10 Dec 2015 13:21:01 +0100 Subject: Fix documentation for ReuseAddressHint on Unix. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code says (for Q_OS_UNIX) if ((mode & QAbstractSocket::ShareAddress) || (mode & QAbstractSocket::ReuseAddressHint)) socketEngine->setOption(QAbstractSocketEngine::AddressReusable, 1); so clearly ReuseAddressHint does the same as ShareAddress, which is: setting SO_REUSEADDR. Change-Id: Ic2ab4d139c3f58c3c63723fc609a9d4f71bac97a Reviewed-by: Friedemann Kleint Reviewed-by: Topi Reiniö Reviewed-by: Thiago Macieira --- src/network/socket/qabstractsocket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 1831d25718..1c77d14b29 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -426,8 +426,8 @@ \value ReuseAddressHint Provides a hint to QAbstractSocket that it should try to rebind the service even if the address and port are already bound by - another socket. On Windows, this is equivalent to the SO_REUSEADDR - socket option. On Unix, this option is ignored. + another socket. On Windows and Unix, this is equivalent to the SO_REUSEADDR + socket option. \value DefaultForPlatform The default option for the current platform. On Unix and OS X, this is equivalent to (DontShareAddress -- cgit v1.2.3 From e8479592c5654e9ccc2f555f32db70e4d0b09ba9 Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 24 Dec 2015 11:59:49 +0100 Subject: Doc: mention that Qt::AA_X11InitThreads isn't used anymore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Whether or not to call XInitThreads() doesn't apply since Qt-5.0's switch to XCB. Change-Id: I5f1e5e664a251c98af6357c87fc9a6bb03a46ce3 Reviewed-by: Martin Smith Reviewed-by: Topi Reiniö --- src/corelib/global/qnamespace.qdoc | 4 +--- tests/auto/opengl/qglthreads/tst_qglthreads.cpp | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index be7240b4ef..7c5263ddbd 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -144,9 +144,7 @@ to be consistent in pixels-per-point across devices rather than defining 1 point as 1/72 inch. - \value AA_X11InitThreads Calls \c XInitThreads() as part of the QApplication - construction in order to make Xlib calls thread-safe. This - attribute must be set before QApplication is constructed. + \value AA_X11InitThreads This value is obsolete and has no effect. \value AA_SynthesizeTouchForUnhandledMouseEvents All mouse events that are not accepted by the application will be translated diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp index ff5a18dedb..6a726ac62d 100644 --- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp @@ -796,7 +796,6 @@ void tst_QGLThreads::painterOnFboInThread() int main(int argc, char **argv) { - QApplication::setAttribute(Qt::AA_X11InitThreads); QApplication app(argc, argv); QTEST_DISABLE_KEYPAD_NAVIGATION \ -- cgit v1.2.3 From ca7f1d2197f78ec3332cfd86ab9921730b6d4f23 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 11 Jan 2016 11:27:19 +0100 Subject: iOS: fix crash on iOS 8 due to unsupported selector MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It turns out that f558bde was not enough to stop a crash when trying to access forceTouchCapability of traitCollection. The reason is that traitCollection is available on UIScreen starting from iOS 8, while forceTouchCapability is available on UITraitCollection starting from iOS 9. So only checking the former will cause a crash when running on iOS 8. Change-Id: I44f9fb785349694004fbf2f48fe3b85bb01d9a5a Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosintegration.mm | 2 +- src/plugins/platforms/ios/quiview.mm | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index 3e6b5e51ea..85b5c477cc 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -105,7 +105,7 @@ QIOSIntegration::QIOSIntegration() m_touchDevice = new QTouchDevice; m_touchDevice->setType(QTouchDevice::TouchScreen); QTouchDevice::Capabilities touchCapabilities = QTouchDevice::Position | QTouchDevice::NormalizedPosition; - if ([mainScreen respondsToSelector:@selector(traitCollection)]) { + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_9_0) { if (mainScreen.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable) touchCapabilities |= QTouchDevice::Pressure; } diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm index 53b3d30327..4dd43be465 100644 --- a/src/plugins/platforms/ios/quiview.mm +++ b/src/plugins/platforms/ios/quiview.mm @@ -286,10 +286,14 @@ QTouchDevice *touchDevice = QIOSIntegration::instance()->touchDevice(); QTouchDevice::Capabilities touchCapabilities = touchDevice->capabilities(); - if (self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable) - touchCapabilities |= QTouchDevice::Pressure; - else - touchCapabilities &= ~QTouchDevice::Pressure; + + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_9_0) { + if (self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable) + touchCapabilities |= QTouchDevice::Pressure; + else + touchCapabilities &= ~QTouchDevice::Pressure; + } + touchDevice->setCapabilities(touchCapabilities); } -- cgit v1.2.3