From b7c4f15d6702941b110f7c2ffea490cf1b68c953 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Fri, 23 Oct 2015 21:13:18 +0300 Subject: Undef HAVE_WAITID if needed constants are not defined MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That is the case on Hurd, where the code currently breaks because Hurd does not have WEXITED or WNOWAIT defined. Change-Id: I4b13633612b1168d36c949d9e8b35bc05bca7d5c Reviewed-by: Lisandro Damián Nicanor Pérez Meyer Reviewed-by: Thiago Macieira --- src/3rdparty/forkfd/forkfd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/3rdparty/forkfd/forkfd.c b/src/3rdparty/forkfd/forkfd.c index ec24ba7b16..e35b66ae2c 100644 --- a/src/3rdparty/forkfd/forkfd.c +++ b/src/3rdparty/forkfd/forkfd.c @@ -58,6 +58,9 @@ #if _POSIX_VERSION-0 >= 200809L || _XOPEN_VERSION-0 >= 500 # define HAVE_WAITID 1 #endif +#if !defined(WEXITED) || !defined(WNOWAIT) +# undef HAVE_WAITID +#endif #if defined(__FreeBSD__) # define HAVE_PIPE2 1 -- cgit v1.2.3 From c20f92a0fa11c2cc7bad8f69a1e0a8f8b5893df3 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 8 Oct 2015 18:07:00 +0200 Subject: fix growth of event queue in QWinOverlappedIoNotifier::waitFor* Do not emit _q_notified when we're in a wait function. Otherwise, the queued signals could pile up in the event queue. Task-number: QTBUG-48653 Change-Id: I071863e2356e17c7004e3b7ca359967cb115e343 Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qwinoverlappedionotifier.cpp | 62 ++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/src/corelib/io/qwinoverlappedionotifier.cpp b/src/corelib/io/qwinoverlappedionotifier.cpp index 083feb4a20..c6ce15c2c9 100644 --- a/src/corelib/io/qwinoverlappedionotifier.cpp +++ b/src/corelib/io/qwinoverlappedionotifier.cpp @@ -33,6 +33,7 @@ #include "qwinoverlappedionotifier_p.h" #include +#include #include #include #include @@ -99,6 +100,7 @@ public: { } + OVERLAPPED *waitForAnyNotified(int msecs); void notify(DWORD numberOfBytes, DWORD errorCode, OVERLAPPED *overlapped); OVERLAPPED *_q_notified(); @@ -108,6 +110,7 @@ public: HANDLE hHandle; HANDLE hSemaphore; HANDLE hResultsMutex; + QAtomicInt waiting; QQueue results; }; @@ -286,28 +289,21 @@ void QWinOverlappedIoNotifier::setEnabled(bool enabled) d->iocp->unregisterNotifier(d); } -/*! - * Wait synchronously for any notified signal. - * - * The function returns a pointer to the OVERLAPPED object corresponding to the completed I/O - * operation. In case no I/O operation was completed during the \a msec timeout, this function - * returns a null pointer. - */ -OVERLAPPED *QWinOverlappedIoNotifier::waitForAnyNotified(int msecs) +OVERLAPPED *QWinOverlappedIoNotifierPrivate::waitForAnyNotified(int msecs) { - Q_D(QWinOverlappedIoNotifier); - if (!d->iocp->isRunning()) { + if (!iocp->isRunning()) { qWarning("Called QWinOverlappedIoNotifier::waitForAnyNotified on inactive notifier."); return 0; } if (msecs == 0) - d->iocp->drainQueue(); + iocp->drainQueue(); - switch (WaitForSingleObject(d->hSemaphore, msecs == -1 ? INFINITE : DWORD(msecs))) { + const DWORD wfso = WaitForSingleObject(hSemaphore, msecs == -1 ? INFINITE : DWORD(msecs)); + switch (wfso) { case WAIT_OBJECT_0: - ReleaseSemaphore(d->hSemaphore, 1, NULL); - return d->_q_notified(); + ReleaseSemaphore(hSemaphore, 1, NULL); + return _q_notified(); case WAIT_TIMEOUT: return 0; default: @@ -316,6 +312,39 @@ OVERLAPPED *QWinOverlappedIoNotifier::waitForAnyNotified(int msecs) } } +class QScopedAtomicIntIncrementor +{ +public: + QScopedAtomicIntIncrementor(QAtomicInt &i) + : m_int(i) + { + ++m_int; + } + + ~QScopedAtomicIntIncrementor() + { + --m_int; + } + +private: + QAtomicInt &m_int; +}; + +/*! + * Wait synchronously for any notified signal. + * + * The function returns a pointer to the OVERLAPPED object corresponding to the completed I/O + * operation. In case no I/O operation was completed during the \a msec timeout, this function + * returns a null pointer. + */ +OVERLAPPED *QWinOverlappedIoNotifier::waitForAnyNotified(int msecs) +{ + Q_D(QWinOverlappedIoNotifier); + QScopedAtomicIntIncrementor saii(d->waiting); + OVERLAPPED *result = d->waitForAnyNotified(msecs); + return result; +} + /*! * Wait synchronously for the notified signal. * @@ -324,6 +353,8 @@ OVERLAPPED *QWinOverlappedIoNotifier::waitForAnyNotified(int msecs) */ bool QWinOverlappedIoNotifier::waitForNotified(int msecs, OVERLAPPED *overlapped) { + Q_D(QWinOverlappedIoNotifier); + QScopedAtomicIntIncrementor saii(d->waiting); int t = msecs; QElapsedTimer stopWatch; stopWatch.start(); @@ -350,7 +381,8 @@ void QWinOverlappedIoNotifierPrivate::notify(DWORD numberOfBytes, DWORD errorCod results.enqueue(IOResult(numberOfBytes, errorCode, overlapped)); ReleaseMutex(hResultsMutex); ReleaseSemaphore(hSemaphore, 1, NULL); - emit q->_q_notify(); + if (!waiting) + emit q->_q_notify(); } OVERLAPPED *QWinOverlappedIoNotifierPrivate::_q_notified() -- cgit v1.2.3 From 2f7d3cf559e0bdf8643e213de3a36796f6a88bd3 Mon Sep 17 00:00:00 2001 From: Martin Koller Date: Tue, 4 Aug 2015 21:29:18 +0200 Subject: Android: auto-detect MIME type for local files to make openUrl work [ChangeLog][QtCore][Android] Fixed the opening of a local file using QDesktopServices::openUrl(). For a local file to be viewed with QDesktopServices::openUrl(), Android needs to be given the MIME type otherwise it does not start an Intent to view the file. Task-number: QTBUG-45585 Change-Id: Ifcfce4bff35011f205cfadbdb2b37a1780dac87d Reviewed-by: BogDan Vatra --- .../src/org/qtproject/qt5/android/QtNative.java | 4 +++- .../platforms/android/qandroidplatformservices.cpp | 23 ++++++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java index 040eba5e42..11b6ad8cdc 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java @@ -100,13 +100,15 @@ public class QtNative } } - public static boolean openURL(String url) + public static boolean openURL(String url, String mime) { boolean ok = true; try { Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); + if (!mime.isEmpty()) + intent.setDataAndType(uri, mime); activity().startActivity(intent); } catch (Exception e) { e.printStackTrace(); diff --git a/src/plugins/platforms/android/qandroidplatformservices.cpp b/src/plugins/platforms/android/qandroidplatformservices.cpp index 2dba6c78e1..412e3e0466 100644 --- a/src/plugins/platforms/android/qandroidplatformservices.cpp +++ b/src/plugins/platforms/android/qandroidplatformservices.cpp @@ -33,8 +33,9 @@ #include "qandroidplatformservices.h" #include -#include +#include #include +#include #include QT_BEGIN_NAMESPACE @@ -43,13 +44,27 @@ QAndroidPlatformServices::QAndroidPlatformServices() { } -bool QAndroidPlatformServices::openUrl(const QUrl &url) +bool QAndroidPlatformServices::openUrl(const QUrl &theUrl) { + QString mime; + QUrl url(theUrl); + + // if the file is local, we need to pass the MIME type, otherwise Android + // does not start an Intent to view this file + if ((url.scheme().isEmpty() && QFile::exists(url.path())) || url.isLocalFile()) { + // a real URL including the scheme is needed, else the Intent can not be started + url.setScheme(QLatin1String("file")); + + QMimeDatabase mimeDb; + mime = mimeDb.mimeTypeForUrl(url).name(); + } + QJNIObjectPrivate urlString = QJNIObjectPrivate::fromString(url.toString()); + QJNIObjectPrivate mimeString = QJNIObjectPrivate::fromString(mime); return QJNIObjectPrivate::callStaticMethod(QtAndroid::applicationClass(), "openURL", - "(Ljava/lang/String;)Z", - urlString.object()); + "(Ljava/lang/String;Ljava/lang/String;)Z", + urlString.object(), mimeString.object()); } bool QAndroidPlatformServices::openDocument(const QUrl &url) -- cgit v1.2.3 From 691671893aedcd54792b57afa9ed2724ccdc6657 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 26 Oct 2015 13:47:03 +0100 Subject: fix race in ANGLE build The flex and bison rules generated the same files for debug and release. This conflicts in parallel builds, e.g. when using jom. Task-number: QTBUG-49003 Change-Id: I6f64760d83292e8bfad6fd0b4f8fbdd386e2213b Reviewed-by: Oswald Buddenhagen --- src/angle/src/compiler/preprocessor/preprocessor.pro | 8 ++++---- src/angle/src/compiler/translator.pro | 16 ++++++++-------- src/angle/src/config.pri | 2 ++ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/angle/src/compiler/preprocessor/preprocessor.pro b/src/angle/src/compiler/preprocessor/preprocessor.pro index 759a3399b4..12f644870d 100644 --- a/src/angle/src/compiler/preprocessor/preprocessor.pro +++ b/src/angle/src/compiler/preprocessor/preprocessor.pro @@ -41,15 +41,15 @@ SOURCES += \ $$ANGLE_DIR/src/compiler/preprocessor/Token.cpp # NOTE: 'flex' and 'bison' can be found in qt5/gnuwin32/bin -flex.commands = $$addGnuPath(flex) --noline --nounistd --outfile=${QMAKE_FILE_BASE}.cpp ${QMAKE_FILE_NAME} -flex.output = ${QMAKE_FILE_BASE}.cpp +flex.commands = $$addGnuPath(flex) --noline --nounistd --outfile=${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME} +flex.output = $${BUILDSUBDIR}${QMAKE_FILE_BASE}.cpp flex.input = FLEX_SOURCES flex.dependency_type = TYPE_C flex.variable_out = GENERATED_SOURCES QMAKE_EXTRA_COMPILERS += flex -bison.commands = $$addGnuPath(bison) --no-lines --skeleton=yacc.c --output=${QMAKE_FILE_BASE}.cpp ${QMAKE_FILE_NAME} -bison.output = ${QMAKE_FILE_BASE}.cpp +bison.commands = $$addGnuPath(bison) --no-lines --skeleton=yacc.c --output=${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME} +bison.output = $${BUILDSUBDIR}${QMAKE_FILE_BASE}.cpp bison.input = BISON_SOURCES bison.dependency_type = TYPE_C bison.variable_out = GENERATED_SOURCES diff --git a/src/angle/src/compiler/translator.pro b/src/angle/src/compiler/translator.pro index 9572a51ad4..eebe41b09e 100644 --- a/src/angle/src/compiler/translator.pro +++ b/src/angle/src/compiler/translator.pro @@ -163,16 +163,16 @@ SOURCES += \ # NOTE: 'flex' and 'bison' can be found in qt5/gnuwin32/bin -flex.commands = $$addGnuPath(flex) --noline --nounistd --outfile=${QMAKE_FILE_BASE}_lex.cpp ${QMAKE_FILE_NAME} -flex.output = ${QMAKE_FILE_BASE}_lex.cpp +flex.commands = $$addGnuPath(flex) --noline --nounistd --outfile=${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME} +flex.output = $${BUILDSUBDIR}${QMAKE_FILE_BASE}_lex.cpp flex.input = FLEX_SOURCES flex.dependency_type = TYPE_C flex.variable_out = GENERATED_SOURCES QMAKE_EXTRA_COMPILERS += flex -bison.commands = $$addGnuPath(bison) --no-lines --skeleton=yacc.c --defines=${QMAKE_FILE_BASE}_tab.h \ - --output=${QMAKE_FILE_BASE}_tab.cpp ${QMAKE_FILE_NAME} -bison.output = ${QMAKE_FILE_BASE}_tab.h +bison.commands = $$addGnuPath(bison) --no-lines --skeleton=yacc.c --defines=${QMAKE_FILE_OUT} \ + --output=${QMAKE_FILE_OUT_BASE}.cpp ${QMAKE_FILE_NAME} +bison.output = $${BUILDSUBDIR}${QMAKE_FILE_BASE}_tab.h bison.input = BISON_SOURCES bison.dependency_type = TYPE_C bison.variable_out = GENERATED_SOURCES @@ -182,10 +182,10 @@ QMAKE_EXTRA_COMPILERS += bison # have one output file even if the command generates two. MAKEFILE_NOOP_COMMAND = @echo -n msvc: MAKEFILE_NOOP_COMMAND = @echo >NUL -bison_impl.output = ${QMAKE_FILE_BASE}_tab.cpp +bison_impl.output = $${BUILDSUBDIR}${QMAKE_FILE_BASE}_tab.cpp bison_impl.input = BISON_SOURCES bison_impl.commands = $$MAKEFILE_NOOP_COMMAND -bison_impl.depends = ${QMAKE_FILE_BASE}_tab.h -bison_impl.output = ${QMAKE_FILE_BASE}_tab.cpp +bison_impl.depends = $${BUILDSUBDIR}${QMAKE_FILE_BASE}_tab.h +bison_impl.output = $${BUILDSUBDIR}${QMAKE_FILE_BASE}_tab.cpp bison_impl.variable_out = GENERATED_SOURCES QMAKE_EXTRA_COMPILERS += bison_impl diff --git a/src/angle/src/config.pri b/src/angle/src/config.pri index 0d75245ec5..085913ac83 100644 --- a/src/angle/src/config.pri +++ b/src/angle/src/config.pri @@ -53,6 +53,8 @@ CONFIG(debug, debug|release) { DEFINES += NDEBUG } +!isEmpty(BUILD_PASS): BUILDSUBDIR = $$lower($$BUILD_PASS)/ + # c++11 is needed by MinGW to get support for unordered_map. CONFIG += stl exceptions c++11 -- cgit v1.2.3 From 08be8691f7ba5e522cbc000b1880941128ad5f8c Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Fri, 23 Oct 2015 21:21:38 +0300 Subject: Fix QStorageInfo on BSD4 systems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - On NetBSD, the defines were not properly defined; - On all other BSD systems, we use statfs which does not have f_frsize member, revert to using f_bsize there. Task-number: QTBUG-48267 Change-Id: Ia1ed484ac61a615fcbb5b45affb516b5e86a64b0 Reviewed-by: Oswald Buddenhagen Reviewed-by: Lisandro Damián Nicanor Pérez Meyer Reviewed-by: Thiago Macieira --- src/corelib/io/qstorageinfo_unix.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index bf1e6ce245..6ae3338cbd 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -68,8 +68,8 @@ #if defined(Q_OS_BSD4) # if defined(Q_OS_NETBSD) - define QT_STATFSBUF struct statvfs - define QT_STATFS ::statvfs +# define QT_STATFSBUF struct statvfs +# define QT_STATFS ::statvfs # else # define QT_STATFSBUF struct statfs # define QT_STATFS ::statfs @@ -506,9 +506,15 @@ void QStorageInfoPrivate::retrieveVolumeInfo() valid = true; ready = true; +#if defined(Q_OS_BSD4) && !defined(Q_OS_NETBSD) + bytesTotal = statfs_buf.f_blocks * statfs_buf.f_bsize; + bytesFree = statfs_buf.f_bfree * statfs_buf.f_bsize; + bytesAvailable = statfs_buf.f_bavail * statfs_buf.f_bsize; +#else bytesTotal = statfs_buf.f_blocks * statfs_buf.f_frsize; bytesFree = statfs_buf.f_bfree * statfs_buf.f_frsize; bytesAvailable = statfs_buf.f_bavail * statfs_buf.f_frsize; +#endif #if defined(Q_OS_ANDROID) || defined (Q_OS_BSD4) #if defined(_STATFS_F_FLAGS) readOnly = (statfs_buf.f_flags & ST_RDONLY) != 0; -- cgit v1.2.3 From 95b1982e4779160a42000661986a31aab6bafbb5 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 23 Oct 2015 09:20:21 +0200 Subject: Return early if there is no text at the offset Change-Id: I9d0b1e6e054a48bac34fb4e51b656c475f5638b4 Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index 84d60df3ef..6769f4ab0c 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -54,6 +54,14 @@ static void convertLineOffset(QAccessibleTextInterface *text, int &line, int &of do { curStart = curEnd; text->textAtOffset(curStart, QAccessible::LineBoundary, &curStart, &curEnd); + // If the text is empty then we just return + if (curStart == -1 || curEnd == -1) { + if (start) + *start = 0; + if (end) + *end = 0; + return; + } ++curLine; { // check for a case where a single word longer than the text edit's width and gets wrapped -- cgit v1.2.3 From a91c40868bbdc1b2d2dd3b5f8b47aae9e8589a81 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 22 Oct 2015 10:29:18 +0200 Subject: Check if the session is valid before connecting to it Since there are circumstances where the session is not yet created after start() is called then we should check if the session is valid before connecting to it. Change-Id: I94236f76e4be2433a8c96eb91ce2d4b4d42f2fd9 Reviewed-by: Richard J. Moore --- src/network/access/qnetworkreplyhttpimpl.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index c1956ae99f..76c2f57380 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -1679,8 +1679,9 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation() #endif } else { #ifndef QT_NO_BEARERMANAGEMENT - QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)), - q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection); + if (session) + QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)), + q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), Qt::QueuedConnection); #endif } -- cgit v1.2.3 From 7daae2c2c706fd5d1c1ae44ace6847bc297803a0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 19 Oct 2015 14:25:37 +0200 Subject: Windows: Delay-initialize pluggable touch devices. Move touch device initialization code to QWindowsContext and replace the assert on the touch device in QWindowsMouseHandler by a call to the initTouch(). Task-number: QTBUG-48849 Change-Id: If8573b8283ef94e7fd015f6edc626e3c8cc0b139 Reviewed-by: Joni Poikelin Reviewed-by: Oliver Wolff Reviewed-by: Andreas Holzammer Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowscontext.cpp | 45 +++++++++++++++++++--- src/plugins/platforms/windows/qwindowscontext.h | 3 ++ .../platforms/windows/qwindowsintegration.cpp | 12 +----- .../platforms/windows/qwindowsmousehandler.cpp | 17 ++++++-- .../platforms/windows/qwindowsmousehandler.h | 1 + 5 files changed, 57 insertions(+), 21 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 3f355db607..00049bd0d6 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -33,6 +33,7 @@ ****************************************************************************/ #include "qwindowscontext.h" +#include "qwindowsintegration.h" #include "qwindowswindow.h" #include "qwindowskeymapper.h" #include "qwindowsguieventdispatcher.h" @@ -201,12 +202,14 @@ void QWindowsUser32DLL::init() bool QWindowsUser32DLL::initTouch() { - QSystemLibrary library(QStringLiteral("user32")); - isTouchWindow = (IsTouchWindow)(library.resolve("IsTouchWindow")); - registerTouchWindow = (RegisterTouchWindow)(library.resolve("RegisterTouchWindow")); - unregisterTouchWindow = (UnregisterTouchWindow)(library.resolve("UnregisterTouchWindow")); - getTouchInputInfo = (GetTouchInputInfo)(library.resolve("GetTouchInputInfo")); - closeTouchInputHandle = (CloseTouchInputHandle)(library.resolve("CloseTouchInputHandle")); + if (!isTouchWindow && QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) { + QSystemLibrary library(QStringLiteral("user32")); + isTouchWindow = (IsTouchWindow)(library.resolve("IsTouchWindow")); + registerTouchWindow = (RegisterTouchWindow)(library.resolve("RegisterTouchWindow")); + unregisterTouchWindow = (UnregisterTouchWindow)(library.resolve("UnregisterTouchWindow")); + getTouchInputInfo = (GetTouchInputInfo)(library.resolve("GetTouchInputInfo")); + closeTouchInputHandle = (CloseTouchInputHandle)(library.resolve("CloseTouchInputHandle")); + } return isTouchWindow && registerTouchWindow && unregisterTouchWindow && getTouchInputInfo && closeTouchInputHandle; } @@ -359,6 +362,36 @@ QWindowsContext::~QWindowsContext() m_instance = 0; } +bool QWindowsContext::initTouch() +{ + return initTouch(QWindowsIntegration::instance()->options()); +} + +bool QWindowsContext::initTouch(unsigned integrationOptions) +{ + if (d->m_systemInfo & QWindowsContext::SI_SupportsTouch) + return true; + + QTouchDevice *touchDevice = d->m_mouseHandler.ensureTouchDevice(); + if (!touchDevice) + return false; + +#ifndef Q_OS_WINCE + if (!QWindowsContext::user32dll.initTouch()) { + delete touchDevice; + return false; + } +#endif // !Q_OS_WINCE + + if (!(integrationOptions & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch)) + touchDevice->setCapabilities(touchDevice->capabilities() | QTouchDevice::MouseEmulation); + + QWindowSystemInterface::registerTouchDevice(touchDevice); + + d->m_systemInfo |= QWindowsContext::SI_SupportsTouch; + return true; +} + void QWindowsContext::setTabletAbsoluteRange(int a) { #if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index d2a3481b28..641e3ed41f 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -170,6 +170,9 @@ public: explicit QWindowsContext(); ~QWindowsContext(); + bool initTouch(); + bool initTouch(unsigned integrationOptions); // For calls from QWindowsIntegration::QWindowsIntegration() only. + int defaultDPI() const; QString registerWindowClass(const QWindow *w); diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 79df6ce720..089c3cd0fe 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -230,17 +230,7 @@ QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList ¶mL << __FUNCTION__ << "DpiAwareness=" << dpiAwareness <<",Scaling=" << QWindowsScaling::factor(); - QTouchDevice *touchDevice = m_context.touchDevice(); - if (touchDevice) { -#ifdef Q_OS_WINCE - touchDevice->setCapabilities(touchDevice->capabilities() | QTouchDevice::MouseEmulation); -#else - if (!(m_options & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch)) { - touchDevice->setCapabilities(touchDevice->capabilities() | QTouchDevice::MouseEmulation); - } -#endif - QWindowSystemInterface::registerTouchDevice(touchDevice); - } + m_context.initTouch(m_options); } QWindowsIntegrationPrivate::~QWindowsIntegrationPrivate() diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index e6b80f2b93..e83354157b 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -150,12 +150,19 @@ static inline QTouchDevice *createTouchDevice() QWindowsMouseHandler::QWindowsMouseHandler() : m_windowUnderMouse(0), m_trackedWindow(0), - m_touchDevice(createTouchDevice()), + m_touchDevice(Q_NULLPTR), m_leftButtonDown(false), m_previousCaptureWindow(0) { } +QTouchDevice *QWindowsMouseHandler::ensureTouchDevice() +{ + if (!m_touchDevice) + m_touchDevice = createTouchDevice(); + return m_touchDevice; +} + Qt::MouseButtons QWindowsMouseHandler::queryMouseButtons() { Qt::MouseButtons result = 0; @@ -480,7 +487,11 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, typedef QWindowSystemInterface::TouchPoint QTouchPoint; typedef QList QTouchPointList; - Q_ASSERT(m_touchDevice); + if (!QWindowsContext::instance()->initTouch()) { + qWarning("Unable to initialize touch handling."); + return true; + } + const QRect screenGeometry = window->screen()->geometry(); const int winTouchPointCount = msg.wParam; @@ -491,8 +502,6 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, touchPoints.reserve(winTouchPointCount); Qt::TouchPointStates allStates = 0; - Q_ASSERT(QWindowsContext::user32dll.getTouchInputInfo); - QWindowsContext::user32dll.getTouchInputInfo((HANDLE) msg.lParam, msg.wParam, winTouchInputs.data(), sizeof(TOUCHINPUT)); const qreal screenPosFactor = 0.01 / qreal(QWindowsScaling::factor()); for (int i = 0; i < winTouchPointCount; ++i) { diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.h b/src/plugins/platforms/windows/qwindowsmousehandler.h index 61aa8d6084..4b5078567d 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.h +++ b/src/plugins/platforms/windows/qwindowsmousehandler.h @@ -52,6 +52,7 @@ public: QWindowsMouseHandler(); QTouchDevice *touchDevice() const { return m_touchDevice; } + QTouchDevice *ensureTouchDevice(); bool translateMouseEvent(QWindow *widget, HWND hwnd, QtWindows::WindowsEventType t, MSG msg, -- cgit v1.2.3 From 5a7f69f82434498124f060386d518a099d3aca16 Mon Sep 17 00:00:00 2001 From: Dyami Caliri Date: Wed, 28 Oct 2015 13:47:24 -0700 Subject: Fix Vista style compilation with QT_NO_ACCESSIBILITY A recent change uses an accessibility function even if accessibility is disabled. Change-Id: Ibf9afbb90120772065743b2f9dd3615e4e6a2f37 Reviewed-by: Gabriel de Dietrich --- src/widgets/styles/qwindowsvistastyle.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index b8ed82fee3..375ada6a64 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -657,10 +657,12 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt newStyle = !qobject_cast(view); selectionBehavior = view->selectionBehavior(); selectionMode = view->selectionMode(); - } else if (!widget) { + } +#ifndef QT_NO_ACCESSIBILITY + else if (!widget) { newStyle = !QStyleHelper::hasAncestor(option->styleObject, QAccessible::MenuItem) ; } - +#endif if (newStyle && (vopt = qstyleoption_cast(option))) { bool selected = vopt->state & QStyle::State_Selected; const bool hover = selectionMode != QAbstractItemView::NoSelection && (vopt->state & QStyle::State_MouseOver); -- cgit v1.2.3 From dfaffcbf2a20cd7ff781de88ac3e73d9f17d1cdf Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 30 Oct 2015 15:09:55 +0100 Subject: QWindowsPipeReader: fix occasional "Unknown error 995" After canceling the asynchronous read operation, the notified() slot receives ERROR_OPERATION_ABORTED. We must not handle this situation as an error. This amends commit 5ce567c5. Task-number: QTBUG-48336 Change-Id: Iff948ceb3ad1f805a9de8c188fbc39ed4c76ba82 Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qwindowspipereader.cpp | 4 +++ .../socket/qlocalsocket/tst_qlocalsocket.cpp | 29 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp index c1f5d2aace..3200a70c94 100644 --- a/src/corelib/io/qwindowspipereader.cpp +++ b/src/corelib/io/qwindowspipereader.cpp @@ -186,6 +186,10 @@ void QWindowsPipeReader::notified(quint32 numberOfBytesRead, quint32 errorCode, case ERROR_PIPE_NOT_CONNECTED: pipeBroken = true; break; + case ERROR_OPERATION_ABORTED: + if (stopped) + break; + // fall through default: emit winError(errorCode, QLatin1String("QWindowsPipeReader::notified")); pipeBroken = true; diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index 4881d86937..9130aff4e2 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -98,6 +98,7 @@ private slots: void removeServer(); void recycleServer(); + void recycleClientSocket(); void multiConnect(); void writeOnlySocket(); @@ -954,6 +955,34 @@ void tst_QLocalSocket::recycleServer() QVERIFY(server.nextPendingConnection() != 0); } +void tst_QLocalSocket::recycleClientSocket() +{ + const QByteArrayList lines = QByteArrayList() << "Have you heard of that new band" + << "\"1023 Megabytes\"?" + << "They haven't made it to a gig yet."; + QLocalServer server; + const QString serverName = QStringLiteral("recycleClientSocket"); + QVERIFY(server.listen(serverName)); + QLocalSocket client; + QSignalSpy clientReadyReadSpy(&client, SIGNAL(readyRead())); + QSignalSpy clientErrorSpy(&client, SIGNAL(error(QLocalSocket::LocalSocketError))); + for (int i = 0; i < lines.count(); ++i) { + client.abort(); + clientReadyReadSpy.clear(); + client.connectToServer(serverName); + QVERIFY(client.waitForConnected()); + QVERIFY(server.waitForNewConnection()); + QLocalSocket *serverSocket = server.nextPendingConnection(); + QVERIFY(serverSocket); + connect(serverSocket, &QLocalSocket::disconnected, &QLocalSocket::deleteLater); + serverSocket->write(lines.at(i)); + serverSocket->flush(); + QVERIFY(clientReadyReadSpy.wait()); + QCOMPARE(client.readAll(), lines.at(i)); + QVERIFY(clientErrorSpy.isEmpty()); + } +} + void tst_QLocalSocket::multiConnect() { QLocalServer server; -- cgit v1.2.3 From 6ed957fd7fc748143093fa335d8b4506c3ea16fa Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Mon, 2 Nov 2015 15:42:58 +0100 Subject: fix MinGW ANGLE build glslang_tab.cpp was not created in the right subdirectory. This amends commit 69167189. Change-Id: I031499baa53b72a1923883c58eb5ddfc2a02789a Reviewed-by: Liang Qi Reviewed-by: Oswald Buddenhagen --- src/angle/src/compiler/translator.pro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/angle/src/compiler/translator.pro b/src/angle/src/compiler/translator.pro index eebe41b09e..b40aa96319 100644 --- a/src/angle/src/compiler/translator.pro +++ b/src/angle/src/compiler/translator.pro @@ -170,8 +170,10 @@ flex.dependency_type = TYPE_C flex.variable_out = GENERATED_SOURCES QMAKE_EXTRA_COMPILERS += flex +defineReplace(myDirName) { return($$dirname(1)) } bison.commands = $$addGnuPath(bison) --no-lines --skeleton=yacc.c --defines=${QMAKE_FILE_OUT} \ - --output=${QMAKE_FILE_OUT_BASE}.cpp ${QMAKE_FILE_NAME} + --output=${QMAKE_FUNC_FILE_OUT_myDirName}$$QMAKE_DIR_SEP${QMAKE_FILE_OUT_BASE}.cpp \ + ${QMAKE_FILE_NAME} bison.output = $${BUILDSUBDIR}${QMAKE_FILE_BASE}_tab.h bison.input = BISON_SOURCES bison.dependency_type = TYPE_C -- cgit v1.2.3