diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-01-13 07:19:44 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2016-01-13 07:19:44 +0000 |
commit | 9a969182cfa452fdb305bc9fe0becc6b358f91c1 (patch) | |
tree | 9850ac418b869e42e17d82cc14d2fe0aa93a3192 /src | |
parent | f7020a31c02f4d1e5a46ce2ea20e38751f9afeed (diff) | |
parent | 6b8c0a50585bb637c5cd33ca8ffde0cb9c4e3664 (diff) |
Merge "Merge remote-tracking branch 'origin/5.6' into dev" into refs/staging/dev
Diffstat (limited to 'src')
36 files changed, 160 insertions, 155 deletions
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 } diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index 0c33335ae9..9235641544 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() diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 60d6d4b929..1efcce393d 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -152,9 +152,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/src/corelib/io/qurlquery.h b/src/corelib/io/qurlquery.h index 16e186a79b..5386d97e09 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<QPair<QByteArray, QByteArray> > &qry) { diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 1e755cf5d8..1d7128721f 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -3437,7 +3437,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/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); diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 366ad5b02f..c4aa699992 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -585,7 +585,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/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/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) { diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 84bd90d06d..c4e506ff0e 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1818,8 +1818,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; } @@ -2018,8 +2018,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 078442f3f1..32b7787514 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 @@ -648,32 +633,6 @@ QString QDBusMessage::signature() const } /*! - 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 call messages}: any other kind of message cannot have replies and @@ -861,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()); 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/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/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 651149c4c6..b8ab98e290 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/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 913640e3e7..7b42f3eb14 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 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/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index a5c963a2d5..21248ddb86 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -107,7 +107,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); } 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, diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 217444d129..c954e0a96d 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 f43265be67..b2781c8212 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -224,7 +224,8 @@ QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList ¶mL if (!QCoreApplication::testAttribute(Qt::AA_PluginApplication)) { m_context.setProcessDpiAwareness(dpiAwareness); qCDebug(lcQpaWindows) - << __FUNCTION__ << "DpiAwareness=" << dpiAwareness; + << __FUNCTION__ << "DpiAwareness=" << dpiAwareness + << "effective process DPI awareness=" << QWindowsContext::processDpiAwareness(); } dpiAwarenessSet = true; } diff --git a/src/plugins/platforms/winrt/qwinrteglcontext.cpp b/src/plugins/platforms/winrt/qwinrteglcontext.cpp index 1008e1c5e8..8ca669141e 100644 --- a/src/plugins/platforms/winrt/qwinrteglcontext.cpp +++ b/src/plugins/platforms/winrt/qwinrteglcontext.cpp @@ -46,6 +46,7 @@ #define EGL_EGLEXT_PROTOTYPES #include <EGL/eglext.h> +#include <QOffscreenSurface> #include <QOpenGLContext> #include <QtPlatformSupport/private/qeglconvenience_p.h> @@ -54,9 +55,6 @@ QT_BEGIN_NAMESPACE struct WinRTEGLDisplay { WinRTEGLDisplay() { - eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); - if (Q_UNLIKELY(eglDisplay == EGL_NO_DISPLAY)) - qCritical("Failed to initialize EGL display: 0x%x", eglGetError()); } ~WinRTEGLDisplay() { eglTerminate(eglDisplay); @@ -117,9 +115,17 @@ void QWinRTEGLContext::initialize() if (Q_UNLIKELY(g->eglDisplay == EGL_NO_DISPLAY)) qCritical("Failed to initialize EGL display: 0x%x", eglGetError()); - if (Q_UNLIKELY(!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) @@ -142,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<QWinRTWindow *>(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 e94a0aa846..71e92f33ca 100644 --- a/src/plugins/platforms/winrt/qwinrtintegration.cpp +++ b/src/plugins/platforms/winrt/qwinrtintegration.cpp @@ -49,6 +49,8 @@ #include <QtGui/QOpenGLContext> #include <qfunctions_winrt.h> +#include <qpa/qplatformoffscreensurface.h> + #include <functional> #include <wrl.h> #include <windows.ui.xaml.h> @@ -124,7 +126,7 @@ QWinRTIntegration::QWinRTIntegration() : d_ptr(new QWinRTIntegrationPrivate) IID_PPV_ARGS(&d->application)); Q_ASSERT_SUCCEEDED(hr); hr = d->application->add_Suspending(Callback<SuspendHandler>(this, &QWinRTIntegration::onSuspended).Get(), - &d->applicationTokens[&ICoreApplication::remove_Resuming]); + &d->applicationTokens[&ICoreApplication::remove_Suspending]); Q_ASSERT_SUCCEEDED(hr); hr = d->application->add_Resuming(Callback<ResumeHandler>(this, &QWinRTIntegration::onResume).Get(), &d->applicationTokens[&ICoreApplication::remove_Resuming]); @@ -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<CoreApplicationCallbackRemover, EventRegistrationToken>::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); 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) 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 <qscreen.h> #include <QtGui/private/qhighdpiscaling_p.h> #include <qpa/qplatformgraphicsbuffer.h> +#include <private/qimage_p.h> #include <algorithm> 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); } 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 587be22915..8d3aef8e07 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(); diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp index b4cb3bae18..e85c6504a7 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 55ceeca919..3eeb6683b1 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 e262f2db22..cad5e6f9e4 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<QAbstractButton *> acceptRoleList = buttonLists[QPlatformDialogHelper::AcceptRole]; + const QList<QAbstractButton *> &acceptRoleList = buttonLists[QPlatformDialogHelper::AcceptRole]; while (*currentLayout != QPlatformDialogHelper::EOL) { int role = (*currentLayout & ~QPlatformDialogHelper::Reverse); |