summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-10-14 11:38:53 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2015-10-14 11:38:53 +0000
commite7ab9a1fb9ad3b97b534d2e3bc6e54e8d1ac7533 (patch)
treec13c9966c73e585be7dfe13602cc5ed0d080020f /src
parent6046458dee115841c6f01b2a2e01b41be1bfbdc9 (diff)
parentb7ac036b727784624cf33f5f11b8d2d1b6f16538 (diff)
Merge "Merge remote-tracking branch 'origin/5.5' into 5.6" into refs/staging/5.6
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp15
-rw-r--r--src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp2
-rw-r--r--src/angle/patches/0008-ANGLE-Fix-Windows-Store-D3D-Trim-and-Level-9-require.patch57
-rw-r--r--src/corelib/global/qcompilerdetection.h3
-rw-r--r--src/corelib/io/qdebug.cpp56
-rw-r--r--src/corelib/io/qdebug.h16
-rw-r--r--src/corelib/io/qlockfile_unix.cpp6
-rw-r--r--src/network/socket/qabstractsocket.cpp6
-rw-r--r--src/platformsupport/cfsocketnotifier/qcfsocketnotifier.cpp129
-rw-r--r--src/platformsupport/cfsocketnotifier/qcfsocketnotifier_p.h14
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm12
-rw-r--r--src/plugins/platforms/offscreen/qoffscreencommon.cpp4
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp29
-rw-r--r--src/widgets/itemviews/qlistview.cpp6
14 files changed, 274 insertions, 81 deletions
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
index 5291a3a086..223e2b019b 100644
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -296,7 +296,20 @@ Renderer11::Renderer11(egl::Display *display)
if (requestedMajorVersion == 9 && requestedMinorVersion == 3)
#endif
{
- mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_3);
+ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 3)
+ {
+ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_3);
+ }
+#if defined(ANGLE_ENABLE_WINDOWS_STORE)
+ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 2)
+ {
+ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_2);
+ }
+ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 1)
+ {
+ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_1);
+ }
+#endif
}
EGLint requestedDeviceType = attributes.get(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE,
diff --git a/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp b/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp
index 62f3ca1207..02b663192d 100644
--- a/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp
@@ -49,6 +49,8 @@ EGLBoolean EGLAPIENTRY QuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surfa
// validate the attribute parameter
switch (attribute)
{
+ case EGL_DEVICE_EXT:
+ break;
case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
if (!display->getExtensions().surfaceD3DTexture2DShareHandle)
{
diff --git a/src/angle/patches/0008-ANGLE-Fix-Windows-Store-D3D-Trim-and-Level-9-require.patch b/src/angle/patches/0008-ANGLE-Fix-Windows-Store-D3D-Trim-and-Level-9-require.patch
new file mode 100644
index 0000000000..705219ed24
--- /dev/null
+++ b/src/angle/patches/0008-ANGLE-Fix-Windows-Store-D3D-Trim-and-Level-9-require.patch
@@ -0,0 +1,57 @@
+From 3d696560f987a08d608b29bf3e0f557e96bebc56 Mon Sep 17 00:00:00 2001
+From: Samuel Nevala <samuel.nevala@intopalo.com>
+Date: Sat, 3 Oct 2015 02:30:26 +0300
+Subject: [PATCH] ANGLE: Fix Windows Store D3D Trim and Level 9 requirements
+
+Due to additional validation not covered in previous patches, the Windows
+Store certification compatibility had regressed. These changes ensure that
+the required D3D behaviors are met.
+
+Change-Id: I0a74f0d2fecaa87d4a9409da3a7a194254609759
+---
+ .../angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp | 16 +++++++++++++++-
+ .../angle/src/libGLESv2/entry_points_egl_ext.cpp | 2 ++
+ 2 files changed, 17 insertions(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+index 5291a3a..61d9212 100644
+--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
++++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+@@ -296,7 +296,21 @@ Renderer11::Renderer11(egl::Display *display)
+ if (requestedMajorVersion == 9 && requestedMinorVersion == 3)
+ #endif
+ {
+- mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_3);
++ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 3)
++ {
++ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_3);
++ }
++#if defined(ANGLE_ENABLE_WINDOWS_STORE)
++ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 2)
++ {
++ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_2);
++ }
++ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 1)
++ {
++ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_1);
++ }
++#endif
+ }
+
+ EGLint requestedDeviceType = attributes.get(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE,
+diff --git a/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp b/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp
+index 62f3ca1..02b6631 100644
+--- a/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp
++++ b/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp
+@@ -49,6 +49,8 @@ EGLBoolean EGLAPIENTRY QuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surfa
+ // validate the attribute parameter
+ switch (attribute)
+ {
++ case EGL_DEVICE_EXT:
++ break;
+ case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
+ if (!display->getExtensions().surfaceD3DTexture2DShareHandle)
+ {
+--
+1.9.5.msysgit.1
+
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 1a999d24be..8595c51368 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -572,6 +572,9 @@
# if _MSC_VER < 1900
// ICC disables unicode string support when compatibility mode with MSVC 2013 or lower is active
# undef Q_COMPILER_UNICODE_STRINGS
+// Even though ICC knows about ref-qualified members, MSVC 2013 or lower doesn't, so
+// certain member functions (like QString::toUpper) may be missing from the DLLs.
+# undef Q_COMPILER_REF_QUALIFIERS
// Disable constexpr unless the MS headers have constexpr in all the right places too
// (like std::numeric_limits<T>::max())
# undef Q_COMPILER_CONSTEXPR
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp
index 13eccce9da..81af96b96b 100644
--- a/src/corelib/io/qdebug.cpp
+++ b/src/corelib/io/qdebug.cpp
@@ -696,6 +696,62 @@ QDebug &QDebug::resetFormat()
*/
/*!
+ \fn QDebug operator<<(QDebug stream, const QList<T> &list)
+ \relates QDebug
+
+ Writes the contents of \a list to \a stream. \c T needs to
+ support streaming into QDebug.
+*/
+
+/*!
+ \fn QDebug operator<<(QDebug stream, const QVector<T> &vector)
+ \relates QDebug
+
+ Writes the contents of \a vector to \a stream. \c T needs to
+ support streaming into QDebug.
+*/
+
+/*!
+ \fn QDebug operator<<(QDebug stream, const QSet<T> &set)
+ \relates QDebug
+
+ Writes the contents of \a set to \a stream. \c T needs to
+ support streaming into QDebug.
+*/
+
+/*!
+ \fn QDebug operator<<(QDebug stream, const QMap<Key, T> &map)
+ \relates QDebug
+
+ Writes the contents of \a map to \a stream. Both \c Key and
+ \c T need to support streaming into QDebug.
+*/
+
+/*!
+ \fn QDebug operator<<(QDebug stream, const QHash<Key, T> &hash)
+ \relates QDebug
+
+ Writes the contents of \a hash to \a stream. Both \c Key and
+ \c T need to support streaming into QDebug.
+*/
+
+/*!
+ \fn QDebug operator<<(QDebug stream, const QPair<T1, T2> &pair)
+ \relates QDebug
+
+ Writes the contents of \a pair to \a stream. Both \c T1 and
+ \c T2 need to support streaming into QDebug.
+*/
+
+/*!
+ \fn QDebug operator<<(QDebug stream, const QFlags<T> &flag)
+ \relates QDebug
+ \since 4.7
+
+ Writes \a flag to \a stream.
+*/
+
+/*!
\class QDebugStateSaver
\inmodule QtCore
\brief Convenience class for custom QDebug operators
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index 2f626dfc1f..b1a0396f35 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -216,12 +216,12 @@ inline QDebug operator<<(QDebug debug, const QVector<T> &vec)
return operator<<(debug, vec.toList());
}
-template <class aKey, class aT>
-inline QDebug operator<<(QDebug debug, const QMap<aKey, aT> &map)
+template <class Key, class T>
+inline QDebug operator<<(QDebug debug, const QMap<Key, T> &map)
{
const bool oldSetting = debug.autoInsertSpaces();
debug.nospace() << "QMap(";
- for (typename QMap<aKey, aT>::const_iterator it = map.constBegin();
+ for (typename QMap<Key, T>::const_iterator it = map.constBegin();
it != map.constEnd(); ++it) {
debug << '(' << it.key() << ", " << it.value() << ')';
}
@@ -230,12 +230,12 @@ inline QDebug operator<<(QDebug debug, const QMap<aKey, aT> &map)
return debug.maybeSpace();
}
-template <class aKey, class aT>
-inline QDebug operator<<(QDebug debug, const QHash<aKey, aT> &hash)
+template <class Key, class T>
+inline QDebug operator<<(QDebug debug, const QHash<Key, T> &hash)
{
const bool oldSetting = debug.autoInsertSpaces();
debug.nospace() << "QHash(";
- for (typename QHash<aKey, aT>::const_iterator it = hash.constBegin();
+ for (typename QHash<Key, T>::const_iterator it = hash.constBegin();
it != hash.constEnd(); ++it)
debug << '(' << it.key() << ", " << it.value() << ')';
debug << ')';
@@ -276,7 +276,7 @@ inline QDebug operator<<(QDebug debug, const QContiguousCache<T> &cache)
return debug.maybeSpace();
}
-#ifndef QT_NO_QOBJECT
+#if !defined(QT_NO_QOBJECT) && !defined(Q_QDOC)
Q_CORE_EXPORT QDebug qt_QMetaEnum_debugOperator(QDebug&, int value, const QMetaObject *meta, const char *name);
Q_CORE_EXPORT QDebug qt_QMetaEnum_flagDebugOperator(QDebug &dbg, quint64 value, const QMetaObject *meta, const char *name);
@@ -305,7 +305,7 @@ inline typename QtPrivate::QEnableIf<
!QtPrivate::IsQEnumHelper<T>::Value && !QtPrivate::IsQEnumHelper<QFlags<T> >::Value,
QDebug>::Type
qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags<T> &flags)
-#else // !QT_NO_QOBJECT
+#else // !QT_NO_QOBJECT && !Q_QDOC
template <class T>
inline QDebug qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags<T> &flags)
#endif
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp
index 019059917a..365f3e07ab 100644
--- a/src/corelib/io/qlockfile_unix.cpp
+++ b/src/corelib/io/qlockfile_unix.cpp
@@ -171,8 +171,10 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
}
}
// Ensure nobody else can delete the file while we have it
- if (!setNativeLocks(fd))
- qWarning() << "setNativeLocks failed:" << strerror(errno);
+ if (!setNativeLocks(fd)) {
+ const int errnoSaved = errno;
+ qWarning() << "setNativeLocks failed:" << qt_error_string(errnoSaved);
+ }
if (qt_write_loop(fd, fileData.constData(), fileData.size()) < fileData.size()) {
close(fd);
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index e344a9d17e..8d9975dcdb 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -2464,12 +2464,14 @@ qint64 QAbstractSocket::readLineData(char *data, qint64 maxlen)
qint64 QAbstractSocket::writeData(const char *data, qint64 size)
{
Q_D(QAbstractSocket);
- if (d->state == QAbstractSocket::UnconnectedState) {
+ if (d->state == QAbstractSocket::UnconnectedState
+ || (!d->socketEngine && d->socketType != TcpSocket && !d->isBuffered)) {
d->setError(UnknownSocketError, tr("Socket is not connected"));
return -1;
}
- if (!d->isBuffered && d->socketType == TcpSocket && d->writeBuffer.isEmpty()) {
+ if (!d->isBuffered && d->socketType == TcpSocket
+ && d->socketEngine && d->writeBuffer.isEmpty()) {
// This code is for the new Unbuffered QTcpSocket use case
qint64 written = d->socketEngine->write(data, size);
if (written < 0) {
diff --git a/src/platformsupport/cfsocketnotifier/qcfsocketnotifier.cpp b/src/platformsupport/cfsocketnotifier/qcfsocketnotifier.cpp
index 2b5723d827..c58e0ea78d 100644
--- a/src/platformsupport/cfsocketnotifier/qcfsocketnotifier.cpp
+++ b/src/platformsupport/cfsocketnotifier/qcfsocketnotifier.cpp
@@ -55,11 +55,15 @@ void qt_mac_socket_callback(CFSocketRef s, CFSocketCallBackType callbackType, CF
// notifier is now gone. The upshot is we have to check the notifier
// every time.
if (callbackType == kCFSocketReadCallBack) {
- if (socketInfo->readNotifier)
+ if (socketInfo->readNotifier && socketInfo->readEnabled) {
+ socketInfo->readEnabled = false;
QGuiApplication::sendEvent(socketInfo->readNotifier, &notifierEvent);
+ }
} else if (callbackType == kCFSocketWriteCallBack) {
- if (socketInfo->writeNotifier)
+ if (socketInfo->writeNotifier && socketInfo->writeEnabled) {
+ socketInfo->writeEnabled = false;
QGuiApplication::sendEvent(socketInfo->writeNotifier, &notifierEvent);
+ }
}
if (cfSocketNotifier->maybeCancelWaitForMoreEvents)
@@ -88,12 +92,12 @@ void qt_mac_remove_socket_from_runloop(const CFSocketRef socket, CFRunLoopSource
CFRunLoopRemoveSource(CFRunLoopGetMain(), runloop, kCFRunLoopCommonModes);
CFSocketDisableCallBacks(socket, kCFSocketReadCallBack);
CFSocketDisableCallBacks(socket, kCFSocketWriteCallBack);
- CFRunLoopSourceInvalidate(runloop);
}
QCFSocketNotifier::QCFSocketNotifier()
-:eventDispatcher(0)
-, maybeCancelWaitForMoreEvents(0)
+ : eventDispatcher(0)
+ , maybeCancelWaitForMoreEvents(0)
+ , enableNotifiersObserver(0)
{
}
@@ -150,36 +154,34 @@ void QCFSocketNotifier::registerSocketNotifier(QSocketNotifier *notifier)
}
CFOptionFlags flags = CFSocketGetSocketFlags(socketInfo->socket);
- flags |= kCFSocketAutomaticallyReenableWriteCallBack; //QSocketNotifier stays enabled after a write
- flags &= ~kCFSocketCloseOnInvalidate; //QSocketNotifier doesn't close the socket upon destruction/invalidation
+ // QSocketNotifier doesn't close the socket upon destruction/invalidation
+ flags &= ~kCFSocketCloseOnInvalidate;
+ // Expicitly disable automatic re-enable, as we do that manually on each runloop pass
+ flags &= ~(kCFSocketAutomaticallyReenableWriteCallBack | kCFSocketAutomaticallyReenableReadCallBack);
CFSocketSetSocketFlags(socketInfo->socket, flags);
- // Add CFSocket to runloop.
- if (!(socketInfo->runloop = qt_mac_add_socket_to_runloop(socketInfo->socket))) {
- qWarning("QEventDispatcherMac::registerSocketNotifier: Failed to add CFSocket to runloop");
- CFSocketInvalidate(socketInfo->socket);
- CFRelease(socketInfo->socket);
- return;
- }
-
- // Disable both callback types by default. This must be done after
- // we add the CFSocket to the runloop, or else these calls will have
- // no effect.
- CFSocketDisableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
- CFSocketDisableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
-
macSockets.insert(nativeSocket, socketInfo);
}
- // Increment read/write counters and select enable callbacks if necessary.
if (type == QSocketNotifier::Read) {
Q_ASSERT(socketInfo->readNotifier == 0);
socketInfo->readNotifier = notifier;
- CFSocketEnableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
+ socketInfo->readEnabled = false;
} else if (type == QSocketNotifier::Write) {
Q_ASSERT(socketInfo->writeNotifier == 0);
socketInfo->writeNotifier = notifier;
- CFSocketEnableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
+ socketInfo->writeEnabled = false;
+ }
+
+ if (!enableNotifiersObserver) {
+ // Create a run loop observer which enables the socket notifiers on each
+ // pass of the run loop, before any sources are processed.
+ CFRunLoopObserverContext context = {};
+ context.info = this;
+ enableNotifiersObserver = CFRunLoopObserverCreate(kCFAllocatorDefault, kCFRunLoopBeforeSources,
+ true, 0, enableSocketNotifiers, &context);
+ Q_ASSERT(enableNotifiersObserver);
+ CFRunLoopAddObserver(CFRunLoopGetMain(), enableNotifiersObserver, kCFRunLoopCommonModes);
}
}
@@ -212,21 +214,18 @@ void QCFSocketNotifier::unregisterSocketNotifier(QSocketNotifier *notifier)
if (type == QSocketNotifier::Read) {
Q_ASSERT(notifier == socketInfo->readNotifier);
socketInfo->readNotifier = 0;
+ socketInfo->readEnabled = false;
CFSocketDisableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
} else if (type == QSocketNotifier::Write) {
Q_ASSERT(notifier == socketInfo->writeNotifier);
socketInfo->writeNotifier = 0;
+ socketInfo->writeEnabled = false;
CFSocketDisableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
}
// Remove CFSocket from runloop if this was the last QSocketNotifier.
if (socketInfo->readNotifier == 0 && socketInfo->writeNotifier == 0) {
- if (CFSocketIsValid(socketInfo->socket))
- qt_mac_remove_socket_from_runloop(socketInfo->socket, socketInfo->runloop);
- CFRunLoopSourceInvalidate(socketInfo->runloop);
- CFRelease(socketInfo->runloop);
- CFSocketInvalidate(socketInfo->socket);
- CFRelease(socketInfo->socket);
+ unregisterSocketInfo(socketInfo);
delete socketInfo;
macSockets.remove(nativeSocket);
}
@@ -235,14 +234,70 @@ void QCFSocketNotifier::unregisterSocketNotifier(QSocketNotifier *notifier)
void QCFSocketNotifier::removeSocketNotifiers()
{
// Remove CFSockets from the runloop.
- for (MacSocketHash::ConstIterator it = macSockets.constBegin(); it != macSockets.constEnd(); ++it) {
- MacSocketInfo *socketInfo = (*it);
- if (CFSocketIsValid(socketInfo->socket)) {
+ foreach (MacSocketInfo *socketInfo, macSockets) {
+ unregisterSocketInfo(socketInfo);
+ delete socketInfo;
+ }
+
+ macSockets.clear();
+
+ destroyRunLoopObserver();
+}
+
+void QCFSocketNotifier::destroyRunLoopObserver()
+{
+ if (!enableNotifiersObserver)
+ return;
+
+ CFRunLoopObserverInvalidate(enableNotifiersObserver);
+ CFRelease(enableNotifiersObserver);
+ enableNotifiersObserver = 0;
+}
+
+void QCFSocketNotifier::unregisterSocketInfo(MacSocketInfo *socketInfo)
+{
+ if (socketInfo->runloop) {
+ if (CFSocketIsValid(socketInfo->socket))
qt_mac_remove_socket_from_runloop(socketInfo->socket, socketInfo->runloop);
- CFRunLoopSourceInvalidate(socketInfo->runloop);
- CFRelease(socketInfo->runloop);
- CFSocketInvalidate(socketInfo->socket);
- CFRelease(socketInfo->socket);
+ CFRunLoopSourceInvalidate(socketInfo->runloop);
+ CFRelease(socketInfo->runloop);
+ }
+ CFSocketInvalidate(socketInfo->socket);
+ CFRelease(socketInfo->socket);
+}
+
+void QCFSocketNotifier::enableSocketNotifiers(CFRunLoopObserverRef ref, CFRunLoopActivity activity, void *info)
+{
+ Q_UNUSED(ref);
+ Q_UNUSED(activity);
+
+ QCFSocketNotifier *that = static_cast<QCFSocketNotifier *>(info);
+
+ foreach (MacSocketInfo *socketInfo, that->macSockets) {
+ if (!CFSocketIsValid(socketInfo->socket))
+ continue;
+
+ if (!socketInfo->runloop) {
+ // Add CFSocket to runloop.
+ if (!(socketInfo->runloop = qt_mac_add_socket_to_runloop(socketInfo->socket))) {
+ qWarning("QEventDispatcherMac::registerSocketNotifier: Failed to add CFSocket to runloop");
+ CFSocketInvalidate(socketInfo->socket);
+ continue;
+ }
+
+ if (!socketInfo->readNotifier)
+ CFSocketDisableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
+ if (!socketInfo->writeNotifier)
+ CFSocketDisableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
+ }
+
+ if (socketInfo->readNotifier && !socketInfo->readEnabled) {
+ socketInfo->readEnabled = true;
+ CFSocketEnableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
+ }
+ if (socketInfo->writeNotifier && !socketInfo->writeEnabled) {
+ socketInfo->writeEnabled = true;
+ CFSocketEnableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
}
}
}
diff --git a/src/platformsupport/cfsocketnotifier/qcfsocketnotifier_p.h b/src/platformsupport/cfsocketnotifier/qcfsocketnotifier_p.h
index af8122f753..9bccc1bf98 100644
--- a/src/platformsupport/cfsocketnotifier/qcfsocketnotifier_p.h
+++ b/src/platformsupport/cfsocketnotifier/qcfsocketnotifier_p.h
@@ -53,11 +53,14 @@
QT_BEGIN_NAMESPACE
struct MacSocketInfo {
- MacSocketInfo() : socket(0), runloop(0), readNotifier(0), writeNotifier(0) {}
+ MacSocketInfo() : socket(0), runloop(0), readNotifier(0), writeNotifier(0),
+ readEnabled(false), writeEnabled(false) {}
CFSocketRef socket;
CFRunLoopSourceRef runloop;
QObject *readNotifier;
QObject *writeNotifier;
+ bool readEnabled;
+ bool writeEnabled;
};
typedef QHash<int, MacSocketInfo *> MacSocketHash;
@@ -83,9 +86,18 @@ public:
void unregisterSocketNotifier(QSocketNotifier *notifier);
void removeSocketNotifiers();
+private:
+ void destroyRunLoopObserver();
+
+ static void unregisterSocketInfo(MacSocketInfo *socketInfo);
+ static void enableSocketNotifiers(CFRunLoopObserverRef ref, CFRunLoopActivity activity, void *info);
+
MacSocketHash macSockets;
QAbstractEventDispatcher *eventDispatcher;
MaybeCancelWaitForMoreEventsFn maybeCancelWaitForMoreEvents;
+ CFRunLoopObserverRef enableNotifiersObserver;
+
+ friend void qt_mac_socket_callback(CFSocketRef, CFSocketCallBackType, CFDataRef, const void *, void *);
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 229f515995..6bec6b191d 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -87,17 +87,9 @@ void QCocoaScreen::updateGeometry()
NSRect frameRect = [nsScreen frame];
- // Since Mavericks, there is a setting, System Preferences->Mission Control->
- // Displays have separate Spaces.
- BOOL spansDisplays = NO;
-#if QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_9)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_9)
- spansDisplays = [NSScreen screensHaveSeparateSpaces];
-#endif
- if (spansDisplays || m_screenIndex == 0) {
+ if (m_screenIndex == 0) {
m_geometry = QRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width, frameRect.size.height);
- // Displays have separate Spaces setting is on or this is the primary screen,
- // the one that contains the menubar. Its origin should be
+ // This is the primary screen, the one that contains the menubar. Its origin should be
// (0, 0), and it's the only one whose available geometry differs from its full geometry.
NSRect visibleRect = [nsScreen visibleFrame];
m_availableGeometry = QRect(visibleRect.origin.x,
diff --git a/src/plugins/platforms/offscreen/qoffscreencommon.cpp b/src/plugins/platforms/offscreen/qoffscreencommon.cpp
index 11977fc6ed..31d7397f6f 100644
--- a/src/plugins/platforms/offscreen/qoffscreencommon.cpp
+++ b/src/plugins/platforms/offscreen/qoffscreencommon.cpp
@@ -75,13 +75,13 @@ public:
QOffscreenScreen::windowContainingCursor = containing ? containing->handle() : 0;
}
-
+#ifndef QT_NO_CURSOR
void changeCursor(QCursor *windowCursor, QWindow *window) Q_DECL_OVERRIDE
{
Q_UNUSED(windowCursor);
Q_UNUSED(window);
}
-
+#endif
private:
QPoint m_pos;
};
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index ea8a918dcf..96bdcc42fa 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -1325,20 +1325,21 @@ bool QMYSQLDriver::open(const QString& db,
if (writeTimeout != 0)
mysql_options(d->mysql, MYSQL_OPT_WRITE_TIMEOUT, &writeTimeout);
#endif
- if (mysql_real_connect(d->mysql,
- host.isNull() ? static_cast<const char *>(0)
- : host.toLocal8Bit().constData(),
- user.isNull() ? static_cast<const char *>(0)
- : user.toLocal8Bit().constData(),
- password.isNull() ? static_cast<const char *>(0)
- : password.toLocal8Bit().constData(),
- db.isNull() ? static_cast<const char *>(0)
- : db.toLocal8Bit().constData(),
- (port > -1) ? port : 0,
- unixSocket.isNull() ? static_cast<const char *>(0)
- : unixSocket.toLocal8Bit().constData(),
- optionFlags))
- {
+ MYSQL *mysql = mysql_real_connect(d->mysql,
+ host.isNull() ? static_cast<const char *>(0)
+ : host.toLocal8Bit().constData(),
+ user.isNull() ? static_cast<const char *>(0)
+ : user.toLocal8Bit().constData(),
+ password.isNull() ? static_cast<const char *>(0)
+ : password.toLocal8Bit().constData(),
+ db.isNull() ? static_cast<const char *>(0)
+ : db.toLocal8Bit().constData(),
+ (port > -1) ? port : 0,
+ unixSocket.isNull() ? static_cast<const char *>(0)
+ : unixSocket.toLocal8Bit().constData(),
+ optionFlags);
+
+ if (mysql == d->mysql) {
if (!db.isEmpty() && mysql_select_db(d->mysql, db.toLocal8Bit().constData())) {
setLastError(qMakeError(tr("Unable to open database '%1'").arg(db), QSqlError::ConnectionError, d));
mysql_close(d->mysql);
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 9b07564db9..9c79509874 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -1877,8 +1877,7 @@ void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step)
const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded &&
qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded;
- const QSize viewportSize(viewport()->width() + (qq->verticalScrollBar()->maximum() > 0 ? qq->verticalScrollBar()->width() : 0),
- viewport()->height() + (qq->horizontalScrollBar()->maximum() > 0 ? qq->horizontalScrollBar()->height() : 0));
+ const QSize viewportSize = qq->contentsRect().size();
bool verticalWantsToShow = contentsSize.height() > viewportSize.height();
bool horizontalWantsToShow;
@@ -1908,8 +1907,7 @@ void QCommonListViewBase::updateVerticalScrollBar(const QSize &step)
const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded &&
qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded;
- const QSize viewportSize(viewport()->width() + (qq->verticalScrollBar()->maximum() > 0 ? qq->verticalScrollBar()->width() : 0),
- viewport()->height() + (qq->horizontalScrollBar()->maximum() > 0 ? qq->horizontalScrollBar()->height() : 0));
+ const QSize viewportSize = qq->contentsRect().size();
bool horizontalWantsToShow = contentsSize.width() > viewportSize.width();
bool verticalWantsToShow;